continue examples refactoring

This commit is contained in:
florian 2023-03-16 17:43:47 +01:00
parent 5d214497ba
commit 89812362a1
24 changed files with 101 additions and 137 deletions

View File

@ -13,7 +13,7 @@ services:
# another example for existing folder : chown -R root:101 folder && chmod -R 770 folder
# more info at https://docs.bunkerweb.io
volumes:
- ./bw-data:/data # contains web files (PHP, assets, ...)
- ./www/var/www/html # contains web files (PHP, assets, ...)
environment:
- SERVER_NAME=www.example.com # replace with your domain
- API_WHITELIST_IP=127.0.0.0/8 10.20.30.0/24
@ -35,30 +35,30 @@ services:
depends_on:
- mybunker
environment:
- DOCKER_HOST=tcp://docker-proxy:2375
- DOCKER_HOST=tcp://bw-docker-proxy:2375
volumes:
- ./bw-data:/data
- bw-data:/data
networks:
- bw-universe
- net-docker
- bw-docker
docker-proxy:
bw-docker-proxy:
image: tecnativa/docker-socket-proxy:0.1
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CONTAINERS=1
networks:
- net-docker
- bw-docker
myphp:
image: php:fpm-alpine3.17
# ⚠️ UID and GID of bunkerweb (101:101) and php:fpm-alpine3.17 (82:82) are not the same ⚠️
# ⚠️ UID and GID of BunkerWeb (101:101) and php:fpm (33:33) are not the same ⚠️
# but both needs access to the files and folders of web-files
# don't forget to edit the permissions of the files and folders accordingly
# example : chown -R 82:101 ./bw-data/www && find ./bw-data/www -type f -exec chmod 0640 {} \; && find ./bw-data/www -type d -exec chmod 0750 {} \;
# example : chown -R 33:101 ./www && find ./www -type f -exec chmod 0640 {} \; && find ./www -type d -exec chmod 0750 {} \;
volumes:
- ./bw-data/www:/app # folder containing PHP app
- ./www:/app # folder containing PHP app
networks:
- bw-services
@ -69,4 +69,4 @@ networks:
config:
- subnet: 10.20.30.0/24
bw-services:
net-docker:
bw-docker:

View File

@ -5,8 +5,6 @@ if [ $(id -u) -ne 0 ] ; then
exit 1
fi
chown -R root:101 bw-data
chmod -R 770 bw-data
chown -R 82:101 ./bw-data/www
find ./bw-data/www -type f -exec chmod 0640 {} \;
find ./bw-data/www -type d -exec chmod 0750 {} \;
chown -R 33:101 ./www
find ./www -type f -exec chmod 0640 {} \;
find ./www -type d -exec chmod 0750 {} \;

View File

@ -14,9 +14,7 @@ else
exit 1
fi
chown -R root:101 bw-data
chmod -R 770 bw-data
cp -r ./bw-data/www/* /var/www/html
cp -r ./www/* /var/www/html
chown -R $user:nginx /var/www/html
find /var/www/html -type f -exec chmod 0640 {} \;
find /var/www/html -type d -exec chmod 0750 {} \;

View File

@ -2,13 +2,13 @@ version: "3"
services:
myapp1:
image: php:fpm-alpine3.17
# ⚠️ UID and GID of mywww (101:101) and php:fpm-alpine3.17 (82:82) are not the same ⚠️
image: php:fpm
# ⚠️ UID and GID of BunkerWeb (101:101) and php:fpm (33:33) are not the same ⚠️
# but both needs access to the files and folders of web-files
# don't forget to edit the permissions of the files and folders accordingly
# example : chown -R 82:101 ./bw-data/www && find ./bw-data/www -type f -exec chmod 0640 {} \; && find ./bw-data/www -type d -exec chmod 0750 {} \;
# example : chown -R 33:101 ./www && find ./www -type f -exec chmod 0640 {} \; && find ./www -type d -exec chmod 0750 {} \;
volumes:
- ./bw-data/www/app1.example.com:/app # folder containing PHP app1 (don't forget to rename it)
- ./www/app1.example.com:/app # folder containing PHP app1 (don't forget to rename it)
networks:
bw-services:
aliases:
@ -19,13 +19,13 @@ services:
- bunkerweb.REMOTE_PHP_PATH=/app
myapp2:
image: php:fpm-alpine3.17
# ⚠️ UID and GID of bunkerweb (101:101) and php:fpm-alpine3.17 (82:82) are not the same ⚠️
image: php:fpm
# ⚠️ UID and GID of BunkerWeb (101:101) and php:fpm (33:33) are not the same ⚠️
# but both needs access to the files and folders of web-files
# don't forget to edit the permissions of the files and folders accordingly
# example : chown -R 82:101 ./bw-data/www && find ./bw-data/www -type f -exec chmod 0640 {} \; && find ./bw-data/www -type d -exec chmod 0750 {} \;
# example : chown -R 33:101 ./www && find ./www -type f -exec chmod 0640 {} \; && find ./www -type d -exec chmod 0750 {} \;
volumes:
- ./bw-data/www/app2.example.com:/app # folder containing PHP app2 (don't forget to rename it)
- ./www/app2.example.com:/app # folder containing PHP app2 (don't forget to rename it)
networks:
bw-services:
aliases:

View File

@ -13,7 +13,7 @@ services:
# another example for existing folder : chown -R root:101 folder && chmod -R 770 folder
# more info at https://docs.bunkerweb.io
volumes:
- ./bw-data:/data # contains web files (PHP, assets, ...), don't forget to rename the subfolders
- ./www:/var/www/html # contains web files (PHP, assets, ...), don't forget to rename the subfolders
environment:
- SERVER_NAME=app1.example.com app2.example.com # replace with your domains
- API_WHITELIST_IP=127.0.0.0/8 10.20.30.0/24
@ -38,41 +38,41 @@ services:
depends_on:
- mybunker
environment:
- DOCKER_HOST=tcp://docker-proxy:2375
- DOCKER_HOST=tcp://bw-docker-proxy:2375
volumes:
- ./bw-data:/data
networks:
- bw-universe
- net-docker
- bw-docker
docker-proxy:
bw-docker-proxy:
image: tecnativa/docker-socket-proxy:0.1
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CONTAINERS=1
networks:
- net-docker
- bw-docker
myapp1:
image: php:fpm-alpine3.17
# ⚠️ UID and GID of mywww (101:101) and php:fpm-alpine3.17 (82:82) are not the same ⚠️
image: php:fpm
# ⚠️ UID and GID of BunkerWeb (101:101) and php:fpm (33:33) are not the same ⚠️
# but both needs access to the files and folders of web-files
# don't forget to edit the permissions of the files and folders accordingly
# example : chown -R 82:101 ./bw-data/www && find ./bw-data/www -type f -exec chmod 0640 {} \; && find ./bw-data/www -type d -exec chmod 0750 {} \;
# example : chown -R 33:101 ./www && find ./www -type f -exec chmod 0640 {} \; && find ./www -type d -exec chmod 0750 {} \;
volumes:
- ./bw-data/www/app1.example.com:/app # folder containing PHP app1 (don't forget to rename it)
- ./www/app1.example.com:/app # folder containing PHP app1 (don't forget to rename it)
networks:
- net-app1
myapp2:
image: php:fpm-alpine3.17
# ⚠️ UID and GID of bunkerweb (101:101) and php:fpm-alpine3.17 (82:82) are not the same ⚠️
image: php:fpm
# ⚠️ UID and GID of BunkerWeb (101:101) and php:fpm (33:33) are not the same ⚠️
# but both needs access to the files and folders of web-files
# don't forget to edit the permissions of the files and folders accordingly
# example : chown -R 82:101 ./bw-data/www && find ./bw-data/www -type f -exec chmod 0640 {} \; && find ./bw-data/www -type d -exec chmod 0750 {} \;
# example : chown -R 33:101 ./www && find ./www -type f -exec chmod 0640 {} \; && find ./www -type d -exec chmod 0750 {} \;
volumes:
- ./bw-data/www/app2.example.com:/app # folder containing PHP app2 (don't forget to rename it)
- ./www/app2.example.com:/app # folder containing PHP app2 (don't forget to rename it)
networks:
- net-app2
@ -82,6 +82,6 @@ networks:
driver: default
config:
- subnet: 10.20.30.0/24
net-docker:
bw-docker:
net-app1:
net-app2:

View File

@ -5,8 +5,6 @@ if [ $(id -u) -ne 0 ] ; then
exit 1
fi
chown -R root:101 bw-data
chmod -R 770 bw-data
chown -R 82:101 ./bw-data/www
find ./bw-data/www -type f -exec chmod 0640 {} \;
find ./bw-data/www -type d -exec chmod 0750 {} \;
chown -R 33:101 ./www
find ./www -type f -exec chmod 0640 {} \;
find ./www -type d -exec chmod 0750 {} \;

View File

@ -5,8 +5,6 @@ if [ $(id -u) -ne 0 ] ; then
exit 1
fi
chown -R root:101 bw-data
chmod -R 770 bw-data
chown -R 82:101 ./bw-data/www
find ./bw-data/www -type f -exec chmod 0640 {} \;
find ./bw-data/www -type d -exec chmod 0750 {} \;
chown -R 33:101 ./www
find ./www -type f -exec chmod 0640 {} \;
find ./www -type d -exec chmod 0750 {} \;

View File

@ -14,9 +14,7 @@ else
exit 1
fi
chown -R root:101 bw-data
chmod -R 770 bw-data
cp -r ./bw-data/www/* /var/www/html
cp -r ./www/* /var/www/html
chown -R $user:nginx /var/www/html
find /var/www/html -type f -exec chmod 0640 {} \;
find /var/www/html -type d -exec chmod 0750 {} \;

View File

@ -13,7 +13,7 @@ services:
# another example for existing folder : chown -R root:101 folder && chmod -R 770 folder
# more info at https://docs.bunkerweb.io
volumes:
- ./bw-data:/data # contains web files (PHP, assets, ...)
- ./www:/var/www/html # contains web files (PHP, assets, ...)
environment:
- SERVER_NAME=www.example.com # replace with your domain
- API_WHITELIST_IP=127.0.0.0/8 10.20.30.0/24
@ -34,30 +34,30 @@ services:
depends_on:
- mybunker
environment:
- DOCKER_HOST=tcp://docker-proxy:2375
- DOCKER_HOST=tcp://bw-docker-proxy:2375
volumes:
- ./bw-data:/data
networks:
- bw-universe
- net-docker
- bw-docker
docker-proxy:
bw-docker-proxy:
image: tecnativa/docker-socket-proxy:0.1
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CONTAINERS=1
networks:
- net-docker
- bw-docker
myphp:
image: php:fpm-alpine3.17
# ⚠️ UID and GID of bunkerweb (101:101) and php:fpm-alpine3.17 (82:82) are not the same ⚠️
image: php:fpm
# ⚠️ UID and GID of BunkerWeb (101:101) and php:fpm (33:33) are not the same ⚠️
# but both needs access to the files and folders of web-files
# don't forget to edit the permissions of the files and folders accordingly
# example : chown -R 82:101 ./bw-data/www && find ./bw-data/www -type f -exec chmod 0640 {} \; && find ./bw-data/www -type d -exec chmod 0750 {} \;
# example : chown -R 33:101 ./www && find ./www -type f -exec chmod 0640 {} \; && find ./www -type d -exec chmod 0750 {} \;
volumes:
- ./bw-data/www:/app # folder containing PHP app
- ./www:/app # folder containing PHP app
networks:
- bw-services

View File

@ -5,8 +5,6 @@ if [ $(id -u) -ne 0 ] ; then
exit 1
fi
chown -R root:101 bw-data
chmod -R 770 bw-data
chown -R 82:101 ./bw-data/www
find ./bw-data/www -type f -exec chmod 0640 {} \;
find ./bw-data/www -type d -exec chmod 0750 {} \;
chown -R 33:101 ./www
find ./www -type f -exec chmod 0640 {} \;
find ./www -type d -exec chmod 0750 {} \;

View File

@ -14,9 +14,7 @@ else
exit 1
fi
chown -R root:101 bw-data
chmod -R 770 bw-data
cp -r ./bw-data/www/* /var/www/html
cp -r ./www/* /var/www/html
chown -R $user:nginx /var/www/html
find /var/www/html -type f -exec chmod 0640 {} \;
find /var/www/html -type d -exec chmod 0750 {} \;

View File

@ -4,7 +4,7 @@ services:
myps:
image: prestashop/prestashop:1.7
volumes:
- ./ps-data:/var/www/html
- ps-data:/var/www/html
networks:
bw-services:
aliases:
@ -31,7 +31,7 @@ services:
mydb:
image: mariadb
volumes:
- ./db-data:/var/lib/mysql
- db-data:/var/lib/mysql
networks:
bw-services:
aliases:
@ -46,3 +46,7 @@ networks:
bw-services:
external:
name: bw-services
volumes:
ps-data:
db-data:

View File

@ -1,24 +1,12 @@
version: "3"
x-bunkerweb-env: &bunkerweb-env
DATABASE_URI: "mariadb+pymysql://${PRESTASHOP_USER:-user}:${PRESTASHOP_PASSWORD:-secret}@mydb:3306/${BUNKERWEB_DATABASE:-bunkerweb}"
services:
mybunker:
image: bunkerity/bunkerweb:1.5.0
ports:
- 80:8080
- 443:8443
# ⚠️ read this if you use local folders for volumes ⚠️
# bunkerweb runs as an unprivileged user with UID/GID 101
# don't forget to edit the permissions of the files and folders accordingly
# example if you need to create a directory : mkdir folder && chown root:101 folder && chmod 770 folder
# another example for existing folder : chown -R root:101 folder && chmod -R 770 folder
# more info at https://docs.bunkerweb.io
volumes:
- bw-data:/data
environment:
<<: *bunkerweb-env
SERVER_NAME: "www.example.com" # replace with your domain
API_WHITELIST_IP: "127.0.0.0/8 10.20.30.0/24"
SERVE_FILES: "no"
@ -44,33 +32,32 @@ services:
depends_on:
- mybunker
environment:
<<: *bunkerweb-env
DOCKER_HOST: "tcp://docker-proxy:2375"
DOCKER_HOST: "tcp://bw-docker-proxy:2375"
volumes:
- bw-data:/data
networks:
- bw-universe
- net-docker
- bw-docker
docker-proxy:
bw-docker-proxy:
image: tecnativa/docker-socket-proxy:0.1
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CONTAINERS=1
networks:
- net-docker
- bw-docker
myps:
image: prestashop/prestashop:1.7
volumes:
- ./ps-data:/var/www/html
- ps-data:/var/www/html
environment:
- DB_SERVER=mydb
- DB_USER=${PRESTASHOP_USER:-user}
- DB_PASSWD=${PRESTASHOP_PASSWORD:-secret} # set a stronger password in a .env file (must match MYSQL_PASSWORD)
- DB_USER=user
- DB_PASSWD=db-user-pwd # replace with a stronger password (must match MYSQL_PASSWORD)
- DB_PREFIX=prefix_ # replace with a random prefix (good security practice)
- DB_NAME=${PRESTASHOP_DATABASE:-prestashop}
- DB_NAME=prestashop
- PS_ENABLE_SSL=1
- ADMIN_MAIL=admin@example.com # change to the prestashop admin email
- ADMIN_PASSWD=changeme # change to the prestashop admin password
@ -78,19 +65,22 @@ services:
networks:
- bw-services
mydb:
image: mariadb:10.10
image: mariadb
volumes:
- db-data:/var/lib/mysql
environment:
MARIADB_RANDOM_ROOT_PASSWORD: "yes"
entrypoint: sh -c "echo 'DROP USER IF EXISTS \"${PRESTASHOP_USER:-user}\"; CREATE USER \"${PRESTASHOP_USER:-user}\"@\"%\"; CREATE DATABASE IF NOT EXISTS ${PRESTASHOP_DATABASE:-prestashop}; CREATE DATABASE IF NOT EXISTS ${BUNKERWEB_DATABASE:-bunkerweb}; GRANT ALL PRIVILEGES ON ${PRESTASHOP_DATABASE:-prestashop}.* TO \"${PRESTASHOP_USER:-user}\"@\"%\" IDENTIFIED BY \"${PRESTASHOP_PASSWORD:-secret}\"; GRANT ALL PRIVILEGES ON ${BUNKERWEB_DATABASE:-bunkerweb}.* TO \"${PRESTASHOP_USER:-user}\"@\"%\" IDENTIFIED BY \"${PRESTASHOP_PASSWORD:-secret}\"; FLUSH PRIVILEGES;' > /docker-entrypoint-initdb.d/init.sql; /usr/local/bin/docker-entrypoint.sh --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci"
networks:
- bw-universe
- bw-services
bw-services:
aliases:
- mydb
environment:
- MYSQL_ROOT_PASSWORD=db-root-pwd # replace with a stronger password
- MYSQL_DATABASE=prestashop
- MYSQL_USER=user
- MYSQL_PASSWORD=db-user-pwd # replace with a stronger password (must match DB_PASSWD)
volumes:
bw-data:
ps-data:
db-data:
networks:
@ -100,4 +90,4 @@ networks:
config:
- subnet: 10.20.30.0/24
bw-services:
net-docker:
bw-docker:

View File

@ -4,7 +4,7 @@ services:
myps:
image: prestashop/prestashop:1.7
volumes:
- ps_data:/var/www/html
- ps-data:/var/www/html
networks:
- bw-services
environment:
@ -33,7 +33,7 @@ services:
mydb:
image: mariadb
volumes:
- db_data:/var/lib/mysql
- db-data:/var/lib/mysql
networks:
- bw-services
environment:
@ -52,5 +52,5 @@ networks:
name: bw-services
volumes:
ps_data:
db_data:
ps-data:
db-data:

View File

@ -3,14 +3,6 @@ version: "3"
services:
mybunker:
image: bunkerity/bunkerweb:1.5.0
# ⚠️ read this if you use local folders for volumes ⚠️
# bunkerweb runs as an unprivileged user with UID/GID 101
# don't forget to edit the permissions of the files and folders accordingly
# example if you need to create a directory : mkdir folder && chown root:101 folder && chmod 770 folder
# or for an existing one : chown -R root:101 folder && chmod -R 770 folder
# more info at https://docs.bunkerweb.io
volumes:
- bw-data:/data
environment:
- SERVER_NAME=www.example.com # replace with your domains
- API_WHITELIST_IP=127.0.0.0/8 10.20.30.0/24
@ -39,21 +31,21 @@ services:
depends_on:
- mybunker
environment:
- DOCKER_HOST=tcp://docker-proxy:2375
- DOCKER_HOST=tcp://bw-docker-proxy:2375
volumes:
- bw-data:/data
networks:
- bw-universe
- net-docker
- bw-docker
docker-proxy:
bw-docker-proxy:
image: tecnativa/docker-socket-proxy:0.1
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CONTAINERS=1
networks:
- net-docker
- bw-docker
myproxy:
image: haproxy:2.7-alpine
@ -80,7 +72,7 @@ networks:
config:
- subnet: 10.20.30.0/24
bw-services:
net-docker:
bw-docker:
net-proxy:
ipam:
driver: default

View File

@ -6,14 +6,6 @@ services:
ports:
- 80:8080
- 443:8443
# ⚠️ read this if you use local folders for volumes ⚠️
# bunkerweb runs as an unprivileged user with UID/GID 101
# don't forget to edit the permissions of the files and folders accordingly
# example if you need to create a directory : mkdir folder && chown root:101 folder && chmod 770 folder
# another example for existing folder : chown -R root:101 folder && chmod -R 770 folder
# more info at https://docs.bunkerweb.io
volumes:
- bw-data:/data
environment:
- SERVER_NAME=www.example.com # replace with your domain
- API_WHITELIST_IP=127.0.0.0/8 10.20.30.0/24
@ -46,21 +38,21 @@ services:
depends_on:
- mybunker
environment:
- DOCKER_HOST=tcp://docker-proxy:2375
- DOCKER_HOST=tcp://bw-docker-proxy:2375
volumes:
- bw-data:/data
networks:
- bw-universe
- net-docker
- bw-docker
docker-proxy:
bw-docker-proxy:
image: tecnativa/docker-socket-proxy:0.1
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CONTAINERS=1
networks:
- net-docker
- bw-docker
radarr:
image: lscr.io/linuxserver/radarr:4.2.4.6635-ls157
@ -86,4 +78,4 @@ networks:
config:
- subnet: 10.20.30.0/24
bw-services:
net-docker:
bw-docker:

View File

@ -10,9 +10,9 @@ services:
- PGID=1000
- TZ=Europe/London
volumes:
- rr_config:/config
- rr_movies:/movies #optional
- rr_downloads:/downloads #optional
- rr-config:/config
- rr-movies:/movies #optional
- rr-downloads:/downloads #optional
deploy:
placement:
constraints:
@ -39,6 +39,6 @@ networks:
name: bw-services
volumes:
rr_config:
rr_downloads:
rr_movies:
rr-config:
rr-downloads:
rr-movies: