Skip to content

Commit f178458

Browse files
committed
examples
1 parent a3457be commit f178458

19 files changed

+768
-9
lines changed

examples/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
All examples for [WSC (WoltLab Suite Core)](https://www.woltlab.com/en/woltlab-suite-download/)!
44

5-
* fpm-nginx-dhi: php-fpm, nginx, mysql, traefik, prometheus-exporters - only using DHI (Docker Hardened Images) - for more Details/Help read README.md in folder!
6-
* fpm-nginx-dhi-k8s: fpm-nginx-dhi for Kubernetes/K8s (tested on K3s)
7-
* fpm-nginx: like fpm-nginx-dhi, but offical docker community images and other (Notice: mysql replaced by mariadb)
8-
* fpm-nginx-aio: like fpm-nginx, but php-fpm and nginx in single container/image
9-
* apache: apache2 and php in single container/image, mariadb, traefik, prometheus-exporters
5+
* fpm-nginx-dhi: php-fpm, nginx, mysql, traefik, prometheus-exporters without entrypoint script - only using DHI (Docker Hardened Images) - for more Details/Help read README.md in folder!
6+
* fpm-nginx-dhi-k8s: like fpm-nginx-dhi but for Kubernetes/K8s (tested on K3s) - for more Details/Help read README.md in folder!
7+
* fpm-nginx-doi: like fpm-nginx-dhi, but Docker Offical Images (DOI, from Community) and also without entrypoint script.
8+
* fpm-nginx: like fpm-nginx-doi, but Docker Offical Images with entrypoint script from this repo. (Notice: mysql replaced by mariadb)
9+
* fpm-nginx-aio: like fpm-nginx, but php-fpm and nginx in single container/image with entrypoint script from this repo.
10+
* apache: apache2 and php in single container/image, mariadb, traefik, prometheus-exporters with entrypoint script from this repo.

examples/apache/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# PHP - Examples: [PHP & Apache2] & MariaDB (using DOI)
2+
3+
> PHP & Apache2
4+
> ... with entrypoint Script from this repo!

examples/fpm-nginx-aio/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# PHP - Examples: [PHP-FPM & NGINX] as AIO & MariaDB (using DOI)
2+
3+
> PHP-FPM & NGINX in single Container as All-In-One (AIO)
4+
> ... with entrypoint Script from this repo!

examples/fpm-nginx-aio/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ services:
22

33
# https://github.com/Tob1as/docker-php
44
# based on: https://hub.docker.com/_/php (https://github.com/docker-library/php)
5-
# command: mkdir ./html && chown 33:33 ./html
5+
# command: mkdir ./html && chown 82:82 ./html
66
wsc-php:
77
image: docker.io/tobi312/php:8.4-fpm-nginx-alpine-wsc
88
container_name: wsc-php
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# General
2+
DOMAIN=example.com
3+
TIMEZONE=Europe/Berlin
4+
# Database (MySQL/MariaDB)
5+
MYSQL_ROOT_PASSWORD=my-secret-pw
6+
MYSQL_DATABASE=woltlab_suite
7+
MYSQL_USER=woltlab_suite
8+
MYSQL_PASSWORD=my-secret-pw
9+
# Exporter
10+
MYSQL_EXPORTER_USER=exporter
11+
MYSQL_EXPORTER_PASSWORD=my-secret-pw

examples/fpm-nginx-doi/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# PHP - Examples: PHP-FPM & NGINX & MariaDB (using DOI)
2+
3+
> ... without entrypoint Script from this repo!
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# SOURCE: https://github.com/Tob1as/docker-kubernetes-collection/blob/master/examples_docker-compose/config_mariadb/20_exporter-user.sh
5+
6+
: "${EXPORTER_USER:="exporter"}"
7+
: "${EXPORTER_PASSWORD:="Exp0rt3r!"}"
8+
: "${EXPORTER_MAXUSERCONNECTIONS:="3"}"
9+
host='%' # set '%' to allow from all host
10+
11+
mariadb -h localhost -u root --password="${MARIADB_ROOT_PASSWORD}" -sNe \
12+
"SELECT user FROM mysql.user WHERE user = '${EXPORTER_USER}' GROUP BY user;" \
13+
| grep -q ${EXPORTER_USER}} \
14+
|| mariadb -h localhost -u root --password="${MARIADB_ROOT_PASSWORD}" -sN <<EOSQL
15+
CREATE USER '${EXPORTER_USER}'@'${host}' IDENTIFIED BY '${EXPORTER_PASSWORD}' WITH MAX_USER_CONNECTIONS ${EXPORTER_MAXUSERCONNECTIONS};
16+
GRANT PROCESS, REPLICATION CLIENT, SELECT, SLAVE MONITOR ON *.* TO '${EXPORTER_USER}'@'${host}';
17+
GRANT SELECT ON performance_schema.* TO '${EXPORTER_USER}'@'${host}';
18+
FLUSH PRIVILEGES;
19+
EOSQL
20+
21+
mariadb -h localhost -u root --password=${MARIADB_ROOT_PASSWORD} -e "SELECT user, host, max_user_connections FROM mysql.user;"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[server]
2+
innodb_buffer_pool_size = 512M
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# enable ONLY behind PROXY (Traefik, other NGINX, Caddy, lighttpd, K8s Ingress, ...) (ngx_http_realip_module)
2+
set_real_ip_from 172.16.0.0/12;
3+
set_real_ip_from fd00::/8;
4+
real_ip_header X-Forwarded-For;
5+
#real_ip_recursive on;
6+
7+
# Server (http)
8+
server {
9+
listen 8080;
10+
listen [::]:8080;
11+
server_name _;
12+
13+
# disable any limits to avoid HTTP 413 for large image uploads
14+
client_max_body_size 0;
15+
16+
# Error Page
17+
location @error_page {
18+
add_header Content-Type text/plain;
19+
return 200 'Maintenance mode!';
20+
}
21+
22+
root /var/www/html;
23+
index index.php index.html test.php;
24+
25+
location / {
26+
#root /var/www/html;
27+
#index index.php index.html;
28+
29+
try_files $uri $uri/ /index.php?$query_string;
30+
}
31+
32+
location ~ \.php$ {
33+
#root /var/www/html;
34+
35+
try_files $uri =404;
36+
37+
fastcgi_pass wsc-php:9000;
38+
fastcgi_index index.php;
39+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
40+
include fastcgi_params;
41+
42+
# Error Page (redirect)
43+
error_page 502 503 504 = @error_page;
44+
}
45+
46+
# nginx status
47+
location = /nginx_status {
48+
stub_status on;
49+
access_log off;
50+
allow 127.0.0.1;
51+
allow 10.0.0.0/8;
52+
allow 172.16.0.0/12;
53+
allow 192.168.0.0/16;
54+
allow ::1;
55+
allow fd00::/8;
56+
deny all;
57+
}
58+
59+
# nginx ping
60+
location = /nginx_ping {
61+
add_header Content-Type text/plain;
62+
return 200 'pong';
63+
access_log off;
64+
allow 127.0.0.1;
65+
allow 10.0.0.0/8;
66+
allow 172.16.0.0/12;
67+
allow 192.168.0.0/16;
68+
allow ::1;
69+
allow fd00::/8;
70+
deny all;
71+
}
72+
73+
# php-fpm status/ping
74+
location ~ ^/(php_fpm_status|php_fpm_ping)$ {
75+
fastcgi_pass wsc-php:9001;
76+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
77+
include fastcgi_params;
78+
access_log off;
79+
allow 127.0.0.1;
80+
allow 10.0.0.0/8;
81+
allow 172.16.0.0/12;
82+
allow 192.168.0.0/16;
83+
allow ::1;
84+
allow fd00::/8;
85+
deny all;
86+
87+
# Error Page (redirect)
88+
error_page 502 503 504 = @error_page;
89+
}
90+
91+
location ~ /\.ht {
92+
deny all;
93+
}
94+
#location = /favicon.ico { log_not_found off; access_log off; }
95+
#location = /robots.txt { log_not_found off; access_log off; }
96+
}

0 commit comments

Comments
 (0)