Skip to content

prisma-schemas: Add legacy indexes for stats-updater #147

prisma-schemas: Add legacy indexes for stats-updater

prisma-schemas: Add legacy indexes for stats-updater #147

name: deploy-edgecreator
on:
workflow_dispatch:
push:
branches:
- "master"
- "migrate-api-to-websocket"
jobs:
deploy-edgecreator:
runs-on: ubuntu-latest
environment: production
steps:
- uses: oven-sh/setup-bun@v1
- name: Check out repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Download app .env file
uses: nicklasfrahm/scp-action@main
with:
direction: download
host: ${{ secrets.PRODUCTION_SSH_HOST }}
fingerprint: ${{ secrets.PRODUCTION_SSH_FINGERPRINT }}
username: ${{ secrets.PRODUCTION_SSH_USER }}
key: ${{ secrets.PRODUCTION_SSH_KEY }}
source: /home/bperel/workspace/EdgeCreator2/.env.prod.local
target: apps/edgecreator/.env
- name: Download api .env file
uses: nicklasfrahm/scp-action@main
with:
direction: download
host: ${{ secrets.PRODUCTION_SSH_HOST }}
fingerprint: ${{ secrets.PRODUCTION_SSH_FINGERPRINT }}
username: ${{ secrets.PRODUCTION_SSH_USER }}
key: ${{ secrets.PRODUCTION_SSH_KEY }}
source: /home/bperel/workspace/EdgeCreator2/api/.env.prod.local
target: apps/edgecreator/api/.env
- name: Download prisma-schemas .env file
uses: nicklasfrahm/scp-action@main
with:
direction: download
host: ${{ secrets.PRODUCTION_SSH_HOST }}
fingerprint: ${{ secrets.PRODUCTION_SSH_FINGERPRINT }}
username: ${{ secrets.PRODUCTION_SSH_USER }}
key: ${{ secrets.PRODUCTION_SSH_KEY }}
source: /home/bperel/workspace/DucksManager2/packages/prisma-clients/.env.prod.local
target: packages/prisma-schemas/.env
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: bperel
password: ${{ secrets.DOCKER_REGISTRY_TOKEN_DM }}
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18
cache: "pnpm"
- name: Install dependencies
run: pnpm -r install
- name: Build api bundle
run: pnpm build:edgecreator
- name: Build and push app
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/x86_64
file: apps/edgecreator/Dockerfile
push: true
cache-from: type=registry,ref=ghcr.io/bperel/edgecreator-app:buildcache
cache-to: type=registry,ref=ghcr.io/bperel/edgecreator-app:buildcache,mode=max
tags: |
ghcr.io/bperel/edgecreator-app:websocket
- run: cd apps/edgecreator/api && bun build ./index.ts --outdir dist --minify --target node
- name: Build and push api
uses: docker/build-push-action@v3
with:
context: .
file: apps/edgecreator/api/Dockerfile
platforms: linux/x86_64
push: true
cache-from: type=registry,ref=ghcr.io/bperel/edgecreator-api:buildcache
cache-to: type=registry,ref=ghcr.io/bperel/edgecreator-api:buildcache,mode=max
tags: |
ghcr.io/bperel/edgecreator-api:websocket
- name: Upload docker-compose.yml file
uses: nicklasfrahm/[email protected]
with:
direction: upload
host: ${{ secrets.PRODUCTION_SSH_HOST }}
fingerprint: ${{ secrets.PRODUCTION_SSH_FINGERPRINT }}
username: ${{ secrets.PRODUCTION_SSH_USER }}
key: ${{ secrets.PRODUCTION_SSH_KEY }}
source: apps/edgecreator/docker-compose.yml
target: /home/bperel/workspace/EdgeCreator2/docker-compose.yml
- name: Upload Sentry config
uses: nicklasfrahm/[email protected]
with:
direction: upload
host: ${{ secrets.PRODUCTION_SSH_HOST }}
fingerprint: ${{ secrets.PRODUCTION_SSH_FINGERPRINT }}
username: ${{ secrets.PRODUCTION_SSH_USER }}
key: ${{ secrets.PRODUCTION_SSH_KEY }}
source: apps/edgecreator/config/sentry-relay/config.yml
target: /home/bperel/workspace/EdgeCreator2/config/sentry-relay/config.yml
- name: Upload Sentry project config
uses: nicklasfrahm/[email protected]
with:
direction: upload
host: ${{ secrets.PRODUCTION_SSH_HOST }}
fingerprint: ${{ secrets.PRODUCTION_SSH_FINGERPRINT }}
username: ${{ secrets.PRODUCTION_SSH_USER }}
key: ${{ secrets.PRODUCTION_SSH_KEY }}
source: apps/edgecreator/config/sentry-relay/projects/5595460.json
target: /home/bperel/workspace/EdgeCreator2/config/sentry-relay/projects/5595460.json
- name: Recreate container
uses: appleboy/[email protected]
env:
DOCKER_REGISTRY_TOKEN: ${{ secrets.DOCKER_REGISTRY_TOKEN_DM }}
with:
host: ${{ secrets.PRODUCTION_SSH_HOST }}
username: ${{ secrets.PRODUCTION_SSH_USER }}
key: ${{ secrets.PRODUCTION_SSH_KEY }}
command_timeout: 2m
envs: DOCKER_REGISTRY_TOKEN_DM
script: |
cd ~/workspace/DucksManager2
echo `grep GITHUB_TOKEN .env | cut -d'=' -f2` | docker login ghcr.io -u bperel --password-stdin
cd ~/workspace/EdgeCreator2
docker compose pull && docker compose up -d --force-recreate app-websocket api-websocket sentry-relay