Skip to content

Commit

Permalink
feat: deploy Aibyss (#58)
Browse files Browse the repository at this point in the history
## How does this PR impact the user?

- Aibyss is now life on https://aibyss.mfbt.community/
- new version of Aibyss will auto-deploy on every push to main

<img width="1608" alt="image"
src="https://github.com/user-attachments/assets/0e4dce48-ea22-498b-ab94-505086a22548">

## Description

- [x] add `Dockerfile`
- [x] add `docker-compose.yml`
- [x] add the deploy GHA workflow

## Limitations

N/A

## Checklist

- [x] my PR is focused and contains one wholistic change
- [x] I have added screenshots or screen recordings to show the changes
  • Loading branch information
yurijmikhalevich authored Oct 6, 2024
1 parent 3721ba9 commit 1f19e2c
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.git

# Nuxt dev/build outputs
.output
.data
.nuxt
.nitro
.cache
dist

# Node dependencies
node_modules

# Logs
logs
*.log

# Misc
.DS_Store
.fleet
.idea

# Local env files
.env.*
!.env.example
!.env.e2e

# Database
dev.db
dev.db-journal

test-results

.bot-code
26 changes: 26 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: deploy

on:
push:
branches:
- main
workflow_dispatch:

concurrency: deploy

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
- name: Deploy
env:
DEPLOY_HOST: '${{ secrets.DEPLOY_HOST }}'
run: |
echo "${DEPLOY_HOST} ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK7gL3O9UrX6EJ/fDVqB5wlh7e25OxdPlWkIHkNtAdf8" >> ~/.ssh/known_hosts
docker context create --docker "host=ssh://root@${DEPLOY_HOST}" --description "deploy server" "mfabt.club"
docker --context "mfabt.club" compose up --build -d
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:18.20.4

WORKDIR /aibyss

COPY package.json package-lock.json ./
RUN npm ci

COPY . .
RUN npm run prisma:generate
RUN npm run build

CMD ["sh", "-c", "npm run prisma:migrate && npm run start"]
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
aibyss:
container_name: aibyss
build: .
restart: unless-stopped
ports:
- 127.0.0.1:3005:3000
environment:
- DATABASE_URL=file:/data/db.sqlite
- BOT_CODE_DIR=/data/bot-codes
volumes:
- data:/data

volumes:
data:
driver: local
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
"prisma:generate": "prisma generate",
"prisma:migrate": "prisma migrate deploy",
"start": "node .output/server/index.mjs",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "vitest --run --exclude tests/e2e",
Expand Down

0 comments on commit 1f19e2c

Please sign in to comment.