Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add production database config for clorie #2

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,18 @@ $ node -v
```

And that's it! You are good to go 🎆

### Setting up production database

Before deploying your own Clorinde bot to production, you must first to create a MySQL database. To do so you should first generate a unique password for your production database by executing the following command:

```bash
$ chmod +x ./scripts/generate-prod-db-pass.sh
$ ./scripts/generate-prod-db-pass.sh
```

This will generate a password and put it into `docker/production/docker-compose.yml` for you. After that you can just `cd` into directory with this yaml and run

```bash
$ docker compose up -d
```
10 changes: 10 additions & 0 deletions docker/production/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3'

services:
mysql:
image: mysql:8.0.36
environment:
MYSQL_ROOT_PASSWORD: CHANGE ME
MYSQL_DATABASE: clorie
ports:
- '3306:3306'
7 changes: 7 additions & 0 deletions scripts/generate-prod-db-pass.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Generate a random password
new_password=$(openssl rand -hex 16)

# Replace "CHANGE ME" with the generated password
sed -i "s/CHANGE ME/$new_password/g" ./docker/production/docker-compose.yml
Loading