Skip to content

Commit

Permalink
Moving server to bun to fix instability issues
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmunro committed Jan 21, 2024
1 parent 9a054cc commit f3f42de
Show file tree
Hide file tree
Showing 9 changed files with 253 additions and 239 deletions.
101 changes: 57 additions & 44 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,63 @@
name: Build and Push Docker Image

on:
push:
branches: [main]
push:
branches: [main]
env:
TAG: latest
TAG: latest

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
push: true
tags: ghcr.io/${{ github.repository }}:${{ env.TAG }}

- name: deploy-dev
uses: th0th/[email protected]
env:
RANCHER_BEARER_TOKEN: ${{ secrets.RANCHER_BEARER_TOKEN }}
RANCHER_URL: 'https://rancher.mun.sh'
RANCHER_CLUSTER_ID: 'local'
RANCHER_PROJECT_ID: 'p-vdwsg'
RANCHER_NAMESPACE: 'default'
RANCHER_WORKLOADS: 'rgb'

- name: deploy-dev
uses: th0th/[email protected]
env:
RANCHER_BEARER_TOKEN: ${{ secrets.RANCHER_BEARER_TOKEN }}
RANCHER_URL: 'https://rancher.mun.sh'
RANCHER_CLUSTER_ID: 'local'
RANCHER_PROJECT_ID: 'p-vdwsg'
RANCHER_NAMESPACE: 'default'
RANCHER_WORKLOADS: 'rgb-browser'
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install deps
run: bun install

- name: Build
run: bun run build

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
push: true
tags: ghcr.io/${{ github.repository }}:${{ env.TAG }}

- name: deploy-dev
uses: th0th/[email protected]
env:
RANCHER_BEARER_TOKEN: ${{ secrets.RANCHER_BEARER_TOKEN }}
RANCHER_URL: 'https://rancher.mun.sh'
RANCHER_CLUSTER_ID: 'local'
RANCHER_PROJECT_ID: 'p-vdwsg'
RANCHER_NAMESPACE: 'default'
RANCHER_WORKLOADS: 'rgb'

- name: deploy-dev
uses: th0th/[email protected]
env:
RANCHER_BEARER_TOKEN: ${{ secrets.RANCHER_BEARER_TOKEN }}
RANCHER_URL: 'https://rancher.mun.sh'
RANCHER_CLUSTER_ID: 'local'
RANCHER_PROJECT_ID: 'p-vdwsg'
RANCHER_NAMESPACE: 'default'
RANCHER_WORKLOADS: 'rgb-browser'
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
.env
.env
dist/
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
FROM node:16
FROM oven/bun

COPY . /app
WORKDIR /app

RUN yarn

CMD [ "yarn", "start" ]
EXPOSE 3000
CMD [ "bun", "src/server.ts" ]
Binary file added bun.lockb
Binary file not shown.
21 changes: 9 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,21 @@
"type": "module",
"scripts": {
"start": "vite --host --port 3000",
"serv": "bun --watch src/server.ts",
"build": "vite build",
"headless": "docker run -d --rm -e TZ=Europe/London -p 9222:9222 zenika/alpine-chrome --no-sandbox --remote-debugging-address=0.0.0.0 --remote-debugging-port=9222 http://mun.sh:3000"
},
"license": "MIT",
"dependencies": {
"@pixi/gif": "^2.1.0",
"@pixi/node": "^7.2.0",
"@types/express": "^4.17.17",
"@types/ws": "^8.5.4",
"discord.js": "^14.8.0",
"dotenv": "^16.0.3",
"bun-serve-express": "^1.0.4",
"express": "^4.18.2",
"express-ws": "^5.0.2",
"gsap": "^3.11.5",
"node-fetch": "^3.3.1",
"pixi.js-legacy": "^7.2.1",
"tsx": "^3.12.5",
"vite": "^4.2.0",
"vite-plugin-mix": "^0.4.0",
"ws": "^8.13.0"
"vite": "^5.0.12"
},
"devDependencies": {
"@types/bun": "^1.0.3",
"@types/express": "^4.17.21"
}
}
}
Loading

0 comments on commit f3f42de

Please sign in to comment.