Skip to content

Commit 2376616

Browse files
committed
✨ Update Environment Configuration and Logger Setup
- Add GitHub OAuth credentials to .env.example - Introduce MySQL connection settings in .env.example - Update logger configuration by removing unnecessary transport settings for improved clarity - Exclude memory_bank/ directory from .gitignore
1 parent 3acf9d0 commit 2376616

13 files changed

Lines changed: 314 additions & 11 deletions

.env.example

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ DB_PORT=3306
1010
DB_USER=root
1111
DB_PASSWORD=root
1212
DB_DATABASE=app
13-
GITHUB_CLIENT_ID=
14-
GITHUB_CLIENT_SECRET=
15-
GITHUB_CALLBACK_URL=
13+
GITHUB_CLIENT_ID=e
14+
GITHUB_CLIENT_SECRET=e
15+
GITHUB_CALLBACK_URL=e
16+
DB_CONNECTION=mysqle
17+
MYSQL_HOST=localhost
18+
MYSQL_PORT=3306
19+
MYSQL_USER=root
20+
MYSQL_PASSWORD=
21+
MYSQL_DB_NAME=javascript_cm

.github/workflows/deploy.dev.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Déploiement sur VPS (dev)
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
env:
9+
APP_NAME: ${{ github.event.repository.name }}
10+
APP_PATH: /home/apps/${{ github.event.repository.name }}
11+
NODE_ENV: dev
12+
13+
jobs:
14+
deploy:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Vérifier le code
18+
uses: actions/checkout@v4
19+
20+
- name: Créer le dossier de l'application sur le VPS
21+
uses: appleboy/ssh-action@v1.0.3
22+
with:
23+
host: ${{ secrets.VPS_HOST }}
24+
username: ${{ secrets.VPS_USERNAME }}
25+
key: ${{ secrets.VPS_SSH_KEY }}
26+
port: ${{ secrets.VPS_PORT }}
27+
script: |
28+
mkdir -p ${{ env.APP_PATH }}
29+
cd ${{ env.APP_PATH }}
30+
if [ -d "app" ]; then
31+
rm -rf app
32+
fi
33+
mkdir -p app
34+
35+
- name: Copier les fichiers de l'application
36+
uses: appleboy/scp-action@v0.1.7
37+
with:
38+
host: ${{ secrets.VPS_HOST }}
39+
username: ${{ secrets.VPS_USERNAME }}
40+
key: ${{ secrets.VPS_SSH_KEY }}
41+
port: ${{ secrets.VPS_PORT }}
42+
source: "."
43+
target: "${{ env.APP_PATH }}/app"
44+
strip_components: 0
45+
46+
- name: Mettre à jour le docker-compose avec le nom de l'application
47+
uses: appleboy/ssh-action@v1.0.3
48+
with:
49+
host: ${{ secrets.VPS_HOST }}
50+
username: ${{ secrets.VPS_USERNAME }}
51+
key: ${{ secrets.VPS_SSH_KEY }}
52+
port: ${{ secrets.VPS_PORT }}
53+
script: |
54+
cd "${{ env.APP_PATH }}/app"
55+
sed -i "1s/^/name: ${{ env.APP_NAME }}\n/" compose.${{ env.NODE_ENV }}.yaml
56+
57+
- name: Construire et démarrer les conteneurs Docker
58+
uses: appleboy/ssh-action@v1.0.3
59+
with:
60+
host: ${{ secrets.VPS_HOST }}
61+
username: ${{ secrets.VPS_USERNAME }}
62+
key: ${{ secrets.VPS_SSH_KEY }}
63+
port: ${{ secrets.VPS_PORT }}
64+
script: |
65+
cd "${{ env.APP_PATH }}/app"
66+
docker compose -f compose.${{ env.NODE_ENV }}.yaml down || true
67+
docker compose -f compose.${{ env.NODE_ENV }}.yaml build --no-cache
68+
docker compose -f compose.${{ env.NODE_ENV }}.yaml up -d
69+
docker system prune -f

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ yarn-error.log
2323

2424
# Platform specific
2525
.DS_Store
26+
memory_bank/

Dockerfile.dev

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
ARG NODE_IMAGE=node:20.14.0-bookworm-slim
2+
3+
FROM $NODE_IMAGE AS base
4+
5+
# All deps stage
6+
FROM base AS deps
7+
WORKDIR /app
8+
COPY package*.json ./
9+
RUN npm ci
10+
11+
# Production only deps stage
12+
FROM base AS production-deps
13+
WORKDIR /app
14+
COPY package*.json ./
15+
RUN npm ci --omit=dev
16+
17+
# Build stage
18+
FROM base AS build
19+
WORKDIR /app
20+
COPY --from=deps /app/node_modules /app/node_modules
21+
COPY . .
22+
RUN node ace build
23+
24+
# Production stage
25+
FROM base
26+
ENV NODE_ENV=production
27+
WORKDIR /app
28+
COPY --from=production-deps /app/node_modules /app/node_modules
29+
COPY --from=build /app/build /app
30+
31+
32+
RUN npm i -g @redocly/cli@latest
33+
34+
RUN apt-get update && apt-get install -y default-mysql-client && rm -rf /var/lib/apt/lists/*
35+
36+
EXPOSE $PORT

compose.dev.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
services:
2+
mysql:
3+
image: mysql:8
4+
container_name: jscm_mysql
5+
restart: always
6+
ports:
7+
- "${MYSQL_PORT:-3306}:3306"
8+
env_file:
9+
- .env
10+
volumes:
11+
- jscm_mysql_volume:/var/lib/mysql
12+
environment:
13+
- MYSQL_ROOT_PASSWORD=${MYSQL_PASSWORD}
14+
- MYSQL_DATABASE=${MYSQL_DB_NAME}
15+
- MYSQL_USER=${MYSQL_USER}
16+
# - MYSQL_PASSWORD=${MYSQL_PASSWORD}
17+
healthcheck:
18+
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
19+
retries: 3
20+
timeout: 5s
21+
networks:
22+
- adonis_jscm
23+
24+
api:
25+
container_name: jscm_api
26+
restart: unless-stopped
27+
build:
28+
context: .
29+
dockerfile: Dockerfile.dev
30+
ports:
31+
- ${PORT:-3333}:3333
32+
env_file:
33+
- .env
34+
environment:
35+
- TZ=${TZ}
36+
- PORT=${PORT}
37+
- HOST=${HOST}
38+
- LOG_LEVEL=${LOG_LEVEL}
39+
- APP_KEY=${APP_KEY}
40+
- SESSION_DRIVER=${SESSION_DRIVER}
41+
- DB_CONNECTION=${DB_CONNECTION}
42+
- DB_HOST=${DB_HOST}
43+
- DB_PORT=${DB_PORT}
44+
- DB_USER=${DB_USER}
45+
- DB_PASSWORD=${DB_PASSWORD}
46+
- DB_DATABASE=${DB_DATABASE}
47+
- GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID}
48+
- GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET}
49+
- GITHUB_CALLBACK_URL=${GITHUB_CALLBACK_URL}
50+
- MYSQL_HOST=${MYSQL_HOST}
51+
- MYSQL_PORT=${MYSQL_PORT}
52+
- MYSQL_USER=${MYSQL_USER}
53+
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
54+
- MYSQL_DB_NAME=${MYSQL_DB_NAME}
55+
- MYSQL_DATABASE=${MYSQL_DB_NAME}
56+
57+
volumes:
58+
- jscm_uploads:/app/uploads
59+
- jscm_public:/app/public
60+
command: sh -c "node ace migration:fresh --force && node ace convert:csv-to-json && node ace db:seed && node ace seed:test-data && npm run gen-docs && npm run start"
61+
depends_on:
62+
mysql:
63+
condition: service_healthy
64+
networks:
65+
- adonis_jscm
66+
67+
68+
volumes:
69+
jscm_mysql_volume:
70+
jscm_uploads:
71+
jscm_public:
72+
73+
networks:
74+
adonis_jscm:
75+
driver: bridge

config/logger.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import env from '#start/env'
2-
import app from '@adonisjs/core/services/app'
3-
import { defineConfig, targets } from '@adonisjs/core/logger'
2+
import { defineConfig } from '@adonisjs/core/logger'
43

54
const loggerConfig = defineConfig({
65
default: 'app',
@@ -14,12 +13,6 @@ const loggerConfig = defineConfig({
1413
enabled: true,
1514
name: env.get('APP_NAME'),
1615
level: env.get('LOG_LEVEL'),
17-
transport: {
18-
targets: targets()
19-
.pushIf(!app.inProduction, targets.pretty())
20-
.pushIf(app.inProduction, targets.file({ destination: 1 }))
21-
.toArray(),
22-
},
2316
},
2417
},
2518
})

memory-bank/.cursorrules

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# .cursorrules
2+
3+
## Schémas de mise en œuvre critiques
4+
5+
(Décrivez les schémas importants découverts dans le projet.)
6+
7+
## Préférences de l'utilisateur et flux de travail
8+
9+
(Notez les préférences et les flux de travail pertinents pour l'utilisateur.)
10+
11+
## Schémas spécifiques au projet
12+
13+
(Décrivez les schémas uniques ou récurrents dans ce projet.)
14+
15+
## Défis connus
16+
17+
(Liste des défis techniques ou de processus identifiés.)
18+
19+
## Évolution des décisions du projet
20+
21+
(Enregistrez comment les décisions importantes ont évolué.)
22+
23+
## Schémas d'utilisation des outils
24+
25+
(Observations sur l'utilisation des outils et des processus dans le projet.)

memory-bank/activeContext.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# activeContext.md
2+
3+
## Focus de travail actuel
4+
5+
(Décrivez sur quoi on travaille actuellement.)
6+
7+
## Changements récents
8+
9+
(Résumez les changements récents apportés au projet.)
10+
11+
## Prochaines étapes
12+
13+
(Liste des prochaines étapes ou tâches à accomplir.)
14+
15+
## Décisions et considérations actives
16+
17+
(Notez les décisions récentes et les considérations importantes en cours.)

memory-bank/productContext.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# productContext.md
2+
3+
## Pourquoi ce projet existe-t-il ?
4+
5+
(Expliquez la raison d'être du projet.)
6+
7+
## Problèmes résolus
8+
9+
(Décrivez les problèmes ou besoins auxquels le projet répond.)
10+
11+
## Comment doit-il fonctionner ?
12+
13+
(Expliquez comment le produit est censé fonctionner.)
14+
15+
## Objectifs d'expérience utilisateur
16+
17+
(Définissez les objectifs clés de l'expérience utilisateur.)

memory-bank/progress.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# progress.md
2+
3+
## Ce qui fonctionne
4+
5+
(Décrivez les parties du projet qui fonctionnent déjà.)
6+
7+
## Ce qu'il reste à construire
8+
9+
(Liste des fonctionnalités ou tâches restantes.)
10+
11+
## État actuel
12+
13+
(Résumé de l'état actuel du projet.)
14+
15+
## Problèmes connus
16+
17+
(Liste des problèmes ou bugs identifiés.)

0 commit comments

Comments
 (0)