Skip to content

Commit dcbf346

Browse files
ci: Upgraded docker compose dev environment
1 parent c27f2a9 commit dcbf346

File tree

8 files changed

+28
-151
lines changed

8 files changed

+28
-151
lines changed

.env

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,6 @@ HOSTNAME_PMA=`pma.roadiz-skeleton.test`,`pma.roadiz-skeleton.local`
6161
HOSTNAME_SOLR=`solr.roadiz-skeleton.test`,`solr.roadiz-skeleton.local`
6262
HOSTNAME_MAILER=`mail.roadiz-skeleton.test`,`mail.roadiz-skeleton.local`
6363

64-
# MySQL env vars for DOCKER
65-
MYSQL_ROOT_PASSWORD=root
66-
MYSQL_HOST=db
67-
MYSQL_PORT=3306
68-
MYSQL_DATABASE=roadiz
69-
MYSQL_USER=roadiz
70-
MYSQL_PASSWORD=roadiz
71-
MYSQL_VERSION=8.0
72-
7364
###> symfony/lock ###
7465
# Choose one of the stores below
7566
# postgresql+advisory://db_user:db_password@localhost/db_name

README.md

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -85,36 +85,6 @@ services:
8585
# - "${PUBLIC_SOLR_PORT}:8983/tcp"
8686
```
8787

88-
#### Or use `symfony server:start` instead of Docker
89-
90-
If you are working on a *macOS* environment, you may prefer using `symfony` binary to start a local webserver instead of using
91-
a full _Docker_ stack. You will need to install `symfony` binary first:
92-
93-
```shell
94-
curl -sS https://get.symfony.com/cli/installer | bash
95-
```
96-
97-
And make sure your local PHP environment is configured with php-intl, php-redis, php-gd extensions.
98-
You will need to use at least *MySQL* and *Redis* (and *Solr* if needed) services from Docker stack in order to run your application.
99-
100-
```shell
101-
docker compose -f docker-compose.symfony.yml up -d
102-
```
103-
104-
- Configure your `.env.local` variables to use your local MySQL and Redis services. Replacing `db`, `redis`, `mailer` and `solr` hostnames with `127.0.0.1`. Make sure to use `127.0.0.1` and not `localhost` on *macOS* as it will not work with Docker.
105-
- Remove `docker compose exec -u www-data app ` prefix from all commands in `Makefile` to execute recipes locally.
106-
- Remove cache invalidation Varnish configuration from `config/packages/api_platform.yaml` and `config/packages/roadiz_core.yaml` file.
107-
108-
Then you can start your local webserver:
109-
110-
```shell
111-
symfony serve -d
112-
```
113-
114-
Perform all installation steps described above, without using `docker compose exec` command.
115-
116-
Then your Roadiz backoffice will be available at `https://127.0.0.1:8000/rz-admin`
117-
11888
### Generate [Symfony secrets](https://symfony.com/doc/current/configuration/secrets.html)
11989

12090
When you run `composer create-project` first time, following command should have been executed automatically:

compose.prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,4 @@ networks:
245245
ipam:
246246
driver: default
247247
config:
248-
- subnet: ${DEFAULT_GATEWAY}/16
248+
- subnet: ${DEFAULT_GATEWAY}/24

compose.symfony.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

compose.yml

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: ${APP_NAMESPACE}
22
services:
33
db:
4+
hostname: db
45
build:
56
# Custom image for file permissions
67
context: ./docker/mysql
@@ -9,30 +10,28 @@ services:
910
cap_add:
1011
- SYS_NICE # CAP_SYS_NICE
1112
networks:
12-
default:
13+
- default
1314
volumes:
1415
- "./.data/db:/var/lib/mysql:delegated"
1516
- "./docker/mysql/performances.cnf:/etc/mysql/conf.d/performances.cnf"
1617
environment:
17-
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
18-
MYSQL_DATABASE: ${MYSQL_DATABASE}
19-
MYSQL_USER: ${MYSQL_USER}
20-
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
18+
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
19+
MYSQL_DATABASE: ${MYSQL_DATABASE:-roadiz}
20+
MYSQL_USER: ${MYSQL_USER:-roadiz}
21+
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-roadiz}
2122

2223
pma:
23-
image: phpmyadmin/phpmyadmin
24+
image: phpmyadmin:5.2.1
2425
environment:
25-
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
26-
MYSQL_DATABASE: ${MYSQL_DATABASE}
27-
MYSQL_USER: ${MYSQL_USER}
28-
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
29-
MYSQL_HOST: ${MYSQL_HOST}
30-
MYSQL_PORT: ${MYSQL_PORT}
26+
PMA_HOST: ${MYSQL_HOST:-db}
27+
UPLOAD_LIMIT: 64M
28+
PMA_USER: ${MYSQL_USER:-roadiz}
29+
PMA_PASSWORD: ${MYSQL_PASSWORD:-roadiz}
30+
depends_on:
31+
- db
3132
networks:
32-
frontproxynet:
33-
aliases:
34-
- ${APP_NAMESPACE}_pma
35-
default:
33+
- frontproxynet
34+
- default
3635
labels:
3736
- "traefik.enable=true"
3837
- "traefik.http.services.${APP_NAMESPACE}_pma.loadbalancer.server.scheme=http"
@@ -49,6 +48,8 @@ services:
4948
- "traefik.http.routers.${APP_NAMESPACE}_pma_secure.service=${APP_NAMESPACE}_pma"
5049

5150
app: &app_template
51+
# Nginx does not resolve `app` hostname correctly
52+
hostname: app
5253
# Need to pass all vars to docker env for Crontab and supervisor scripts
5354
#env_file: "./.env.local"
5455
build:
@@ -67,19 +68,11 @@ services:
6768
TRUSTED_PROXIES: ${TRUSTED_PROXIES}
6869
USER_UID: ${USER_UID}
6970
DEFAULT_GATEWAY: ${DEFAULT_GATEWAY}
70-
MYSQL_HOST: ${MYSQL_HOST}
71-
MYSQL_PORT: ${MYSQL_PORT}
72-
APP_ENV: dev
73-
APP_RUNTIME_ENV: dev
74-
APP_DEBUG: 1
7571

7672
nginx:
7773
image: roadiz/nginx-alpine:latest
7874
depends_on:
7975
- app
80-
# Nginx does not resolve `app` hostname correctly
81-
links:
82-
- app:app
8376
volumes:
8477
- ./:/var/www/html:cached
8578
networks:
@@ -111,6 +104,7 @@ services:
111104

112105
worker:
113106
<<: *app_template
107+
hostname: worker
114108
deploy:
115109
# Do not use more than 1 replica if you're using Varnish and need to purge/ban cache
116110
# from your workers. Varnish ACL hostnames won't be resolved correctly.
@@ -120,6 +114,7 @@ services:
120114

121115
cron:
122116
<<: *app_template
117+
hostname: cron
123118
entrypoint: 'docker-cron-entrypoint'
124119
restart: unless-stopped
125120
user: root
@@ -159,12 +154,11 @@ services:
159154
# - "traefik.http.routers.${APP_NAMESPACE}_solr_secure.service=${APP_NAMESPACE}_solr"
160155

161156
mailer:
157+
hostname: mailer
162158
image: axllent/mailpit
163159
networks:
164-
frontproxynet:
165-
aliases:
166-
- ${APP_NAMESPACE}_mailer
167-
default:
160+
- frontproxynet
161+
- default
168162
labels:
169163
- "traefik.enable=true"
170164
- "traefik.http.services.${APP_NAMESPACE}_mailer.loadbalancer.server.scheme=http"
@@ -182,6 +176,7 @@ services:
182176

183177
# Use Redis for Cache, Messaging and Sessions
184178
redis:
179+
hostname: redis
185180
image: redis:7-alpine
186181
networks:
187182
- default
@@ -198,10 +193,8 @@ services:
198193
- cron:cron
199194
- worker:worker
200195
networks:
201-
frontproxynet:
202-
aliases:
203-
- ${APP_NAMESPACE}_varnish
204-
default:
196+
- frontproxynet
197+
- default
205198
environment:
206199
VARNISH_SIZE: ${VARNISH_SIZE}
207200
labels:
@@ -235,7 +228,7 @@ networks:
235228
ipam:
236229
driver: default
237230
config:
238-
- subnet: ${DEFAULT_GATEWAY}/16
231+
- subnet: ${DEFAULT_GATEWAY}/24
239232

240233
volumes:
241234
solr_data:

docker/php-fpm-alpine/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ ENV APP_ENV=dev
77
ENV APP_RUNTIME_ENV=dev
88
ENV APP_DEBUG=1
99
ENV APP_FFMPEG_PATH=/usr/bin/ffmpeg
10-
ENV MYSQL_HOST=db
11-
ENV MYSQL_PORT=3306
1210

1311
HEALTHCHECK --start-period=30s --interval=1m --timeout=6s CMD bin/console monitor:health -q
1412

docker/php-fpm-alpine/docker-php-entrypoint-dev

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,6 @@ echo "APP_ENV=${APP_ENV}";
66
echo "APP_RUNTIME_ENV=${APP_RUNTIME_ENV}";
77
echo "APP_DEBUG=${APP_DEBUG}";
88

9-
#
10-
# Override default entrypoint to add some maintenance DEV only.
11-
# DO NOT CALL THIS SCRIPT FOR WORKERS AND CRON containers (see docker-compose.yml)
12-
#
13-
14-
# Print local env vars to .env.xxx.php file for performances and crontab jobs
15-
/var/www/html/bin/console assets:install -n
16-
/var/www/html/bin/console themes:assets:install -n Rozier --relative --symlink
17-
18-
#
19-
# Wait for database to be ready for next commands and migrations
20-
#
21-
/wait-for-it.sh -t 0 -s ${MYSQL_HOST}:${MYSQL_PORT}
22-
23-
/var/www/html/bin/console cache:clear -n
24-
# Clear all cache pool on Symfony 5.4 https://symfony.com/doc/5.4/cache.html#clearing-the-cache
25-
/var/www/html/bin/console cache:pool:clear cache.global_clearer -n
26-
279
# first arg is `-f` or `--some-option`
2810
if [ "${1#-}" != "$1" ]; then
2911
set -- php-fpm "$@"

docker/solr/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM solr:8-slim
1+
FROM solr:9-slim
22
LABEL org.opencontainers.image.authors="ambroise@rezo-zero.com"
33

44
ARG USER_UID=8983

0 commit comments

Comments
 (0)