mirror of
https://github.com/arthur-pbty/LazyBot.git
synced 2026-06-03 15:07:29 +02:00
refactor: migrate from SQLite to PostgreSQL for session management and data storage
- Updated package dependencies to replace SQLite with PostgreSQL. - Modified privacy policy to reflect the change in database technology. - Adjusted session management in server.js to use connect-pg-simple. - Enhanced docker-compose.yml to include PostgreSQL service with health checks. - Added Dockerfile for multi-stage builds for development and production environments. - Introduced .dockerignore to exclude unnecessary files from the Docker context.
This commit is contained in:
@@ -16,7 +16,7 @@ Site officiel: https://lazybot.arthurp.fr
|
||||
|
||||
- Node.js
|
||||
- Discord.js
|
||||
- SQLite
|
||||
- PostgreSQL
|
||||
- Docker et Docker Compose
|
||||
|
||||
## Installation
|
||||
@@ -40,15 +40,41 @@ cp .env.example .env
|
||||
CLIENT_ID=VOTRE_BOT_CLIENT_ID
|
||||
CLIENT_SECRET=VOTRE_BOT_CLIENT_SECRET
|
||||
REDIRECT_URI=https://lazybot.arthurp.fr/auth/discord/callback
|
||||
NODE_ENV=production
|
||||
PORT=3000
|
||||
BOT_TOKEN=VOTRE_TOKEN_BOT
|
||||
SESSION_SECRET=UN_SECRET_LONG_ET_UNIQUE
|
||||
DB_PATH=database.sqlite
|
||||
POSTGRES_HOST=db
|
||||
POSTGRES_PORT=5432
|
||||
POSTGRES_DB=lazybot
|
||||
POSTGRES_USER=lazybot
|
||||
POSTGRES_PASSWORD=change_me
|
||||
POSTGRES_DATA_PATH=./data/postgres
|
||||
DATABASE_URL=postgresql://lazybot:change_me@db:5432/lazybot
|
||||
OWNER=VOTRE_ID_UTILISATEUR
|
||||
URL=https://lazybot.arthurp.fr
|
||||
```
|
||||
|
||||
4. Lancer avec Docker
|
||||
Variables d'environnement prises en charge:
|
||||
|
||||
- CLIENT_ID
|
||||
- CLIENT_SECRET
|
||||
- REDIRECT_URI
|
||||
- NODE_ENV
|
||||
- PORT
|
||||
- BOT_TOKEN
|
||||
- SESSION_SECRET
|
||||
- POSTGRES_HOST
|
||||
- POSTGRES_PORT
|
||||
- POSTGRES_DB
|
||||
- POSTGRES_USER
|
||||
- POSTGRES_PASSWORD
|
||||
- POSTGRES_DATA_PATH
|
||||
- DATABASE_URL
|
||||
- OWNER
|
||||
- URL
|
||||
|
||||
4. Lancer
|
||||
|
||||
```bash
|
||||
docker compose up -d --build
|
||||
@@ -56,6 +82,26 @@ docker compose up -d --build
|
||||
|
||||
Le dashboard est ensuite disponible sur `http://localhost:3000`.
|
||||
|
||||
## Exemples de profils
|
||||
|
||||
Exemple developpement (.env):
|
||||
|
||||
```env
|
||||
NODE_ENV=development
|
||||
PORT=3002
|
||||
POSTGRES_DATA_PATH=./data/postgres/dev
|
||||
URL=http://localhost:3002
|
||||
```
|
||||
|
||||
Exemple production (.env):
|
||||
|
||||
```env
|
||||
NODE_ENV=production
|
||||
PORT=3000
|
||||
POSTGRES_DATA_PATH=./data/postgres
|
||||
URL=https://lazybot.arthurp.fr
|
||||
```
|
||||
|
||||
## Securite avant publication
|
||||
|
||||
- Ne jamais versionner `.env`
|
||||
|
||||
Reference in New Issue
Block a user