diff --git a/README.md b/README.md index 7d73a99..128b7c0 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,19 @@ -Aller chercher/générer son token sur gitlab : -Préférences/User settings/Personal access tokens +# Gestion des bénévoles d'une association + +## Initialisation + +Afin d'initialiser le projet il est requis de : +- Créer un fichier ``.env`` à la racine +- Copier coller le contenu du fichier ``.env.example`` +- Remplir les variables du fichier .env +- Pour la variable ``GIT_TOKEN`` il est nécessaire de chercher/générer son token sur gitlab dans l'onglet : ``Préférences/User settings/Personal access tokens`` +- Répéter l'opération pour le ``docker/php/.env`` et le ``docker/frontend/.env`` + +## Installation +Il suffit ensuite d'ouvrir un terminal, de ce placer à la racine de ce projet et d'exécuter les commandes suivantes : +```bash +docker compose down -v +``` +```bash +docker compose up --build -d +``` diff --git a/docker-compose.yml b/docker-compose.yml index 7f689a5..589633d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,6 +20,7 @@ services: - "host.docker.internal:host-gateway" volumes: - app-code:/var/www/app + - ./docker/php/.env:/tmp/app.env:ro environment: - GIT_TOKEN=${GIT_TOKEN} - BACKEND_GIT_REPO=${BACKEND_GIT_REPO} @@ -45,8 +46,10 @@ services: - FRONTEND_GIT_BRANCH=${FRONTEND_GIT_BRANCH} volumes: - app-code:/var/www/app + - ./docker/frontend/.env:/tmp/app.env:ro depends_on: - - php + php: + condition: service_healthy restart: "no" nginx: diff --git a/docker/backup/Dockerfile b/docker/backup/Dockerfile index 3567702..8354443 100644 --- a/docker/backup/Dockerfile +++ b/docker/backup/Dockerfile @@ -3,7 +3,7 @@ FROM alpine:latest RUN apk add --no-cache mariadb-client bash dcron RUN mkdir -p /backups -RUN mkdir -p /etc/periodic/15min +RUN mkdir -p /etc/periodic/daily COPY backup_db.sh /etc/periodic/daily/backup_db COPY entrypoint.sh /entrypoint.sh diff --git a/docker/frontend/.env.example b/docker/frontend/.env.example new file mode 100644 index 0000000..8989751 --- /dev/null +++ b/docker/frontend/.env.example @@ -0,0 +1,11 @@ +VITE_API_URL= + +VITE_BROADCASTER=reverb +VITE_REVERB_KEY=local +VITE_REVERB_HOST=127.0.0.1 +VITE_REVERB_PORT=8080 +VITE_FORCE_TLS=false +VITE_DISABLE_STATS=true +VITE_ENCRYPTED=false +VITE_CLUSTER=mt1 +VITE_ENABLED_TRANSPORTS=['ws', 'wss'] \ No newline at end of file diff --git a/docker/frontend/entrypoint.sh b/docker/frontend/entrypoint.sh index 1efd768..8fc7a7b 100644 --- a/docker/frontend/entrypoint.sh +++ b/docker/frontend/entrypoint.sh @@ -27,17 +27,13 @@ fi cd "$FRONTEND_DIR" -if [ -f package.json ]; then - npm ci --prefer-offline --no-audit -fi +cp /tmp/app.env .env + +npm ci --prefer-offline --no-audit npm run build -if [ ! -d "dist" ]; then - exit 1 -fi - -find "$PUBLIC_DIR" -mindepth 1 ! -name '.gitkeep' ! -name 'index.php' ! -name '.htaccess' -delete +find "$PUBLIC_DIR" -mindepth 1 ! -name 'index.php' ! -name '.htaccess' -delete cp -r dist/* "$PUBLIC_DIR/" exit 0 \ No newline at end of file diff --git a/docker/php/.env.example b/docker/php/.env.example new file mode 100644 index 0000000..2a27d34 --- /dev/null +++ b/docker/php/.env.example @@ -0,0 +1,79 @@ +APP_NAME=Laravel +APP_ENV=local +APP_KEY= +APP_DEBUG=true +APP_URL=http://localhost:8000 + +APP_LOCALE=en +APP_FALLBACK_LOCALE=en +APP_FAKER_LOCALE=en_US + +APP_MAINTENANCE_DRIVER=file +# APP_MAINTENANCE_STORE=database + +PHP_CLI_SERVER_WORKERS=4 + +BCRYPT_ROUNDS=12 + +LOG_CHANNEL=stack +LOG_STACK=single +LOG_DEPRECATIONS_CHANNEL=null +LOG_LEVEL=debug + +DB_CONNECTION=mysql +DB_HOST=mariadb +DB_PORT=3306 +DB_DATABASE=laravel +DB_USERNAME=root +DB_PASSWORD=root + +SESSION_DRIVER=database +SESSION_LIFETIME=120 +SESSION_ENCRYPT=false +SESSION_PATH=/ +SESSION_DOMAIN=localhost +SESSION_SECURE_COOKIE=false + +BROADCAST_CONNECTION=reverb +REVERB_APP_ID=local +REVERB_APP_KEY=local +REVERB_APP_SECRET=local +REVERB_HOST=reverb +REVERB_PORT=8080 +REVERB_SCHEME=http +PUSHER_APP_CLUSTER="mt1" + +CACHE_STORE=file +QUEUE_CONNECTION=sync + +FILESYSTEM_DISK=local +# CACHE_PREFIX= + +MEMCACHED_HOST=127.0.0.1 + +REDIS_CLIENT=phpredis +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_MAILER=log +MAIL_SCHEME=null +MAIL_HOST=127.0.0.1 +MAIL_PORT=2525 +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_FROM_ADDRESS="hello@example.com" +MAIL_FROM_NAME="${APP_NAME}" + +AWS_ACCESS_KEY_ID= +AWS_SECRET_ACCESS_KEY= +AWS_DEFAULT_REGION=us-east-1 +AWS_BUCKET= +AWS_USE_PATH_STYLE_ENDPOINT=false + +VITE_APP_NAME="${APP_NAME}" + +SANCTUM_STATEFUL_DOMAINS=localhost,127.0.0.1,localhost:8000 + +TYPESENSE_CONNECTION=typesense +TYPESENSE_API_KEY=xyz diff --git a/docker/php/entrypoint.sh b/docker/php/entrypoint.sh index eb3c64c..fc08e43 100644 --- a/docker/php/entrypoint.sh +++ b/docker/php/entrypoint.sh @@ -18,19 +18,16 @@ if [ -f composer.json ]; then composer update --no-interaction --prefer-dist --optimize-autoloader fi -if [ ! -f .env ] && [ -f .env.example ]; then - cp .env.example .env -fi +cp /tmp/app.env .env -if [ -f artisan ]; then - if ! grep -q "APP_KEY=base64:" .env 2>/dev/null; then - php artisan key:generate --ansi --force - fi -fi +php artisan key:generate --force + +php artisan config:clear +php artisan cache:clear php artisan migrate --force -chown -R www-data:www-data storage bootstrap/cache public +chown -R www-data:www-data public/ storage bootstrap/cache public vendor chmod -R 775 storage bootstrap/cache chmod -R 755 public