diff --git a/.env.example b/.env.example index 8bf6b1a..3ad68fd 100644 --- a/.env.example +++ b/.env.example @@ -2,7 +2,7 @@ # Copier ce fichier en .env et modifier les valeurs selon votre environnement # Port de l'application -PORT=3000 +PORT=2222 # Secret JWT - CHANGER EN PRODUCTION avec une valeur forte et aléatoire # Générer avec: node -e "console.log(require('crypto').randomBytes(64).toString('hex'))" diff --git a/Dockerfile b/Dockerfile index 5598f6b..1d682a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,12 +23,12 @@ RUN mkdir -p /app/data /app/public/uploads && \ # Utiliser l'utilisateur node pour la sécurité USER node -# Exposer le port 3000 -EXPOSE 3000 +# Exposer le port 2222 +EXPOSE 2222 # Healthcheck pour vérifier que l'application fonctionne HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \ - CMD node -e "require('http').get('http://localhost:3000/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))" + CMD node -e "require('http').get('http://localhost:2222/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))" # Démarrer l'application CMD ["node", "server.js"] \ No newline at end of file diff --git a/README.md b/README.md index 8079d26..6a912a4 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ cp .env.example .env Éditer le fichier `.env` : ```env -PORT=3000 +PORT=2222 JWT_SECRET= NODE_ENV=production ``` @@ -78,7 +78,7 @@ docker-compose up -d --build 4. **Accéder à l'application** ``` -http://localhost:3000 +http://localhost:2222 ``` ### Identifiants par défaut @@ -116,7 +116,7 @@ docker-compose restart ```nginx location /notes { - proxy_pass http://notes-todo-app:3000; + proxy_pass http://notes-todo-app:2222; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; diff --git a/docker-compose.yml b/docker-compose.yml index 49d8cf0..0dcdd24 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,21 +5,21 @@ services: build: . container_name: notes-todo-app ports: - - "3000:3000" + - "2222:2222" volumes: - ./data:/app/data - ./public/uploads:/app/public/uploads environment: - NODE_ENV=production - JWT_SECRET=${JWT_SECRET:-change_me_in_production_please_use_strong_secret} - - PORT=3000 + - PORT=2222 - UPLOADS_PATH=/app/public/uploads - DB_PATH=/app/data/notes.db restart: unless-stopped networks: - nginx_default healthcheck: - test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"] + test: ["CMD", "node", "-e", "require('http').get('http://localhost:2222/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"] interval: 30s timeout: 10s retries: 3 diff --git a/server.js b/server.js index fa9acfe..48c157d 100644 --- a/server.js +++ b/server.js @@ -11,7 +11,7 @@ const { initDatabase } = require('./config/database'); // Créer l'application Express const app = express(); -const PORT = process.env.PORT || 3000; +const PORT = process.env.PORT || 2222; // Créer les dossiers nécessaires const dataDir = path.join(__dirname, 'data');