feat: Add deployment guide and update README for Coolify setup; include dotenv for environment variable management
This commit is contained in:
@@ -83,6 +83,41 @@ This project uses the arc42 template. Chapters are in `docs/`.
|
||||
- npm 10+
|
||||
- Discord Developer Application (bot token + OAuth2 app)
|
||||
- PostgreSQL instance
|
||||
- Discord server where you can install bots with role/channel permissions
|
||||
|
||||
### Discord Bot Setup (Portal)
|
||||
|
||||
1. Open Discord Developer Portal and create a new application.
|
||||
2. In `Bot` tab, click `Add Bot`.
|
||||
3. Copy these values for runtime config (`bot_settings`):
|
||||
- `DISCORD_TOKEN` from Bot tab (Reset Token if needed)
|
||||
- `DISCORD_CLIENT_ID` from OAuth2 > General
|
||||
4. In `Bot` > `Privileged Gateway Intents`, enable only:
|
||||
- `Server Members Intent` (required by current code)
|
||||
5. Keep these disabled unless code changes require them:
|
||||
- `Message Content Intent`
|
||||
- `Presence Intent`
|
||||
|
||||
Current gateway intents used by this project (`src/bot.ts`):
|
||||
|
||||
- `Guilds`
|
||||
- `GuildMembers` (privileged)
|
||||
- `GuildMessageReactions`
|
||||
|
||||
### Discord Bot Install (OAuth2 URL)
|
||||
|
||||
1. Open `OAuth2` > `URL Generator`.
|
||||
2. Select scopes:
|
||||
- `bot`
|
||||
- `applications.commands`
|
||||
3. Select bot permissions (minimum recommended for current features):
|
||||
- `View Channels`
|
||||
- `Send Messages`
|
||||
- `Read Message History`
|
||||
- `Add Reactions`
|
||||
- `Manage Roles` (call-sheet role assignment)
|
||||
- `Manage Channels` (queue moderation paths)
|
||||
4. Use generated URL to add bot to your server.
|
||||
|
||||
### Installation
|
||||
|
||||
@@ -155,7 +190,7 @@ npm run db:setup
|
||||
```
|
||||
|
||||
- `db:migrate`: applies schema migrations tracked in `schema_migrations`
|
||||
- `db:seed`: inserts initial config values from environment into `bot_settings` when missing
|
||||
- `db:seed`: ensures migrations are applied, then inserts initial config values from environment into `bot_settings` when missing
|
||||
- `db:setup`: runs migrate then seed
|
||||
|
||||
### Runtime Config Source
|
||||
@@ -173,6 +208,16 @@ Recommended flow:
|
||||
3. Run `npm run db:seed` once while legacy env vars are still present.
|
||||
4. Remove legacy runtime vars from `.env` after confirming `bot_settings` contains required keys.
|
||||
|
||||
### Deployment
|
||||
|
||||
Deployment setup and domain configuration moved to `DEPLOYMENT.md`.
|
||||
|
||||
- Coolify project/resource setup
|
||||
- Real domain DNS/TLS and routing patterns
|
||||
- Discord OAuth production redirect alignment
|
||||
- Gitea Actions secret configuration for deploy hooks
|
||||
- Two-resource deploy flow (`omo-bot-backend` + `omo-bot-dashboard`)
|
||||
|
||||
Dashboard quality check:
|
||||
|
||||
```bash
|
||||
@@ -201,16 +246,7 @@ npm run build
|
||||
|
||||
Pipeline file: `.gitea/workflows/ci-cd.yml`
|
||||
|
||||
Flow:
|
||||
|
||||
- bot checks: `npm ci -> npm run lint -> npm run build -> npm run test`
|
||||
- dashboard checks: `admin-dashboard/npm ci -> npm run lint -> npm run build`
|
||||
- deploy: on push to `main`, trigger Coolify deploy webhook
|
||||
|
||||
Required Gitea secrets:
|
||||
|
||||
- `COOLIFY_DEPLOY_HOOK_URL` (required)
|
||||
- `COOLIFY_DEPLOY_TOKEN` (optional bearer token)
|
||||
For full deployment flow, webhook secret strategy, and two-resource Coolify deployment, see `DEPLOYMENT.md`.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
Reference in New Issue
Block a user