Conversation
hmd-ali
commented
Aug 17, 2026
- chore: add prisma and SQLite deps
- feat: add prisma schema
- ci: enhance CI/CD workflows with rollback support and Prisma integration
- chore: add lru-cache package
- feat: add TAG_ACCESS_ROLE_ID env
- feat: add prisma to tsconfig
- feat: add utils
- feat: export prisma singleton
- feat: add ErrorMessages class
- feat: add bot options
- feat: add tags feature
…ent bulk delete functionality
| @@ -1,58 +1,126 @@ | |||
| name: Build, Test and Deploy Discord Bot to VPS | |||
|
|
|||
| name: Deploy | |||
There was a problem hiding this comment.
The main purpose of the of this workflow is deploying the bot
| REPO_URL: https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | ||
| REF: ${{ github.event.inputs.ref != '' && github.event.inputs.ref || 'main' }} |
There was a problem hiding this comment.
could you explain this, too?
There was a problem hiding this comment.
variables for the Deploy via SSH step, (imagine this is TS file and these are const REPO_URL = ...). makes it cleaner than hardcoding/duplicating them in the scripts.
There was a problem hiding this comment.
I understand that it is setting a var, but i don't get the purpose here. why is it https://x-access-token:? i have never seen this before, so that is why those two lines confuse me.
There was a problem hiding this comment.
yeah mb, repo is public anyways, we don't need that. (first line)
second line (REF) is allowing us to optionally pick a commit SHA when manually triggering a deployment. Pushes to main always deploy main
| services: | ||
| # Production service - optimized runtime | ||
| bot-prod: | ||
| bot: |
There was a problem hiding this comment.
why did you rename it to bot?
There was a problem hiding this comment.
I split the docker file in 2, this one and a .dev.yml one.
we don't need to specify that is bot-prod, since, this docker compose file, is used only in production.
| "test": "tsx --test '**/*.test.ts'", | ||
| "test:ci": "NODE_ENV=test node --test \"dist/**/*.test.js\"", | ||
| "prepare": "husky", | ||
| "prepare": "husky || true", |
There was a problem hiding this comment.
pnpm install automatically calls pnpm prepare if present, husky is a dev dep, it won't be available when running in production.
|| true fixes this, if husky is present, run husky, else do nothing.
Otherwise this will break and the process will exit.
| "@prisma/client": "^7.8.0", | ||
| "discord.js": "^14.26.4", | ||
| "dotenv": "^17.4.2", | ||
| "lru-cache": "^11.5.2", |
There was a problem hiding this comment.
is this in-memory? can you tell my more on why it was added?
There was a problem hiding this comment.
yeah in-memory.
used in the tags cache, to avoid hitting the db on every tag usage.
when someone uses a tag for a first time, they're persisted in-memory
| "@prisma/adapter-better-sqlite3": "^7.8.0", | ||
| "@prisma/client": "^7.8.0", | ||
| "discord.js": "^14.26.4", | ||
| "dotenv": "^17.4.2", |
There was a problem hiding this comment.
why the decision for dotenv?
There was a problem hiding this comment.
I think this was added when I added prisma, I'm not using it directly, will check if removing it affects prisma
| format: ['esm'], | ||
| target: 'esnext', | ||
| entry: ['src/**/*.ts', 'scripts/**/*.ts'], | ||
| entry: ['src/**/*.ts'], |
There was a problem hiding this comment.
we don't have scripts anymore, (changed in previous PRs)