tests - refactoring on the road, still needs some work
This commit is contained in:
parent
8fb03a3171
commit
87c57c67c7
|
@ -74,7 +74,8 @@ class Config(ApiCaller, ConfigCaller) :
|
|||
server_names = []
|
||||
for service in self.__services :
|
||||
first_server = service["SERVER_NAME"].split(" ")[0]
|
||||
server_names.append(first_server)
|
||||
if not first_server in server_names :
|
||||
server_names.append(first_server)
|
||||
for variable, value in service.items() :
|
||||
config[first_server + "_" + variable] = value
|
||||
config["SERVER_NAME"] = " ".join(server_names)
|
||||
|
|
|
@ -23,10 +23,10 @@ services:
|
|||
- MAGENTO_DATABASE_PASSWORD=db-user-pwd # replace with a stronger password (must match MYSQL_PASSWORD)
|
||||
- ELASTICSEARCH_HOST=myelasticsearch
|
||||
labels:
|
||||
- SERVER_NAME=www.example.com
|
||||
- USE_REVERSE_PROXY=yes
|
||||
- REVERSE_PROXY_URL=/
|
||||
- REVERSE_PROXY_HOST=http://mymagento:8080
|
||||
- bunkerweb.SERVER_NAME=www.example.com
|
||||
- bunkerweb.USE_REVERSE_PROXY=yes
|
||||
- bunkerweb.REVERSE_PROXY_URL=/
|
||||
- bunkerweb.REVERSE_PROXY_HOST=http://mymagento:8080
|
||||
|
||||
myelasticsearch:
|
||||
image: bitnami/elasticsearch:7
|
||||
|
@ -56,4 +56,4 @@ services:
|
|||
networks:
|
||||
bw-services:
|
||||
external:
|
||||
name: bw-services
|
||||
name: bw-services
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
|
||||
myredmine:
|
||||
image: redmine
|
||||
restart: always
|
||||
volumes:
|
||||
- ./redmine-data:/usr/src/redmine/files
|
||||
networks:
|
||||
bw-services:
|
||||
aliases:
|
||||
- myredmine
|
||||
environment:
|
||||
- REDMINE_DB_MYSQL=mydb
|
||||
- REDMINE_DB_DATABASE=redminedb
|
||||
- REDMINE_DB_USERNAME=user
|
||||
- REDMINE_DB_PASSWORD=db-user-pwd # replace with a stronger password (must match MYSQL_PASSWORD)
|
||||
labels:
|
||||
- bunkerweb.SERVER_NAME=www.example.com
|
||||
- bunkerweb.USE_REVERSE_PROXY=yes
|
||||
- bunkerweb.REVERSE_PROXY_URL=/
|
||||
- bunkerweb.REVERSE_PROXY_HOST=http://myredmine:3000
|
||||
|
||||
mydb:
|
||||
image: mysql
|
||||
volumes:
|
||||
- ./db-data:/var/lib/mysql
|
||||
networks:
|
||||
bw-services:
|
||||
aliases:
|
||||
- mydb
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=db-root-pwd # replace with a stronger password
|
||||
- MYSQL_DATABASE=redminedb
|
||||
- MYSQL_USER=user
|
||||
- MYSQL_PASSWORD=db-user-pwd # replace with a stronger password (must match REDMINE_DB_PASSWORD)
|
||||
|
||||
networks:
|
||||
bw-services:
|
||||
external:
|
||||
name: bw-services
|
|
@ -5,5 +5,4 @@ if [ $(id -u) -ne 0 ] ; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
chown -R root:101 bw-data
|
||||
chmod -R 770 bw-data
|
||||
helm delete redmine
|
|
@ -0,0 +1,18 @@
|
|||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: ingress
|
||||
annotations:
|
||||
bunkerweb.io/AUTO_LETS_ENCRYPT: "yes"
|
||||
spec:
|
||||
rules:
|
||||
- host: www.example.com
|
||||
http:
|
||||
paths:
|
||||
path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: redmine
|
||||
port:
|
||||
number: 80
|
|
@ -0,0 +1,4 @@
|
|||
redmineUsername: "user"
|
||||
redminePassword: "changeme42"
|
||||
redmineEmail: "user@example.com"
|
||||
redmineLanguage: "en"
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ $(id -u) -ne 0 ] ; then
|
||||
echo "❌ Run me as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||
helm install -f redmine-chart-values.yml redmine bitnami/redmine
|
|
@ -0,0 +1,50 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
|
||||
myredmine:
|
||||
image: redmine
|
||||
restart: always
|
||||
volumes:
|
||||
- redmine_data:/usr/src/redmine/files
|
||||
networks:
|
||||
- bw-services
|
||||
environment:
|
||||
- REDMINE_DB_MYSQL=mydb
|
||||
- REDMINE_DB_DATABASE=redminedb
|
||||
- REDMINE_DB_USERNAME=user
|
||||
- REDMINE_DB_PASSWORD=db-user-pwd # replace with a stronger password (must match MYSQL_PASSWORD)
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
- "node.role==worker"
|
||||
labels:
|
||||
- bunkerweb.SERVER_NAME=www.example.com
|
||||
- bunkerweb.USE_REVERSE_PROXY=yes
|
||||
- bunkerweb.REVERSE_PROXY_URL=/
|
||||
- bunkerweb.REVERSE_PROXY_HOST=http://myredmine:3000
|
||||
|
||||
mydb:
|
||||
image: mysql
|
||||
volumes:
|
||||
- db_data:/var/lib/mysql
|
||||
networks:
|
||||
- bw-services
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=db-root-pwd # replace with a stronger password
|
||||
- MYSQL_DATABASE=redminedb
|
||||
- MYSQL_USER=user
|
||||
- MYSQL_PASSWORD=db-user-pwd # replace with a stronger password (must match REDMINE_DB_PASSWORD)
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
- "node.role==worker"
|
||||
|
||||
networks:
|
||||
bw-services:
|
||||
external:
|
||||
name: bw-services
|
||||
|
||||
volumes:
|
||||
redmine_data:
|
||||
db_data:
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "redmine",
|
||||
"kinds": [
|
||||
"docker",
|
||||
"autoconf",
|
||||
"swarm",
|
||||
"kubernetes"
|
||||
],
|
||||
"timeout": 60,
|
||||
"tests": [
|
||||
{
|
||||
"type": "string",
|
||||
"url": "https://www.example.com",
|
||||
"string": "redmine"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
|
||||
app1:
|
||||
image: tutum/hello-world
|
||||
networks:
|
||||
bw-services:
|
||||
aliases:
|
||||
- app1
|
||||
labels:
|
||||
- bunkerweb.SERVER_NAME=app1.example.com
|
||||
- bunkerweb.USE_REVERSE_PROXY=yes
|
||||
- bunkerweb.REVERSE_PROXY_URL=/
|
||||
- bunkerweb.REVERSE_PROXY_HOST=http://app1
|
||||
|
||||
app2:
|
||||
image: tutum/hello-world
|
||||
networks:
|
||||
bw-services:
|
||||
aliases:
|
||||
- app2
|
||||
labels:
|
||||
- bunkerweb.SERVER_NAME=app2.example.com
|
||||
- bunkerweb.USE_REVERSE_PROXY=yes
|
||||
- bunkerweb.REVERSE_PROXY_URL=/
|
||||
- bunkerweb.REVERSE_PROXY_HOST=http://app2
|
||||
|
||||
networks:
|
||||
bw-services:
|
||||
external:
|
||||
name: bw-services
|
|
@ -33,13 +33,7 @@ services:
|
|||
- net_app2
|
||||
|
||||
app1:
|
||||
image: node
|
||||
working_dir: /home/node/app
|
||||
volumes:
|
||||
- ./js-app:/home/node/app
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
command: bash -c "npm install express && node index.js"
|
||||
image: tutum/hello-world
|
||||
networks:
|
||||
- net_app1
|
||||
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
const express = require('express')
|
||||
const app = express()
|
||||
const port = 3000
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.send('Hello World from app1!')
|
||||
})
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Example app listening at http://localhost:${port}`)
|
||||
})
|
||||
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"name": "js-app",
|
||||
"version": "1.0.0",
|
||||
"description": "demo",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"express": "^4.17.1"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: ingress
|
||||
annotations:
|
||||
bunkerweb.io/AUTO_LETS_ENCRYPT: "yes"
|
||||
spec:
|
||||
rules:
|
||||
- host: app1.example.com
|
||||
http:
|
||||
paths:
|
||||
path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: svc-app1
|
||||
port:
|
||||
number: 80
|
||||
- host: app2.example.com
|
||||
http:
|
||||
paths:
|
||||
path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: svc-app2
|
||||
port:
|
||||
number: 80
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: app1
|
||||
labels:
|
||||
app: app1
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: app1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: app1
|
||||
spec:
|
||||
containers:
|
||||
- name: app1
|
||||
image: tutum/hello-world
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: svc-app1
|
||||
spec:
|
||||
selector:
|
||||
app: app1
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 80
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: app2
|
||||
labels:
|
||||
app: app2
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: app2
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: app2
|
||||
spec:
|
||||
containers:
|
||||
- name: app2
|
||||
image: tutum/hello-world
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: svc-app2
|
||||
spec:
|
||||
selector:
|
||||
app: app2
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 80
|
|
@ -0,0 +1,36 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
|
||||
app1:
|
||||
image: tutum/hello-world
|
||||
networks:
|
||||
- bw-services
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
- "node.role==worker"
|
||||
labels:
|
||||
- bunkerweb.SERVER_NAME=app1.example.com
|
||||
- bunkerweb.USE_REVERSE_PROXY=yes
|
||||
- bunkerweb.REVERSE_PROXY_URL=/
|
||||
- bunkerweb.REVERSE_PROXY_HOST=http://app1
|
||||
|
||||
app2:
|
||||
image: tutum/hello-world
|
||||
networks:
|
||||
- bw-services
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
- "node.role==worker"
|
||||
labels:
|
||||
- bunkerweb.SERVER_NAME=app2.example.com
|
||||
- bunkerweb.USE_REVERSE_PROXY=yes
|
||||
- bunkerweb.REVERSE_PROXY_URL=/
|
||||
- bunkerweb.REVERSE_PROXY_HOST=http://app2
|
||||
|
||||
networks:
|
||||
bw-services:
|
||||
external:
|
||||
name: bw-services
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "reverse-proxy-multisite",
|
||||
"kinds": [
|
||||
"docker",
|
||||
"autoconf",
|
||||
"swarm",
|
||||
"kubernetes"
|
||||
],
|
||||
"timeout": 60,
|
||||
"tests": [
|
||||
{
|
||||
"type": "string",
|
||||
"url": "https://app1.example.com",
|
||||
"string": "hello"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"url": "https://app2.example.com",
|
||||
"string": "hello"
|
||||
},
|
||||
]
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
|
||||
app1:
|
||||
image: tutum/hello-world
|
||||
networks:
|
||||
bw-services:
|
||||
aliases:
|
||||
- app1
|
||||
labels:
|
||||
- bunkerweb.SERVER_NAME=www.example.com
|
||||
- bunkerweb.USE_REVERSE_PROXY=yes
|
||||
- bunkerweb.REVERSE_PROXY_URL_1=~ ^/app1/(.+)$$
|
||||
- bunkerweb.REVERSE_PROXY_HOST_1=http://app1/$$1
|
||||
|
||||
app2:
|
||||
image: tutum/hello-world
|
||||
networks:
|
||||
bw-services:
|
||||
aliases:
|
||||
- app2
|
||||
labels:
|
||||
- bunkerweb.SERVER_NAME=www.example.com
|
||||
- bunkerweb.USE_REVERSE_PROXY=yes
|
||||
- bunkerweb.REVERSE_PROXY_URL_2=~ ^/app2/(.+)$$
|
||||
- bunkerweb.REVERSE_PROXY_HOST_2=http://app2/$$1
|
||||
|
||||
networks:
|
||||
bw-services:
|
||||
external:
|
||||
name: bw-services
|
|
@ -23,19 +23,13 @@ services:
|
|||
- USE_CLIENT_CACHE=yes
|
||||
- USE_GZIP=yes
|
||||
- USE_REVERSE_PROXY=yes
|
||||
- REVERSE_PROXY_URL_1=/app1/
|
||||
- REVERSE_PROXY_HOST_1=http://app1:3000/
|
||||
- REVERSE_PROXY_URL_2=/app2/
|
||||
- REVERSE_PROXY_HOST_2=http://app2/
|
||||
- REVERSE_PROXY_URL_1=~ ^/app1/(.+)$$
|
||||
- REVERSE_PROXY_HOST_1=http://app1/$$1
|
||||
- REVERSE_PROXY_URL_2=~ ^/app2/(.+)$$
|
||||
- REVERSE_PROXY_HOST_2=http://app2/$$1
|
||||
|
||||
app1:
|
||||
image: node
|
||||
working_dir: /home/node/app
|
||||
volumes:
|
||||
- ./js-app:/home/node/app
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
command: bash -c "npm install express && node index.js"
|
||||
image: tutum/hello-world
|
||||
|
||||
app2:
|
||||
image: tutum/hello-world
|
|
@ -1,13 +0,0 @@
|
|||
const express = require('express')
|
||||
const app = express()
|
||||
const port = 3000
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.send('Hello from app1 !')
|
||||
})
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Example app listening at http://localhost:${port}`)
|
||||
})
|
||||
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"name": "js-app",
|
||||
"version": "1.0.0",
|
||||
"description": "demo",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"express": "^4.17.1"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# docker-compose doesn't support assigning labels to configs
|
||||
# so we need to create the configs with the CLI
|
||||
# bunkerweb.CONFIG_TYPE accepted values are http, stream, server-http, server-stream, default-server-http, modsec and modsec-crs
|
||||
# bunkerweb.CONFIG_SITE lets you choose on which web service the config should be applied (MULTISITE mode) and if it's not set, the config will be applied for all services
|
||||
# more info at https://docs.bunkerweb.io
|
||||
|
||||
# remove configs if existing
|
||||
docker config rm cfg_reverse_server_http
|
||||
|
||||
# create configs
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=server-http cfg_reverse_server_http -l bunkerweb.CONFIG_SITE=www.example.com ./bw-data/configs/server-http/redirects.conf
|
|
@ -0,0 +1,36 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
|
||||
app1:
|
||||
image: tutum/hello-world
|
||||
networks:
|
||||
- bw-services
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
- "node.role==worker"
|
||||
labels:
|
||||
- bunkerweb.SERVER_NAME=www.example.com
|
||||
- bunkerweb.USE_REVERSE_PROXY=yes
|
||||
- bunkerweb.REVERSE_PROXY_URL_1=~ ^/app1/(.+)$$
|
||||
- bunkerweb.REVERSE_PROXY_HOST_1=http://app1/$$1
|
||||
|
||||
app2:
|
||||
image: tutum/hello-world
|
||||
networks:
|
||||
- bw-services
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
- "node.role==worker"
|
||||
labels:
|
||||
- bunkerweb.SERVER_NAME=www.example.com
|
||||
- bunkerweb.USE_REVERSE_PROXY=yes
|
||||
- bunkerweb.REVERSE_PROXY_URL_2=~ ^/app2/(.+)$$
|
||||
- bunkerweb.REVERSE_PROXY_HOST_2=http://app2/$$1
|
||||
|
||||
networks:
|
||||
bw-services:
|
||||
external:
|
||||
name: bw-services
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "reverse-proxy-singlesite",
|
||||
"kinds": [
|
||||
"docker",
|
||||
"autoconf",
|
||||
"swarm"
|
||||
],
|
||||
"timeout": 60,
|
||||
"tests": [
|
||||
{
|
||||
"type": "string",
|
||||
"url": "https://www.example.com/app1",
|
||||
"string": "hello"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"url": "https://www.example.com/app2",
|
||||
"string": "hello"
|
||||
},
|
||||
]
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "reverse-proxy-websocket",
|
||||
"kinds": [
|
||||
"docker"
|
||||
],
|
||||
"timeout": 60,
|
||||
"tests": [
|
||||
{
|
||||
"type": "string-ws",
|
||||
"url": "https://www.example.com/app1",
|
||||
"string": "hello"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"url": "https://www.example.com/app2",
|
||||
"string": "hello"
|
||||
},
|
||||
]
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"name": "swarm-configs",
|
||||
"kinds": [
|
||||
"swarm"
|
||||
],
|
||||
"timeout": 120,
|
||||
"tests": [
|
||||
{
|
||||
"type": "string",
|
||||
"url": "https://app1.example.com/app1",
|
||||
"string": "app1"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"url": "https://app2.example.com/app2",
|
||||
"string": "app2"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"url": "https://app3.example.com/app3",
|
||||
"string": "app3"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"url": "https://app1.example.com/hello",
|
||||
"string": "hello"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"url": "https://app2.example.com/hello",
|
||||
"string": "hello"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"url": "https://app3.example.com/hello",
|
||||
"string": "hello"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
version: "3"
|
||||
|
||||
services:
|
||||
|
||||
myapp1:
|
||||
image: tutum/hello-world
|
||||
networks:
|
||||
- bw-services
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
- "node.role==worker"
|
||||
labels:
|
||||
- "bunkerweb.SERVER_NAME=app1.example.com"
|
||||
- "bunkerweb.USE_REVERSE_PROXY=yes"
|
||||
- "bunkerweb.REVERSE_PROXY_URL=/"
|
||||
- "bunkerweb.REVERSE_PROXY_HOST=http://myapp1"
|
||||
|
||||
myapp2:
|
||||
image: tutum/hello-world
|
||||
networks:
|
||||
- bw-services
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
- "node.role==worker"
|
||||
labels:
|
||||
- "bunkerweb.SERVER_NAME=app2.example.com"
|
||||
- "bunkerweb.USE_REVERSE_PROXY=yes"
|
||||
- "bunkerweb.REVERSE_PROXY_URL=/"
|
||||
- "bunkerweb.REVERSE_PROXY_HOST=http://myapp2"
|
||||
|
||||
myapp3:
|
||||
image: tutum/hello-world
|
||||
networks:
|
||||
- bw-services
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
- "node.role==worker"
|
||||
labels:
|
||||
- "bunkerweb.SERVER_NAME=app3.example.com"
|
||||
- "bunkerweb.USE_REVERSE_PROXY=yes"
|
||||
- "bunkerweb.REVERSE_PROXY_URL=/"
|
||||
- "bunkerweb.REVERSE_PROXY_HOST=http://myapp3"
|
||||
|
||||
networks:
|
||||
bw-services:
|
||||
external:
|
||||
name: bw-services
|
|
@ -0,0 +1,22 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
|
||||
mytomcat:
|
||||
image: tomcat
|
||||
volumes:
|
||||
- ./app:/usr/local/tomcat/webapps/ # folder containing war files
|
||||
networks:
|
||||
bw-services:
|
||||
aliases:
|
||||
- mytomcat
|
||||
labels:
|
||||
- bunkerweb.SERVER_NAME=www.example.com
|
||||
- bunkerweb.USE_REVERSE_PROXY=yes
|
||||
- bunkerweb.REVERSE_PROXY_URL=/
|
||||
- bunkerweb.REVERSE_PROXY_HOST=http://mytomcat:8080/sample/
|
||||
|
||||
networks:
|
||||
bw-services:
|
||||
external:
|
||||
name: bw-services
|
|
@ -0,0 +1,32 @@
|
|||
version: '3.3'
|
||||
|
||||
services:
|
||||
|
||||
mytomcat:
|
||||
image: tomcat
|
||||
configs:
|
||||
- source: tomcat_app_war
|
||||
target: /usr/local/tomcat/webapps/sample.war
|
||||
uid: "0"
|
||||
gid: "0"
|
||||
mode: 0444
|
||||
networks:
|
||||
- bw-services
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
- "node.role==worker"
|
||||
labels:
|
||||
- bunkerweb.SERVER_NAME=www.example.com
|
||||
- bunkerweb.USE_REVERSE_PROXY=yes
|
||||
- bunkerweb.REVERSE_PROXY_URL=/
|
||||
- bunkerweb.REVERSE_PROXY_HOST=http://mytomcat:8080/sample/
|
||||
|
||||
networks:
|
||||
bw-services:
|
||||
external:
|
||||
name: bw-services
|
||||
|
||||
configs:
|
||||
tomcat_app_war:
|
||||
file: ./app/sample.war
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "tomcat",
|
||||
"kinds": [
|
||||
"docker",
|
||||
"autoconf",
|
||||
"swarm"
|
||||
],
|
||||
"timeout": 60,
|
||||
"tests": [
|
||||
{
|
||||
"type": "string",
|
||||
"url": "https://www.example.com",
|
||||
"string": "tomcat"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
|
||||
mywp:
|
||||
image: wordpress:5-apache
|
||||
volumes:
|
||||
- ./wp-data:/var/www/html
|
||||
networks:
|
||||
bw-services:
|
||||
aliases:
|
||||
- mywp
|
||||
environment:
|
||||
- WORDPRESS_DB_HOST=mydb
|
||||
- WORDPRESS_DB_NAME=wp
|
||||
- WORDPRESS_DB_USER=user
|
||||
- WORDPRESS_DB_PASSWORD=db-user-pwd # replace with a stronger password (must match MYSQL_PASSWORD)
|
||||
- WORDPRESS_TABLE_PREFIX=prefix_ # best practice : replace with a random prefix
|
||||
labels:
|
||||
- bunkerweb.SERVER_NAME=www.example.com
|
||||
- bunkerweb.MAX_CLIENT_SIZE=50m
|
||||
- bunkerweb.USE_REVERSE_PROXY=yes
|
||||
- bunkerweb.REVERSE_PROXY_URL=/
|
||||
- bunkerweb.REVERSE_PROXY_HOST=http://mywp
|
||||
|
||||
mydb:
|
||||
image: mariadb
|
||||
volumes:
|
||||
- ./db-data:/var/lib/mysql
|
||||
networks:
|
||||
bw-services:
|
||||
aliases:
|
||||
- mydb
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=db-root-pwd # replace with a stronger password
|
||||
- MYSQL_DATABASE=wp
|
||||
- MYSQL_USER=user
|
||||
- MYSQL_PASSWORD=db-user-pwd # replace with a stronger password (must match WORDPRESS_DB_PASSWORD)
|
||||
|
||||
networks:
|
||||
bw-services:
|
||||
external:
|
||||
name: bw-services
|
|
@ -5,5 +5,4 @@ if [ $(id -u) -ne 0 ] ; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
chown -R root:101 bw-data
|
||||
chmod -R 770 bw-data
|
||||
helm delete wordpress
|
|
@ -0,0 +1,19 @@
|
|||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: ingress
|
||||
annotations:
|
||||
bunkerweb.io/AUTO_LETS_ENCRYPT: "yes"
|
||||
bunkerweb.io/www.example.com_MAX_CLIENT_SIZE: "50m"
|
||||
spec:
|
||||
rules:
|
||||
- host: www.example.com
|
||||
http:
|
||||
paths:
|
||||
path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: wordpress
|
||||
port:
|
||||
number: 80
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ $(id -u) -ne 0 ] ; then
|
||||
echo "❌ Run me as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
helm repo add wordpress https://charts.bitnami.com/bitnami
|
||||
helm install -f wordpress-chart-values.yml wordpress bitnami/wordpress
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# docker-compose doesn't support assigning labels to configs
|
||||
# so we need to create the configs with the CLI
|
||||
# bunkerweb.CONFIG_TYPE accepted values are http, stream, server-http, server-stream, default-server-http, modsec and modsec-crs
|
||||
# bunkerweb.CONFIG_SITE lets you choose on which web service the config should be applied (MULTISITE mode) and if it's not set, the config will be applied for all services
|
||||
# more info at https://docs.bunkerweb.io
|
||||
|
||||
# remove configs if existing
|
||||
docker config rm cfg_wordpress_modsec_crs
|
||||
|
||||
# create configs
|
||||
docker config create -l bunkerweb.CONFIG_TYPE=modsec-crs cfg_wordpress_modsec_crs -l bunkerweb.CONFIG_SITE=www.example.com ./bw-data/configs/modsec-crs/wordpress.conf
|
|
@ -0,0 +1,51 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
|
||||
mywp:
|
||||
image: wordpress:5-apache
|
||||
volumes:
|
||||
- wp_data:/var/www/html
|
||||
networks:
|
||||
- bw-services
|
||||
environment:
|
||||
- WORDPRESS_DB_HOST=mydb
|
||||
- WORDPRESS_DB_NAME=wp
|
||||
- WORDPRESS_DB_USER=user
|
||||
- WORDPRESS_DB_PASSWORD=db-user-pwd # replace with a stronger password (must match MYSQL_PASSWORD)
|
||||
- WORDPRESS_TABLE_PREFIX=prefix_ # best practice : replace with a random prefix
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
- "node.role==worker"
|
||||
labels:
|
||||
- bunkerweb.SERVER_NAME=www.example.com
|
||||
- bunkerweb.MAX_CLIENT_SIZE=50m
|
||||
- bunkerweb.USE_REVERSE_PROXY=yes
|
||||
- bunkerweb.REVERSE_PROXY_URL=/
|
||||
- bunkerweb.REVERSE_PROXY_HOST=http://mywp
|
||||
|
||||
mydb:
|
||||
image: mariadb
|
||||
volumes:
|
||||
- db_data:/var/lib/mysql
|
||||
networks:
|
||||
- bw-services
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=db-root-pwd # replace with a stronger password
|
||||
- MYSQL_DATABASE=wp
|
||||
- MYSQL_USER=user
|
||||
- MYSQL_PASSWORD=db-user-pwd # replace with a stronger password (must match WORDPRESS_DB_PASSWORD)
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
- "node.role==worker"
|
||||
|
||||
networks:
|
||||
bw-services:
|
||||
external:
|
||||
name: bw-services
|
||||
|
||||
volumes:
|
||||
wp_data:
|
||||
db_data:
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "tomcat",
|
||||
"kinds": [
|
||||
"docker",
|
||||
"autoconf",
|
||||
"swarm",
|
||||
"kubernetes"
|
||||
],
|
||||
"timeout": 60,
|
||||
"tests": [
|
||||
{
|
||||
"type": "string",
|
||||
"url": "https://www.example.com",
|
||||
"string": "wordpress"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
wordpressUsername: "user"
|
||||
wordpressPassword: "changeme42"
|
||||
wordpressEmail: "user@example.com"
|
||||
wordpressFirstName: "FirstName"
|
||||
wordpressLastName: "LastName"
|
||||
wordpressBlogName: "User's Blog!"
|
||||
wordpressTablePrefix: "changeme_"
|
||||
wordpressScheme: "https"
|
Loading…
Reference in New Issue