diff --git a/examples/moodle/moodle.png b/examples/moodle/architecture.png similarity index 100% rename from examples/moodle/moodle.png rename to examples/moodle/architecture.png diff --git a/examples/multisite-basic/README.md b/examples/multisite-basic/README.md new file mode 100644 index 0000000..e9a7b4c --- /dev/null +++ b/examples/multisite-basic/README.md @@ -0,0 +1,11 @@ +# Multisite basic + +This is a basic example for hosting multiple web services. + +## Architecture + + + +## Docker + +See [docker-compose.yml](https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/multisite-basic/docker-compose.yml). diff --git a/examples/multisite-custom-confs/README.md b/examples/multisite-custom-confs/README.md new file mode 100644 index 0000000..7b05e17 --- /dev/null +++ b/examples/multisite-custom-confs/README.md @@ -0,0 +1,11 @@ +# Multisite with custom configurations + +This is a basic example for hosting multiple web services with custom configurations. + +## Architecture + + + +## Docker + +See [docker-compose.yml](https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/multisite-custom-confs/docker-compose.yml). diff --git a/examples/multisite-custom-server-confs/docker-compose.yml b/examples/multisite-custom-confs/docker-compose.yml similarity index 100% rename from examples/multisite-custom-server-confs/docker-compose.yml rename to examples/multisite-custom-confs/docker-compose.yml diff --git a/examples/multisite-custom-server-confs/modsec-confs/nc.example.com/nextcloud.conf b/examples/multisite-custom-confs/modsec-confs/nc.example.com/nextcloud.conf similarity index 100% rename from examples/multisite-custom-server-confs/modsec-confs/nc.example.com/nextcloud.conf rename to examples/multisite-custom-confs/modsec-confs/nc.example.com/nextcloud.conf diff --git a/examples/multisite-custom-server-confs/modsec-confs/wp.example.com/wordpress.conf b/examples/multisite-custom-confs/modsec-confs/wp.example.com/wordpress.conf similarity index 100% rename from examples/multisite-custom-server-confs/modsec-confs/wp.example.com/wordpress.conf rename to examples/multisite-custom-confs/modsec-confs/wp.example.com/wordpress.conf diff --git a/examples/multisite-custom-server-confs/modsec-crs-confs/nc.example.com/nextcloud.conf b/examples/multisite-custom-confs/modsec-crs-confs/nc.example.com/nextcloud.conf similarity index 100% rename from examples/multisite-custom-server-confs/modsec-crs-confs/nc.example.com/nextcloud.conf rename to examples/multisite-custom-confs/modsec-crs-confs/nc.example.com/nextcloud.conf diff --git a/examples/multisite-custom-server-confs/modsec-crs-confs/wp.example.com/wordpress.conf b/examples/multisite-custom-confs/modsec-crs-confs/wp.example.com/wordpress.conf similarity index 100% rename from examples/multisite-custom-server-confs/modsec-crs-confs/wp.example.com/wordpress.conf rename to examples/multisite-custom-confs/modsec-crs-confs/wp.example.com/wordpress.conf diff --git a/examples/multisite-custom-server-confs/server-confs/nc.example.com/nextcloud.conf b/examples/multisite-custom-confs/server-confs/nc.example.com/nextcloud.conf similarity index 100% rename from examples/multisite-custom-server-confs/server-confs/nc.example.com/nextcloud.conf rename to examples/multisite-custom-confs/server-confs/nc.example.com/nextcloud.conf diff --git a/examples/multisite-custom-server-confs/server-confs/wp.example.com/permalinks.conf b/examples/multisite-custom-confs/server-confs/wp.example.com/permalinks.conf similarity index 100% rename from examples/multisite-custom-server-confs/server-confs/wp.example.com/permalinks.conf rename to examples/multisite-custom-confs/server-confs/wp.example.com/permalinks.conf diff --git a/examples/multisite-custom-subfolders/README.md b/examples/multisite-custom-subfolders/README.md new file mode 100644 index 0000000..6f4216b --- /dev/null +++ b/examples/multisite-custom-subfolders/README.md @@ -0,0 +1,11 @@ +# Multisite with custom subfolders + +This is a basic example for hosting multiple web services with custom subfolders. + +## Architecture + + + +## Docker + +See [docker-compose.yml](https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/multisite-custom-subfolders/docker-compose.yml). diff --git a/examples/nextcloud/README.md b/examples/nextcloud/README.md new file mode 100644 index 0000000..e3bf12e --- /dev/null +++ b/examples/nextcloud/README.md @@ -0,0 +1,11 @@ +# Nextcloud + +Nextcloud is a suite of client-server software for creating and using file hosting services. It is enterprise-ready with comprehensive support options. See the official [website](https://nextcloud.com/) and [repository](https://github.com/nextcloud/server) for more information. + +## Architecture + + + +## Docker + +See [docker-compose.yml](https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/nextcloud/docker-compose.yml). diff --git a/examples/passbolt/README.md b/examples/passbolt/README.md new file mode 100644 index 0000000..88e630f --- /dev/null +++ b/examples/passbolt/README.md @@ -0,0 +1,11 @@ +# Passbolt + +Passbolt is a free open source password manager for teams. See the official [website](https://www.passbolt.com/) and [repository](https://github.com/passbolt/passbolt_api) for more information. + +## Architecture + + + +## Docker + +See [docker-compose.yml](https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/passbolt/docker-compose.yml). diff --git a/examples/prestashop/README.md b/examples/prestashop/README.md new file mode 100644 index 0000000..da82623 --- /dev/null +++ b/examples/prestashop/README.md @@ -0,0 +1,11 @@ +# PrestaShop + +PrestaShop is a freemium, open source e-commerce platform. See the official [website](https://www.prestashop.com) and [repository](https://github.com/PrestaShop/PrestaShop) for more information. + +## Architecture + + + +## Docker + +See [docker-compose.yml](https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/prestashop/docker-compose.yml). diff --git a/examples/redmine/README.md b/examples/redmine/README.md new file mode 100644 index 0000000..39563a1 --- /dev/null +++ b/examples/redmine/README.md @@ -0,0 +1,11 @@ +# Redmine + +Redmine is a free and open source, web-based project management and issue tracking tool. See the official [website](https://www.redmine.org) and [repository](https://svn.redmine.org/redmine/) for more information. + +## Architecture + + + +## Docker + +See [docker-compose.yml](https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/redmine/docker-compose.yml). diff --git a/examples/reverse-proxy-multisite/README.md b/examples/reverse-proxy-multisite/README.md new file mode 100644 index 0000000..db2f60b --- /dev/null +++ b/examples/reverse-proxy-multisite/README.md @@ -0,0 +1,11 @@ +# Reverse proxy multisite + +Simple example to show how to setup bunkerized-nginx in front of some existing HTTP services. Each service has its own domain hence the multisite. + +## Architecture + + + +## Docker + +See [docker-compose.yml](https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/reverse-proxy-multisite/docker-compose.yml). diff --git a/examples/reverse-proxy-singlesite/README.md b/examples/reverse-proxy-singlesite/README.md new file mode 100644 index 0000000..07b5f60 --- /dev/null +++ b/examples/reverse-proxy-singlesite/README.md @@ -0,0 +1,11 @@ +# Reverse proxy single site + +Simple example to show how to setup bunkerized-nginx in front of some existing HTTP services. Each service share the same domain(s) and are accessible from different paths. + +## Architecture + + + +## Docker + +See [docker-compose.yml](https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/reverse-proxy-singlesite/docker-compose.yml). diff --git a/examples/reverse-proxy-websocket/README.md b/examples/reverse-proxy-websocket/README.md new file mode 100644 index 0000000..23e2c4a --- /dev/null +++ b/examples/reverse-proxy-websocket/README.md @@ -0,0 +1,11 @@ +# Reverse proxy with websocket + +Simple example to show how to setup bunkerized-nginx in front of some existing WebSocket services. + +## Architecture + + + +## Docker + +See [docker-compose.yml](https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/reverse-proxy-websocket/docker-compose.yml). diff --git a/examples/swarm-redis/1-config.yml b/examples/swarm-redis/1-config.yml deleted file mode 100644 index ef92aca..0000000 --- a/examples/swarm-redis/1-config.yml +++ /dev/null @@ -1,38 +0,0 @@ -version: '3.8' - -services: - - autoconf: - image: bunkerity/bunkerized-nginx-autoconf - # bunkerized-nginx runs as an unprivileged user with UID/GID 101 - # don't forget to edit the permissions of the files and folders accordingly - volumes: - - /var/run/docker.sock:/var/run/docker.sock:ro - - /shared/confs:/etc/nginx - - /shared/letsencrypt:/etc/letsencrypt - - /shared/acme-challenge:/acme-challenge - - /shared/cache:/cache - environment: - - SWARM_MODE=yes - - API_URI=/ChangeMeToSomethingHardToGuess # must match API_URI from nginx - networks: - - net_config - deploy: - replicas: 1 - placement: - constraints: - - "node.role==manager" - - redis: - image: redis:alpine - networks: - - net_config - deploy: - replicas: 1 - placement: - constraints: - - "node.role==worker" - -networks: - net_config: - external: true diff --git a/examples/swarm-redis/README.md b/examples/swarm-redis/README.md new file mode 100644 index 0000000..add0b60 --- /dev/null +++ b/examples/swarm-redis/README.md @@ -0,0 +1,22 @@ +# Swarm wit hredis + +Basic examples on how to deploy and use bunkerized-nginx within a Docker Swarm cluster and use redis to distribute the blacklists. See the [Docker Swarm](#TODO) section of the documentation for more information. + +## Architecture + + + +## Swarm + +This example uses two overlay networks needed by the services : + +```shell +$ docker network create -d overlay --attachable net_config +$ docker network create -d overlay --attachable net_services +``` + +First you need to create the redis service : see [redis.yml](https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/swarm-redis/redis.yml). + +Then, it's time to setup bunkerized-nginx and the autoconf with Swarm mode activated : see [nginx-autoconf.yml](https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/swarm-redis/nginx-autoconf.yml). + +Then you can add and delete your web services and autoconf will automatically generate the configuration based on your labels : see [services.yml](https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/swarm-redis/services.yml). diff --git a/examples/swarm/stack.yml b/examples/swarm-redis/nginx-autoconf.yml similarity index 65% rename from examples/swarm/stack.yml rename to examples/swarm-redis/nginx-autoconf.yml index 9e5733f..c55015d 100644 --- a/examples/swarm/stack.yml +++ b/examples/swarm-redis/nginx-autoconf.yml @@ -12,6 +12,8 @@ services: - /shared/letsencrypt:/etc/letsencrypt - /shared/acme-challenge:/acme-challenge - /shared/cache:/cache + - /shared/modsec-confs:/modsec-confs:ro + - /shared/modsec-crs-confs:/modsec-crs-confs:ro environment: - SWARM_MODE=yes - API_URI=/ChangeMeToSomethingHardToGuess # must match API_URI from nginx @@ -42,8 +44,12 @@ services: - /shared/acme-challenge:/acme-challenge:ro - /shared/www:/www:ro - /shared/cache:/cache:ro + - /shared/modsec-confs:/modsec-confs:ro + - /shared/modsec-crs-confs:/modsec-crs-confs:ro environment: - SWARM_MODE=yes + - USE_REDIS=yes + - REDIS_HOST=redis - USE_API=yes - API_URI=/ChangeMeToSomethingHardToGuess # must match API_URI from autoconf - MULTISITE=yes @@ -63,43 +69,8 @@ services: labels: - "bunkerized-nginx.AUTOCONF" - app1: - image: php:fpm-alpine - volumes: - - /shared/www/app1.example.com:/www - networks: - - net_services - deploy: - replicas: 1 - placement: - constraints: - - "node.role==worker" - labels: - - "bunkerized-nginx.SERVER_NAME=app1.example.com" - - "bunkerized-nginx.REMOTE_PHP=app1" - - "bunkerized-nginx.REMOTE_PHP_PATH=/www" - - app2: - image: phpmyadmin:apache - environment: - - PMA_ARBITRARY=1 - - PMA_ABSOLUTE_URI=https://app2.example.com - networks: - - net_services - deploy: - replicas: 1 - placement: - constraints: - - "node.role==worker" - labels: - - "bunkerized-nginx.SERVER_NAME=app2.example.com" - - "bunkerized-nginx.USE_PROXY_CACHE=yes" - - "bunkerized-nginx.USE_REVERSE_PROXY=yes" - - "bunkerized-nginx.REVERSE_PROXY_URL=/" - - "bunkerized-nginx.REVERSE_PROXY_HOST=http://app2" - networks: net_config: - driver: overlay + external: true net_services: - driver: overlay + external: true diff --git a/examples/swarm-redis/redis.yml b/examples/swarm-redis/redis.yml new file mode 100644 index 0000000..d02f8cd --- /dev/null +++ b/examples/swarm-redis/redis.yml @@ -0,0 +1,17 @@ +version: '3.8' + +services: + + redis: + image: redis:alpine + networks: + - net_config + deploy: + replicas: 1 + placement: + constraints: + - "node.role==worker" + +networks: + net_config: + external: true diff --git a/examples/swarm-redis/3-services.yml b/examples/swarm-redis/services.yml similarity index 100% rename from examples/swarm-redis/3-services.yml rename to examples/swarm-redis/services.yml diff --git a/examples/swarm/README.md b/examples/swarm/README.md new file mode 100644 index 0000000..6ea38db --- /dev/null +++ b/examples/swarm/README.md @@ -0,0 +1,20 @@ +# Swarm + +Basic examples on how to deploy and use bunkerized-nginx within a Docker Swarm cluster. See the [Docker Swarm](#TODO) section of the documentation for more information. + +## Architecture + + + +## Swarm + +This example uses two overlay networks needed by the services : + +```shell +$ docker network create -d overlay --attachable net_config +$ docker network create -d overlay --attachable net_services +``` + +First you will need to setup bunkerized-nginx and the autoconf with Swarm mode activated : see [nginx-autoconf.yml](https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/swarm/nginx-autoconf.yml). + +Then you can add and delete your web services and autoconf will automatically generate the configuration based on your labels : see [services.yml](https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/swarm/services.yml). diff --git a/examples/swarm-redis/2-nginx.yml b/examples/swarm/nginx-autoconf.yml similarity index 57% rename from examples/swarm-redis/2-nginx.yml rename to examples/swarm/nginx-autoconf.yml index fa68ab9..39c65cb 100644 --- a/examples/swarm-redis/2-nginx.yml +++ b/examples/swarm/nginx-autoconf.yml @@ -2,6 +2,29 @@ version: '3.8' services: + autoconf: + image: bunkerity/bunkerized-nginx-autoconf + # bunkerized-nginx runs as an unprivileged user with UID/GID 101 + # don't forget to edit the permissions of the files and folders accordingly + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + - /shared/confs:/etc/nginx + - /shared/letsencrypt:/etc/letsencrypt + - /shared/acme-challenge:/acme-challenge + - /shared/cache:/cache + - /shared/modsec-confs:/modsec-confs:ro + - /shared/modsec-crs-confs:/modsec-crs-confs:ro + environment: + - SWARM_MODE=yes + - API_URI=/ChangeMeToSomethingHardToGuess # must match API_URI from nginx + networks: + - net_config + deploy: + replicas: 1 + placement: + constraints: + - "node.role==manager" + nginx: image: bunkerity/bunkerized-nginx ports: @@ -21,6 +44,8 @@ services: - /shared/acme-challenge:/acme-challenge:ro - /shared/www:/www:ro - /shared/cache:/cache:ro + - /shared/modsec-confs:/modsec-confs:ro + - /shared/modsec-crs-confs:/modsec-crs-confs:ro environment: - SWARM_MODE=yes - USE_API=yes @@ -31,8 +56,6 @@ services: - REDIRECT_HTTP_TO_HTTPS=yes - DISABLE_DEFAULT_SERVER=yes - USE_CLIENT_CACHE=yes - - USE_REDIS=yes - - REDIS_HOST=redis networks: - net_config - net_services diff --git a/examples/swarm/services.yml b/examples/swarm/services.yml new file mode 100644 index 0000000..f985a35 --- /dev/null +++ b/examples/swarm/services.yml @@ -0,0 +1,42 @@ +version: '3.8' + +services: + + app1: + image: php:fpm-alpine + volumes: + - /shared/www/app1.example.com:/www + networks: + - net_services + deploy: + replicas: 1 + placement: + constraints: + - "node.role==worker" + labels: + - "bunkerized-nginx.SERVER_NAME=app1.example.com" + - "bunkerized-nginx.REMOTE_PHP=app1" + - "bunkerized-nginx.REMOTE_PHP_PATH=/www" + + app2: + image: phpmyadmin:apache + environment: + - PMA_ARBITRARY=1 + - PMA_ABSOLUTE_URI=https://app2.example.com + networks: + - net_services + deploy: + replicas: 1 + placement: + constraints: + - "node.role==worker" + labels: + - "bunkerized-nginx.SERVER_NAME=app2.example.com" + - "bunkerized-nginx.USE_PROXY_CACHE=yes" + - "bunkerized-nginx.USE_REVERSE_PROXY=yes" + - "bunkerized-nginx.REVERSE_PROXY_URL=/" + - "bunkerized-nginx.REVERSE_PROXY_HOST=http://app2" + +networks: + net_services: + external: true diff --git a/examples/syslog/README.md b/examples/syslog/README.md new file mode 100644 index 0000000..6cdaaa6 --- /dev/null +++ b/examples/syslog/README.md @@ -0,0 +1,11 @@ +# Syslog + +Send bunkerized-nginx logs to a remote syslog server. + +## Architecture + + + +## Docker + +See [docker-compose.yml](https://github.com/bunkerity/bunkerized-nginx/blob/master/examples/syslog/docker-compose.yml).