Skip to content

Commit 5429e9f

Browse files
authored
Merge pull request #46 from itk-dev/feature/new-stuff-v2
Updated docker setup and stuff
2 parents 14d4f04 + a3ffa93 commit 5429e9f

14 files changed

Lines changed: 93 additions & 56 deletions

.docker/data/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore everything in this directory
2+
*
3+
# Except this file
4+
!.gitignore
5+
!Readme.md

.docker/data/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
Please map persistent volumes to this directory on the servers.
44

55
If a container needs to persist data between restarts you can map the relevant files in the container to ``docker/data/<container-name>`.
6+
67
## RabbitMQ example
78
If you are using RabbitMQ running in a container as a message broker you need to configure a persistent volume for RabbitMQs data directory to avoid losing message on container restarts.
9+
810
```yaml
911
# docker-compose.server.override.yml
12+
1013
services:
1114
rabbit:
1215
image: rabbitmq:3.9-management-alpine

.docker/nginx.conf

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
worker_processes auto;
22

3-
error_log /var/log/nginx/error.log notice;
3+
error_log /dev/stderr notice;
44
pid /tmp/nginx.pid;
55

66
events {
@@ -26,11 +26,9 @@ http {
2626
'$status $body_bytes_sent "$http_referer" '
2727
'"$http_user_agent" "$http_x_forwarded_for"';
2828

29-
access_log /var/log/nginx/access.log main;
29+
access_log /dev/stdout main;
3030

3131
sendfile on;
32-
#tcp_nopush on;
33-
3432
keepalive_timeout 65;
3533

3634
gzip on;
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
server {
2-
listen 8080;
2+
listen ${NGINX_PORT};
33
server_name localhost;
4-
root /app/public;
4+
5+
root ${NGINX_WEB_ROOT};
6+
7+
client_max_body_size ${NGINX_MAX_BODY_SIZE};
58

69
location / {
710
# try to serve file directly, fallback to index.php
811
try_files $uri /index.php$is_args$args;
912
}
1013

14+
# Protect files and directories from prying eyes.
15+
location ~* \.(engine|inc|install|make|module|profile|po|sh|.*sql|.tar|.gz|.bz2|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock)|web\.config)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$ {
16+
deny all;
17+
return 404;
18+
}
19+
1120
location ~ ^/index\.php(/|$) {
1221
fastcgi_buffers 16 32k;
1322
fastcgi_buffer_size 64k;
1423
fastcgi_busy_buffers_size 64k;
1524

16-
fastcgi_pass phpfpm:9000;
25+
fastcgi_pass ${NGINX_FPM_SERVICE};
1726
fastcgi_split_path_info ^(.+\.php)(/.*)$;
1827
include fastcgi_params;
1928

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
- Updated composer setup
11+
- Added new GPU hosts and Hetzner
12+
1013
## [1.6.0] - 2024-01-16
1114

1215
- [#43](https://github.com/itk-dev/devops_itksites/pull/43)

docker-compose.dev.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
1-
# itk-version: 3.1.0
2-
version: "3"
3-
1+
# itk-version: 3.2.1
42
services:
53
phpfpm:
64
environment:
7-
- PHP_SENDMAIL_PATH=/usr/local/bin/mhsendmail --smtp-addr="mailhog:1025"
5+
- PHP_SENDMAIL_PATH=/usr/sbin/sendmail -S mail:1025
86

97
nginx:
108
labels:
119
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.middlewares=ITKBasicAuth@file"
1210

13-
mailhog:
14-
image: itkdev/mailhog
11+
mail:
12+
image: axllent/mailpit
1513
restart: unless-stopped
1614
networks:
1715
- app
1816
- frontend
1917
labels:
2018
- "traefik.enable=true"
2119
- "traefik.docker.network=frontend"
22-
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}-http.rule=Host(`mailhog.${COMPOSE_SERVER_DOMAIN}`)"
23-
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}-http.entrypoints=web"
24-
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}-http.middlewares=redirect-to-https"
20+
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}-http.rule=Host(`mail.${COMPOSE_SERVER_DOMAIN}`)"
21+
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}-http.entrypoints=web"
22+
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}-http.middlewares=redirect-to-https"
2523
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
26-
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}.rule=Host(`mailhog.${COMPOSE_SERVER_DOMAIN}`)"
27-
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}.entrypoints=websecure"
28-
- "traefik.http.services.mailhog_${COMPOSE_PROJECT_NAME}.loadbalancer.server.port=8025"
29-
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}.middlewares=ITKMailhogAuth@file"
24+
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}.rule=Host(`mail.${COMPOSE_SERVER_DOMAIN}`)"
25+
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}.entrypoints=websecure"
26+
- "traefik.http.services.mail_${COMPOSE_PROJECT_NAME}.loadbalancer.server.port=8025"
27+
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}.middlewares=ITKMailhogAuth@file"

docker-compose.override.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
services:
2+
rabbit:
3+
image: rabbitmq:3.13-management
4+
networks:
5+
- app
6+
- frontend
7+
ports:
8+
- "15672"
9+
environment:
10+
- RABBITMQ_DEFAULT_USER=user
11+
- RABBITMQ_DEFAULT_PASS=password
12+
- RABBITMQ_ERLANG_COOKIE='d53f219cd9376f8f440aaf9889f315ab'
13+
14+
node:
15+
image: node:20
16+
volumes:
17+
- .:/app:delegated
18+
working_dir: /app

docker-compose.redirect.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# itk-version: 3.1.0
2-
version: "3"
3-
1+
# itk-version: 3.2.1
42
services:
53
nginx:
64
labels:

docker-compose.server.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# itk-version: 3.1.0
2-
version: "3"
3-
1+
# itk-version: 3.2.1
42
networks:
53
frontend:
64
external: true
@@ -10,7 +8,7 @@ networks:
108

119
services:
1210
phpfpm:
13-
image: itkdev/php8.1-fpm:alpine
11+
image: itkdev/php8.2-fpm:alpine
1412
restart: unless-stopped
1513
networks:
1614
- app
@@ -31,12 +29,15 @@ services:
3129
- frontend
3230
depends_on:
3331
- phpfpm
34-
ports:
35-
- '8080'
3632
volumes:
37-
- ./.docker/vhost.conf:/etc/nginx/conf.d/default.conf:ro
33+
- ./.docker/templates:/etc/nginx/templates:ro
3834
- ./.docker/nginx.conf:/etc/nginx/nginx.conf:ro
39-
- ./:/app:rw
35+
- .:/app
36+
environment:
37+
NGINX_FPM_SERVICE: ${COMPOSE_PROJECT_NAME}-phpfpm-1:9000
38+
NGINX_WEB_ROOT: /app/public
39+
NGINX_PORT: 8080
40+
NGINX_MAX_BODY_SIZE: 5M
4041
labels:
4142
- "traefik.enable=true"
4243
- "traefik.docker.network=frontend"

docker-compose.yml

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# itk-version: 3.1.0
2-
version: "3"
3-
1+
# itk-version: 3.2.1
42
networks:
53
frontend:
64
external: true
@@ -21,11 +19,9 @@ services:
2119
- MYSQL_PASSWORD=db
2220
- MYSQL_DATABASE=db
2321
#- ENCRYPT=1 # Uncomment to enable database encryption.
24-
labels:
25-
com.symfony.server.service-prefix: 'DATABASE'
2622

2723
phpfpm:
28-
image: itkdev/php8.1-fpm:latest
24+
image: itkdev/php8.2-fpm:latest
2925
networks:
3026
- app
3127
extra_hosts:
@@ -34,8 +30,8 @@ services:
3430
- PHP_XDEBUG_MODE=${PHP_XDEBUG_MODE:-off}
3531
- PHP_MAX_EXECUTION_TIME=30
3632
- PHP_MEMORY_LIMIT=256M
37-
# Uncomment below to enable mailhog.
38-
# - PHP_SENDMAIL_PATH=/usr/local/bin/mhsendmail --smtp-addr="mailhog:1025"
33+
# Depending on the setup, you may have to remove --read-envelope-from from msmtp (cf. https://marlam.de/msmtp/msmtp.html) or use SMTP to send mail
34+
- PHP_SENDMAIL_PATH=/usr/bin/msmtp --host=mail --port=1025 --read-recipients --read-envelope-from
3935
- DOCKER_HOST_DOMAIN=${COMPOSE_DOMAIN}
4036
- COMPOSER_VERSION=2
4137
- PHP_IDE_CONFIG=serverName=localhost
@@ -54,30 +50,31 @@ services:
5450
ports:
5551
- '8080'
5652
volumes:
57-
- ./.docker/vhost.conf:/etc/nginx/conf.d/default.conf:ro
53+
- ./.docker/templates:/etc/nginx/templates:ro
5854
- .:/app
55+
environment:
56+
NGINX_FPM_SERVICE: ${COMPOSE_PROJECT_NAME}-phpfpm-1:9000
57+
NGINX_WEB_ROOT: /app/public
58+
NGINX_PORT: 8080
59+
NGINX_MAX_BODY_SIZE: 5M
5960
labels:
6061
- "traefik.enable=true"
6162
- "traefik.docker.network=frontend"
6263
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host(`${COMPOSE_DOMAIN}`)"
63-
# HTTPS config - uncomment to enable redirect from :80 to :443
64-
# - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.middlewares=redirect-to-https"
65-
# - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
64+
# HTTPS config - uncomment to enable redirect from :80 to :443
65+
# - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.middlewares=redirect-to-https"
66+
# - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
6667

67-
rabbit:
68-
image: rabbitmq:3.11-management
68+
mail:
69+
image: axllent/mailpit
6970
networks:
7071
- app
7172
- frontend
7273
ports:
73-
- "15672"
74-
environment:
75-
- RABBITMQ_DEFAULT_USER=user
76-
- RABBITMQ_DEFAULT_PASS=password
77-
- RABBITMQ_ERLANG_COOKIE='d53f219cd9376f8f440aaf9889f315ab'
78-
79-
node:
80-
image: node:18
81-
volumes:
82-
- .:/app:delegated
83-
working_dir: /app
74+
- "1025"
75+
- "8025"
76+
labels:
77+
- "traefik.enable=true"
78+
- "traefik.docker.network=frontend"
79+
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}mail.rule=Host(`mail-${COMPOSE_DOMAIN}`)"
80+
- "traefik.http.services.${COMPOSE_PROJECT_NAME}mail.loadbalancer.server.port=8025"

0 commit comments

Comments
 (0)