Fix database container creation
This commit is contained in:
@@ -135,7 +135,7 @@ services:
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
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", "--lower-case-table-names=1", "--innodb-use-native-aio=0"]
|
||||
volumes:
|
||||
- ../var/volumes/db:/var/lib/mysql:rw
|
||||
- ./mysql/init:/docker-entrypoint-initdb.d:ro
|
||||
|
||||
7
docker/restart.sh
Executable file → Normal file
7
docker/restart.sh
Executable file → Normal file
@@ -8,13 +8,18 @@ DOCKER_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
ROOT_DIR=$(cd "$DOCKER_DIR/.." && pwd)
|
||||
|
||||
echo "Stopping and removing containers..."
|
||||
(cd "$DOCKER_DIR" && docker compose -f compose.yaml -f compose.override.yaml down -v) || true
|
||||
docker rm -f escapepage-db escapepage-php escapepage-nginx escapepage-mercure escapepage-mailer escapepage-php-worker || true
|
||||
|
||||
echo "Clearing Docker build cache..."
|
||||
docker builder prune -af
|
||||
|
||||
echo "Setting permissions for var/volumes/db..."
|
||||
echo "Setting permissions for var/volumes/db and var directories..."
|
||||
sudo chown -R 1000:1000 "$ROOT_DIR/var/volumes/db" || true
|
||||
sudo chmod -R 777 "$ROOT_DIR/var/volumes/db" || true
|
||||
sudo mkdir -p "$ROOT_DIR/var/cache" "$ROOT_DIR/var/log" "$ROOT_DIR/var/sessions"
|
||||
sudo chown -R 1000:1000 "$ROOT_DIR/var" || true
|
||||
sudo chmod -R 777 "$ROOT_DIR/var" || true
|
||||
|
||||
echo "Running setup script..."
|
||||
"$DOCKER_DIR/setup.sh" --no-build
|
||||
|
||||
12
docker/setup.sh
Executable file → Normal file
12
docker/setup.sh
Executable file → Normal file
@@ -104,9 +104,17 @@ fi
|
||||
|
||||
# Prepare DB
|
||||
echo "Creating database if it doesn't exist..."
|
||||
pexec php bin/console doctrine:database:create --if-not-exists
|
||||
if ! pexec php bin/console doctrine:database:create --if-not-exists; then
|
||||
echo "Error: Database creation failed. Check Docker logs for details." >&2
|
||||
dc logs database
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Running migrations..."
|
||||
pexec php bin/console doctrine:migrations:migrate -n
|
||||
if ! pexec php bin/console doctrine:migrations:migrate -n; then
|
||||
echo "Error: Migrations failed." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Import JS deps (Importmap/Asset Mapper)
|
||||
if [ -f "$ROOT_DIR/importmap.php" ]; then
|
||||
|
||||
Reference in New Issue
Block a user