Niet weggooien van images 2
This commit is contained in:
2
.env
2
.env
@@ -44,7 +44,7 @@ MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
|
|||||||
###< symfony/messenger ###
|
###< symfony/messenger ###
|
||||||
|
|
||||||
###> symfony/mailer ###
|
###> symfony/mailer ###
|
||||||
# Development: use Mailpit (docker-compose override provides service `mailer` on port 1025)
|
# Development: use Mailpit (docker compose override provides service `mailer` on port 1025)
|
||||||
MAILER_DSN=smtp://mailer:1025
|
MAILER_DSN=smtp://mailer:1025
|
||||||
# Production/Stage (uncomment and set SENDGRID_API_KEY in real env or secrets):
|
# Production/Stage (uncomment and set SENDGRID_API_KEY in real env or secrets):
|
||||||
# MAILER_DSN=sendgrid+api://%env(SENDGRID_API_KEY)%
|
# MAILER_DSN=sendgrid+api://%env(SENDGRID_API_KEY)%
|
||||||
|
|||||||
14
README.md
14
README.md
@@ -16,9 +16,9 @@ This repository contains a Symfony 7.3 (PHP >= 8.5.1) application for a collabor
|
|||||||
6. Run tests: `vendor/bin/phpunit`
|
6. Run tests: `vendor/bin/phpunit`
|
||||||
|
|
||||||
- With Docker:
|
- With Docker:
|
||||||
1. `docker-compose up -d`
|
1. `cd docker && docker compose up -d`
|
||||||
2. Install vendors inside the PHP container:
|
2. Install vendors inside the PHP container:
|
||||||
- `docker-compose exec php bash`
|
- `docker compose exec php bash`
|
||||||
- `composer install`
|
- `composer install`
|
||||||
3. Initialize DB:
|
3. Initialize DB:
|
||||||
- `php bin/console doctrine:database:create --if-not-exists`
|
- `php bin/console doctrine:database:create --if-not-exists`
|
||||||
@@ -83,20 +83,14 @@ We use a Mercure hub (Docker service) to push server updates to browsers via Ser
|
|||||||
Quick start (dev):
|
Quick start (dev):
|
||||||
1. Start Docker stack:
|
1. Start Docker stack:
|
||||||
```
|
```
|
||||||
docker-compose up -d
|
cd docker && docker compose up -d
|
||||||
```
|
```
|
||||||
This starts `mercure` at http://localhost:8090 and the app at http://localhost:8080.
|
This starts `mercure` at http://localhost:8090 and the app at http://localhost:8080.
|
||||||
2. Install PHP deps inside the PHP container if you haven't yet:
|
2. Install PHP deps inside the PHP container if you haven't yet:
|
||||||
```
|
```
|
||||||
docker-compose exec php bash
|
docker compose exec php bash
|
||||||
composer install
|
composer install
|
||||||
```
|
```
|
||||||
3. Open the Game Hub page in your browser: http://localhost:8080/game
|
|
||||||
- The page subscribes to a demo topic and logs messages in the console.
|
|
||||||
4. Publish a test update (in the PHP container):
|
|
||||||
```
|
|
||||||
php bin/console app:mercure:publish
|
|
||||||
```
|
|
||||||
You should see a console log like `[Mercure] Update received: { ... }` on the Game Hub page.
|
You should see a console log like `[Mercure] Update received: { ... }` on the Game Hub page.
|
||||||
|
|
||||||
Configuration:
|
Configuration:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
Use this index to quickly locate files and directories during development and in discussions.
|
Use this index to quickly locate files and directories during development and in discussions.
|
||||||
|
|
||||||
## Top-Level
|
## Top-Level
|
||||||
- compose.yaml / compose.override.yaml — Docker services.
|
- docker/compose.yaml / docker/compose.override.yaml — Docker services.
|
||||||
- docker/ — Docker build contexts and configs (php Dockerfile, nginx vhost).
|
- docker/ — Docker build contexts and configs (php Dockerfile, nginx vhost).
|
||||||
- composer.json / composer.lock — Dependencies and scripts.
|
- composer.json / composer.lock — Dependencies and scripts.
|
||||||
- importmap.php — Importmap configuration for JS dependencies.
|
- importmap.php — Importmap configuration for JS dependencies.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ This app can run fully in Docker using docker compose with PHP-FPM, Nginx and My
|
|||||||
- mailer (dev only via compose.override.yaml): Mailpit (SMTP/UI)
|
- mailer (dev only via compose.override.yaml): Mailpit (SMTP/UI)
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
- Docker and Docker Compose (docker-compose)
|
- Docker and Docker Compose (docker compose)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -21,36 +21,42 @@ App will be served at http://localhost:8080
|
|||||||
|
|
||||||
Alternatively (manual):
|
Alternatively (manual):
|
||||||
```
|
```
|
||||||
docker-compose up -d --build
|
cd docker
|
||||||
|
docker compose up -d --build
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2) Install dependencies
|
### 2) Install dependencies
|
||||||
The setup script already runs composer install. To run manually:
|
The setup script already runs composer install. To run manually:
|
||||||
```
|
```
|
||||||
docker-compose exec php composer install
|
cd docker
|
||||||
|
docker compose exec php composer install
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3) Prepare DB
|
### 3) Prepare DB
|
||||||
The setup script already prepares the DB. To run manually:
|
The setup script already prepares the DB. To run manually:
|
||||||
```
|
```
|
||||||
docker-compose exec php php bin/console doctrine:database:create --if-not-exists
|
cd docker
|
||||||
docker-compose exec php php bin/console doctrine:migrations:migrate -n
|
docker compose exec php php bin/console doctrine:database:create --if-not-exists
|
||||||
|
docker compose exec php php bin/console doctrine:migrations:migrate -n
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4) Run tests
|
### 4) Run tests
|
||||||
```
|
```
|
||||||
docker-compose exec php vendor/bin/phpunit
|
cd docker
|
||||||
|
docker compose exec php vendor/bin/phpunit
|
||||||
```
|
```
|
||||||
|
|
||||||
### 5) Logs
|
### 5) Logs
|
||||||
```
|
```
|
||||||
docker-compose logs -f nginx
|
cd docker
|
||||||
docker-compose logs -f php
|
docker compose logs -f nginx
|
||||||
|
docker compose logs -f php
|
||||||
```
|
```
|
||||||
|
|
||||||
### 6) Stop
|
### 6) Stop
|
||||||
```
|
```
|
||||||
docker-compose down
|
cd docker
|
||||||
|
docker compose down
|
||||||
```
|
```
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ version: '3.7'
|
|||||||
services:
|
services:
|
||||||
php:
|
php:
|
||||||
environment:
|
environment:
|
||||||
XDEBUG_MODE: "off"
|
XDEBUG_MODE: off
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -3,14 +3,14 @@ version: '3.7'
|
|||||||
services:
|
services:
|
||||||
php:
|
php:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: ../
|
||||||
dockerfile: docker/php/Dockerfile
|
dockerfile: php/Dockerfile
|
||||||
args:
|
args:
|
||||||
USER_ID: ${USER_ID:-1000}
|
USER_ID: ${USER_ID:-1000}
|
||||||
GROUP_ID: ${GROUP_ID:-1000}
|
GROUP_ID: ${GROUP_ID:-1000}
|
||||||
container_name: escapepage-php
|
container_name: escapepage-php
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/var/www/html:delegated
|
- ../:/var/www/html:delegated
|
||||||
- /etc/hosts:/etc/hosts:ro
|
- /etc/hosts:/etc/hosts:ro
|
||||||
environment:
|
environment:
|
||||||
APP_ENV: ${APP_ENV:-dev}
|
APP_ENV: ${APP_ENV:-dev}
|
||||||
@@ -24,14 +24,14 @@ services:
|
|||||||
|
|
||||||
php-worker:
|
php-worker:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: ../
|
||||||
dockerfile: docker/php/Dockerfile
|
dockerfile: php/Dockerfile
|
||||||
args:
|
args:
|
||||||
USER_ID: ${USER_ID:-1000}
|
USER_ID: ${USER_ID:-1000}
|
||||||
GROUP_ID: ${GROUP_ID:-1000}
|
GROUP_ID: ${GROUP_ID:-1000}
|
||||||
container_name: escapepage-php-worker
|
container_name: escapepage-php-worker
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/var/www/html:delegated
|
- ../:/var/www/html:delegated
|
||||||
- /etc/hosts:/etc/hosts:ro
|
- /etc/hosts:/etc/hosts:ro
|
||||||
environment:
|
environment:
|
||||||
APP_ENV: ${APP_ENV:-dev}
|
APP_ENV: ${APP_ENV:-dev}
|
||||||
@@ -51,9 +51,9 @@ services:
|
|||||||
- "8080:80"
|
- "8080:80"
|
||||||
- "8443:443"
|
- "8443:443"
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/var/www/html:ro
|
- ../:/var/www/html:ro
|
||||||
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
- ./docker/nginx/ssl:/etc/nginx/ssl:ro
|
- ./nginx/ssl:/etc/nginx/ssl:ro
|
||||||
- /etc/hosts:/etc/hosts:ro
|
- /etc/hosts:/etc/hosts:ro
|
||||||
depends_on:
|
depends_on:
|
||||||
- php
|
- php
|
||||||
@@ -113,8 +113,8 @@ services:
|
|||||||
start_period: 30s
|
start_period: 30s
|
||||||
command: ["--default-authentication-plugin=mysql_native_password", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci"]
|
command: ["--default-authentication-plugin=mysql_native_password", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci"]
|
||||||
volumes:
|
volumes:
|
||||||
- ./var/volumes/db:/var/lib/mysql:rw
|
- ../var/volumes/db:/var/lib/mysql:rw
|
||||||
- ./docker/mysql/init:/docker-entrypoint-initdb.d:ro
|
- ./mysql/init:/docker-entrypoint-initdb.d:ro
|
||||||
- /etc/hosts:/etc/hosts:ro
|
- /etc/hosts:/etc/hosts:ro
|
||||||
# Uncomment the two lines below if you need to access MySQL from your host (workbench, etc.)
|
# Uncomment the two lines below if you need to access MySQL from your host (workbench, etc.)
|
||||||
ports:
|
ports:
|
||||||
@@ -4,11 +4,10 @@ set -euo pipefail
|
|||||||
# Script to completely restart the project as requested
|
# Script to completely restart the project as requested
|
||||||
|
|
||||||
echo "Stopping and removing containers..."
|
echo "Stopping and removing containers..."
|
||||||
dc() { (cd "$(dirname "$0")/.." && docker-compose "$@"); }
|
docker compose -f compose.yaml -f compose.override.yaml --env-file ../.env down --remove-orphans
|
||||||
dc down
|
|
||||||
|
|
||||||
echo "Clearing Docker build cache..."
|
echo "Clearing Docker build cache..."
|
||||||
docker builder prune -f
|
docker builder prune -af
|
||||||
|
|
||||||
echo "Running setup script..."
|
echo "Running setup script..."
|
||||||
"$(dirname "$0")/setup.sh" --no-build
|
./setup.sh --no-build
|
||||||
|
|||||||
@@ -18,17 +18,17 @@ set -euo pipefail
|
|||||||
ROOT_DIR=$(cd "$(dirname "$0")"/.. && pwd)
|
ROOT_DIR=$(cd "$(dirname "$0")"/.. && pwd)
|
||||||
DOCKER_DIR="$ROOT_DIR/docker"
|
DOCKER_DIR="$ROOT_DIR/docker"
|
||||||
# Determine the docker-compose command
|
# Determine the docker-compose command
|
||||||
if command -v docker-compose >/dev/null 2>&1; then
|
if docker compose version >/dev/null 2>&1; then
|
||||||
DOCKER_COMPOSE="docker-compose"
|
|
||||||
elif docker compose version >/dev/null 2>&1; then
|
|
||||||
DOCKER_COMPOSE="docker compose"
|
DOCKER_COMPOSE="docker compose"
|
||||||
|
elif command -v docker-compose >/dev/null 2>&1; then
|
||||||
|
DOCKER_COMPOSE="docker-compose"
|
||||||
else
|
else
|
||||||
echo "Error: Neither 'docker-compose' nor 'docker compose' was found. Please install Docker Compose." >&2
|
echo "Error: Neither 'docker-compose' nor 'docker compose' was found. Please install Docker Compose." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Helper to run docker compose from the project root
|
# Helper to run docker compose from the docker directory
|
||||||
dc() { (cd "$ROOT_DIR" && $DOCKER_COMPOSE "$@"); }
|
dc() { (cd "$DOCKER_DIR" && $DOCKER_COMPOSE -f compose.yaml -f compose.override.yaml --env-file ../.env "$@"); }
|
||||||
|
|
||||||
REBUILD=1
|
REBUILD=1
|
||||||
RECREATE=0
|
RECREATE=0
|
||||||
@@ -132,12 +132,12 @@ Open the app: $APP_URL
|
|||||||
Mailpit (dev): $MAILPIT_URL
|
Mailpit (dev): $MAILPIT_URL
|
||||||
|
|
||||||
Common commands:
|
Common commands:
|
||||||
(cd "$ROOT_DIR" && $DOCKER_COMPOSE logs -f nginx)
|
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE logs -f nginx)
|
||||||
(cd "$ROOT_DIR" && $DOCKER_COMPOSE logs -f php)
|
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE logs -f php)
|
||||||
(cd "$ROOT_DIR" && $DOCKER_COMPOSE logs -f php-worker)
|
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE logs -f php-worker)
|
||||||
(cd "$ROOT_DIR" && $DOCKER_COMPOSE exec php bash)
|
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE exec php bash)
|
||||||
(cd "$ROOT_DIR" && $DOCKER_COMPOSE exec php npm run watch)
|
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE exec php npm run watch)
|
||||||
(cd "$ROOT_DIR" && $DOCKER_COMPOSE down)
|
(cd "$DOCKER_DIR" && $DOCKER_COMPOSE down)
|
||||||
|
|
||||||
You can re-run this script any time. Use --no-build to skip rebuilding images.
|
You can re-run this script any time. Use --no-build to skip rebuilding images.
|
||||||
EOT
|
EOT
|
||||||
|
|||||||
Reference in New Issue
Block a user