-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathbuild.sh
More file actions
53 lines (37 loc) · 1.58 KB
/
build.sh
File metadata and controls
53 lines (37 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# FrankenPHP Docker deployment script
set -e
DOCKER_DIR="/var/www/dereuromark/sandbox5/docker"
APP_DIR="/var/www/dereuromark/sandbox5"
cd "$APP_DIR"
git pull
echo "### Maintenance mode ON ###"
docker exec sandbox-frankenphp php /app/bin/cake.php maintenance_mode activate
echo "### Stop queue worker ###"
# Signal worker to stop accepting new jobs (finishes current job then exits)
docker exec sandbox-queue php /app/bin/cake.php queue worker end all 2>/dev/null || true
# Wait for worker to exit gracefully (up to 120 seconds)
echo "Waiting for queue worker to finish current job..."
docker compose -f "$DOCKER_DIR/docker-compose.yml" stop -t 120 queue
echo "### Composer install ###"
composer install --prefer-dist --no-dev -a --no-interaction
echo "### DB MIGRATION ###"
composer migrate --no-interaction
echo "### ASSETS ###"
bower install --allow-root
composer assets
docker exec sandbox-frankenphp php /app/bin/cake.php asset_compress build
echo "### CLEANUP ###"
rm -rf tmp/cache/models/*
rm -rf tmp/cache/persistent/*
rm -rf tmp/cache/views/*
docker exec sandbox-frankenphp php /app/bin/cake.php cache clear_all
docker exec sandbox-frankenphp php /app/bin/cake.php schema_cache build
echo "### Maintenance mode OFF ###"
docker exec sandbox-frankenphp php /app/bin/cake.php maintenance_mode deactivate
echo "### Restart services ###"
docker compose -f "$DOCKER_DIR/docker-compose.yml" restart frankenphp
docker compose -f "$DOCKER_DIR/docker-compose.yml" start queue
chown -R www-data:www-data "$APP_DIR"
chmod -R 0770 tmp logs webroot/js/cjs/ webroot/css/ccss/
echo "### DONE ###"