Skip to content

Commit c463389

Browse files
committed
examples dhi
add dhi traefik
1 parent 38a9612 commit c463389

11 files changed

Lines changed: 571 additions & 9 deletions

File tree

examples/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
# PHP - Examples
2+
3+
All examples for WSC!
4+
5+
* apache
6+
* fpm-nginx-dhi
7+
* ...

examples/fpm-nginx-dhi/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# General
22
DOMAIN=example.com
3+
TIMEZONE=Europe/Berlin
34
# Database (MySQL/MariaDB)
45
MYSQL_ROOT_PASSWORD=my-secret-pw
56
MYSQL_DATABASE=woltlab_suite

examples/fpm-nginx-dhi/README.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ This example docker-compose setup for [WSC (WoltLab Suite Core)](https://www.wol
99
* [NGINX Image](https://dhi.io/catalog/nginx) from DHI
1010
* [MySQL Image](https://dhi.io/catalog/mysql) from DHI
1111
* optional Exporter Images from DHI: [MySQL/MariaDB](https://dhi.io/catalog/mysqld-exporter) and [NGINX](https://dhi.io/catalog/nginx-exporter)
12+
* [Traefik Image](https://dhi.io/catalog/traefik) from DHI
1213

1314

1415
Notes:
15-
* In this setup [Traefik](https://traefik.io/traefik) is use as Proxy, a example can find here [https://github.com/Tob1as/docker-kubernetes-collection](https://github.com/Tob1as/docker-kubernetes-collection/blob/master/examples_docker-compose/traefik_v3.yml).
16+
* In this setup [Traefik](https://traefik.io/traefik) is use as Proxy.
1617
If you don't want to use it, make adjustments in the NGINX configuration file in "config" folder.
1718
* **Important: To pull Images from DHI you must login with your docker account.**
1819
* (Sourcecode from DH-Images can found here [https://github.com/docker-hardened-images](https://github.com/docker-hardened-images/catalog/tree/main/image).)
1920
* DHI images (mostly) have no shell and no entrypoint.
20-
* Images build for AMD64 (x86_64) and ARM64.
21+
* Images build for AMD64 (x86_64) and ARM64 with Linux.
2122

2223
## Steps
2324
1. Important: Login to dhi.io (`docker login dhi.io`) and optional to docker.io (`docker login`) on your server, if not already done.
@@ -29,21 +30,39 @@ If you don't want to use it, make adjustments in the NGINX configuration file in
2930
4. create some subfolder:
3031
* `mkdir ./html && chown 65532:65532 ./html`
3132
* `mkdir ./data-db && chown 65532:65532 ./data-db`
32-
5. Start the container setup with:
33+
5. Configure Traefik, set your domains in `./config/traefik/dynamic/traefik-dashboard.yml` and `./config/traefik/dynamic/wsc.yml` or remove `Host(*) &&`. Also in `traefik-dashboard.yml`change basicAuth user and password. Additionally, create SSL certificates contains domain name(s) and set the path within the container in `./config/traefik/dynamic/ssl.yml` or use [Let's Encrypt](https://doc.traefik.io/traefik/reference/install-configuration/tls/certificate-resolvers/acme/).
34+
* example command for replace domain in dynamic configs:
35+
```sh
36+
find ./config/traefik/dynamic -type f -exec sed -i 's/example.com/mydomain.com/g' {} +
37+
```
38+
* example for self sign cert:
39+
create folder:
40+
```sh
41+
mkdir ./ssl-certs
42+
```
43+
create cert (change domain name):
44+
```sh
45+
openssl req -x509 -newkey rsa:4096 -sha256 -days 365 -nodes -subj "/C=DE/ST=none/L=Town/O=Linux Community/CN=example.com" -keyout ./ssl-certs/ssl.key -out ./ssl-certs/ssl.crt -addext "subjectAltName=DNS:example.com,DNS:*.example.com" -addext "basicConstraints=CA:FALSE" -addext "keyUsage=digitalSignature,keyEncipherment" -addext "extendedKeyUsage=serverAuth"
46+
```
47+
Check:
48+
```sh
49+
openssl x509 -text -noout -in ./ssl-certs/ssl.crt
50+
```
51+
6. Start the container setup with:
3352
`docker compose up -d`
34-
6. Create MySQL Databse and User:
53+
7. Create MySQL Databse and User:
3554
```sh
3655
# create database
3756
docker exec -it wsc-mysql bash -c 'mysql -uroot -e "CREATE DATABASE ${MYSQL_DATABASE};"'
3857
# create user and set permissions
3958
docker exec -it wsc-mysql bash -c 'mysql -uroot -e "CREATE USER \"${MYSQL_USER}\"@\"%\" IDENTIFIED BY \"${MYSQL_PASSWORD}\"; GRANT ALL PRIVILEGES ON ${MYSQL_DATABASE}.* TO \"${MYSQL_USER}\"@\"%\";"'
4059
```
41-
7. [Download WSC](https://www.woltlab.com/en/woltlab-suite-download/) and unzip archive and copy all files from "upload" folder in "html" folder on your server.
42-
8. Call your domain and file test.php, example: `http://example.com/test.php`
43-
9. Now follows the installation setup of the WSC.
60+
8. [Download WSC](https://www.woltlab.com/en/woltlab-suite-download/) and unzip archive and copy all files from "upload" folder in "html" folder on your server.
61+
9. Call your domain and file test.php, example: `http://example.com/test.php`
62+
10. Now follows the installation setup of the WSC.
4463
Manual/Help: https://manual.woltlab.com/en/installation/
4564
(Notice: Database Host is `wsc-db`!)
46-
10. Installation complete.
65+
11. Installation complete.
4766

4867
If necessary, make further configurations for nginx or php in the files in the "config" folder.
4968

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# https://github.com/traefik/traefik/issues/9945#issuecomment-1590229681
2+
# https://doc.traefik.io/traefik/reference/routing-configuration/http/tls/tls-certificates/#strict-sni-checking
3+
# https://www.ssllabs.com/ssltest/
4+
tls:
5+
options:
6+
default:
7+
sniStrict: true # <----- Strict SNI Checking
8+
# minVersion: VersionTLS12
9+
# cipherSuites:
10+
# - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 # TLS 1.2
11+
# - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 # TLS 1.2
12+
# - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 # TLS 1.2
13+
# - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 # TLS 1.2
14+
# - TLS_AES_256_GCM_SHA384 # TLS 1.3
15+
# - TLS_CHACHA20_POLY1305_SHA256 # TLS 1.3
16+
# - TLS_FALLBACK_SCSV # TLS FALLBACK
17+
# curvePreferences:
18+
# - secp521r1
19+
# - secp384r1
20+
#modern:
21+
# minVersion: VersionTLS13
Lines changed: 275 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,275 @@
1+
# https://plugins.traefik.io/plugins/62947302108ecc83915d7781/geoblock
2+
3+
http:
4+
middlewares:
5+
geoblock:
6+
plugin:
7+
geoblock:
8+
# Enable this plugin?
9+
enabled: true
10+
# Path to ip2location database file
11+
databaseFilePath: /plugins-storage/sources/gop-***/src/github.com/nscuro/traefik-plugin-geoblock/IP2LOCATION-LITE-DB1.IPV6.BIN
12+
# Whitelist of countries to allow (ISO 3166-1 alpha-2)
13+
#allowedCountries: [ "AT", "BE", "BG", "CH", "CY", "CZ", "DE", "DK", "EE", "ES", "FI", "FR", "GR", "HR", "HU", "IE", "IT", "LT", "LU", "LV", "MT", "NL", "PL", "PT", "RO" ,"SE", "SI", "SK" ]
14+
allowedCountries:
15+
- AD # Andorra
16+
#- AE # United Arab Emirates
17+
#- AF # Afghanistan
18+
#- AG # Antigua and Barbuda
19+
#- AI # Anguilla
20+
#- AL # Albania
21+
#- AM # Armenia
22+
#- AO # Angola
23+
#- AQ # Antarctica
24+
#- AR # Argentina
25+
#- AS # American Samoa
26+
- AT # Austria
27+
#- AU # Australia
28+
#- AW # Aruba
29+
#- AX # Åland Islands
30+
#- AZ # Azerbaijan
31+
#- BA # Bosnia and Herzegovina
32+
#- BB # Barbados
33+
#- BD # Bangladesh
34+
- BE # Belgium
35+
#- BF # Burkina Faso
36+
- BG # Bulgaria
37+
#- BH # Bahrain
38+
#- BI # Burundi
39+
#- BJ # Benin
40+
#- BL # Saint Barthélemy
41+
#- BM # Bermuda
42+
#- BN # Brunei
43+
#- BO # Bolivia
44+
#- BQ # Bonaire, Sint Eustatius, and Saba
45+
#- BR # Brazil
46+
#- BS # The Bahamas
47+
#- BT # Bhutan
48+
#- BV # Bouvet Island
49+
#- BW # Botswana
50+
#- BY # Belarus
51+
#- BZ # Belize
52+
#- CA # Canada
53+
#- CC # Cocos (Keeling) Islands
54+
#- CD # Democratic Republic of the Congo
55+
#- CF # Central African Republic
56+
#- CG # Republic of the Congo
57+
- CH # Switzerland
58+
#- CI # Ivory Coast
59+
#- CK # Cook Islands
60+
#- CL # Chile
61+
#- CM # Cameroon
62+
#- CN # China
63+
#- CO # Colombia
64+
#- CR # Costa Rica
65+
#- CU # Cuba
66+
#- CV # Cape Verde
67+
#- CW # Curaçao
68+
#- CX # Christmas Island
69+
#- CY # Cyprus
70+
- CZ # Czech Republic
71+
- DE # Germany
72+
#- DJ # Djibouti
73+
- DK # Denmark
74+
#- DM # Dominica
75+
#- DO # Dominican Republic
76+
#- DZ # Algeria
77+
#- EC # Ecuador
78+
- EE # Estonia
79+
#- EG # Egypt
80+
#- EH # Western Sahara
81+
#- ER # Eritrea
82+
- ES # Spain
83+
#- ET # Ethiopia
84+
- FI # Finland
85+
#- FJ # Fiji
86+
#- FK # Falkland Islands
87+
#- FM # Federated States of Micronesia
88+
#- FO # Faroe Islands
89+
- FR # France
90+
#- GA # Gabon
91+
- GB # United Kingdom
92+
#- GD # Grenada
93+
#- GE # Georgia
94+
#- GF # French Guiana
95+
#- GG # Guernsey
96+
#- GH # Ghana
97+
#- GI # Gibraltar
98+
#- GL # Greenland
99+
#- GM # The Gambia
100+
#- GN # Guinea
101+
#- GP # Guadeloupe
102+
#- GQ # Equatorial Guinea
103+
- GR # Greece
104+
#- GS # South Georgia and the South Sandwich Islands
105+
#- GT # Guatemala
106+
#- GU # Guam
107+
#- GW # Guinea-Bissau
108+
#- GY # Guyana
109+
#- HK # Hong Kong
110+
#- HM # Heard Island and McDonald Islands
111+
#- HN # Honduras
112+
- HR # Croatia
113+
#- HT # Haiti
114+
- HU # Hungary
115+
#- ID # Indonesia
116+
- IE # Ireland
117+
#- IL # Israel
118+
#- IM # Isle of Man
119+
#- IN # India
120+
#- IO # British Indian Ocean Territory
121+
#- IQ # Iraq
122+
#- IR # Iran
123+
- IS # Iceland
124+
- IT # Italy
125+
#- JE # Jersey
126+
#- JM # Jamaica
127+
#- JO # Jordan
128+
#- JP # Japan
129+
#- KE # Kenya
130+
#- KG # Kyrgyzstan
131+
#- KH # Cambodia
132+
#- KI # Kiribati
133+
#- KM # Comoros
134+
#- KN # Saint Kitts and Nevis
135+
#- KP # North Korea
136+
#- KR # South Korea
137+
#- KW # Kuwait
138+
#- KY # Cayman Islands
139+
#- KZ # Kazakhstan
140+
#- LA # Laos
141+
#- LB # Lebanon
142+
#- LC # Saint Lucia
143+
- LI # Liechtenstein
144+
#- LK # Sri Lanka
145+
#- LR # Liberia
146+
#- LS # Lesotho
147+
- LT # Lithuania
148+
- LU # Luxembourg
149+
- LV # Latvia
150+
#- LY # Libya
151+
#- MA # Morocco
152+
- MC # Monaco
153+
#- MD # Moldova
154+
#- ME # Montenegro
155+
#- MF # Saint Martin
156+
#- MG # Madagascar
157+
#- MH # Marshall Islands
158+
#- MK # North Macedonia
159+
#- ML # Mali
160+
#- MM # Myanmar
161+
#- MN # Mongolia
162+
#- MO # Macau
163+
#- MP # Northern Mariana Islands
164+
#- MQ # Martinique
165+
#- MR # Mauritania
166+
#- MS # Montserrat
167+
- MT # Malta
168+
#- MU # Mauritius
169+
#- MV # Maldives
170+
#- MW # Malawi
171+
#- MX # Mexico
172+
#- MY # Malaysia
173+
#- MZ # Mozambique
174+
#- NA # Namibia
175+
#- NC # New Caledonia
176+
#- NE # Niger
177+
#- NF # Norfolk Island
178+
#- NG # Nigeria
179+
#- NI # Nicaragua
180+
- NL # Netherlands
181+
- NO # Norway
182+
#- NP # Nepal
183+
#- NR # Nauru
184+
#- NU # Niue
185+
#- NZ # New Zealand
186+
#- OM # Oman
187+
#- PA # Panama
188+
#- PE # Peru
189+
#- PF # French Polynesia
190+
#- PG # Papua New Guinea
191+
#- PH # Philippines
192+
#- PK # Pakistan
193+
- PL # Poland
194+
#- PM # Saint Pierre and Miquelon
195+
#- PN # Pitcairn Islands
196+
#- PR # Puerto Rico
197+
#- PS # State of Palestine
198+
- PT # Portugal
199+
#- PW # Palau
200+
#- PY # Paraguay
201+
#- QA # Qatar
202+
#- RE # Réunion
203+
- RO # Romania
204+
#- RS # Serbia
205+
#- RU # Russia
206+
#- RW # Rwanda
207+
#- SA # Saudi Arabia
208+
#- SB # Solomon Islands
209+
#- SC # Seychelles
210+
#- SD # Sudan
211+
- SE # Sweden
212+
#- SG # Singapore
213+
#- SH # Saint Helena
214+
- SI # Slovenia
215+
#- SJ # Svalbard and Jan Mayen
216+
- SK # Slovakia
217+
#- SL # Sierra Leone
218+
#- SM # San Marino
219+
#- SN # Senegal
220+
#- SO # Somalia
221+
#- SR # Suriname
222+
#- SS # South Sudan
223+
#- ST # São Tomé and Príncipe
224+
#- SV # El Salvador
225+
#- SX # Sint Maarten
226+
#- SY # Syria
227+
#- SZ # Eswatini
228+
#- TC # Turks and Caicos Islands
229+
#- TD # Chad
230+
#- TF # French Southern and Antarctic Lands
231+
#- TG # Togo
232+
#- TH # Thailand
233+
#- TJ # Tajikistan
234+
#- TK # Tokelau
235+
#- TL # Timor-Leste
236+
#- TM # Turkmenistan
237+
#- TN # Tunisia
238+
#- TO # Tonga
239+
- TR # Turkey
240+
#- TT # Trinidad and Tobago
241+
#- TV # Tuvalu
242+
#- TW # Taiwan
243+
#- TZ # Tanzania
244+
- UA # Ukraine
245+
#- UG # Uganda
246+
#- UM # United States Minor Outlying Islands
247+
- US # United States # need for Let's Encrypt ?
248+
#- UY # Uruguay
249+
#- UZ # Uzbekistan
250+
#- VA # Vatican City
251+
#- VC # Saint Vincent and the Grenadines
252+
#- VE # Venezuela
253+
#- VG # British Virgin Islands
254+
#- VI # United States Virgin Islands
255+
#- VN # Vietnam
256+
#- VU # Vanuatu
257+
#- WF # Wallis and Futuna
258+
#- WS # Samoa
259+
#- YE # Yemen
260+
#- YT # Mayotte
261+
#- ZA # South Africa
262+
#- ZM # Zambia
263+
#- ZW # Zimbabwe
264+
# Blocklist of countries to block (ISO 3166-1 alpha-2)
265+
#blockedCountries: [ "RU", "CN", "KP" ]
266+
# Default allow indicates that if an IP is in neither block list nor allow lists, it should be allowed.
267+
defaultAllow: false
268+
# Allow requests from private / internal networks?
269+
allowPrivate: true
270+
# HTTP status code to return for disallowed requests (default: 403)
271+
disallowedStatusCode: 403
272+
# Add CIDR to be whitelisted, even if in a non-allowed country
273+
#allowedIPBlocks: ["66.249.64.0/19"]
274+
# Add CIDR to be blacklisted, even if in an allowed country or IP block
275+
#blockedIPBlocks: ["66.249.64.5/32"]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
http:
2+
middlewares:
3+
redirect-to-https:
4+
redirectScheme:
5+
scheme: https
6+
permanent: true

0 commit comments

Comments
 (0)