diff --git a/cluster_node-dev.yml b/cluster_node-dev.yml index 9a973a1..e13cbe8 100644 --- a/cluster_node-dev.yml +++ b/cluster_node-dev.yml @@ -1,3 +1,4 @@ +version: '3' services: cluster-node: container_name: cluster-node @@ -7,19 +8,16 @@ services: dockerfile: Dockerfile-cluster_node environment: - MASTER_SERVER_ADDRESS=${MASTER_SERVER_ADDRESS} - - COMPOSE_VERSION=c2a + - DEBUG_MODE=${DEBUG_MODE} + - COMPOSE_VERSION=c1b - TZ=${TIMEZONE} - TOKEN=${TOKEN} volumes: - cluster_node_wireguard:/etc/wireguard - cluster_node_dnsmasq_conf:/etc/dnsmasq/ - - cluster_node_caddy_json:/caddy_json_export/ - - cluster_node_caddy_certificates:/caddy_certificates/ ports: - # Different host ports, so the node can run on the same host as the development primary server - - "52820-52839:51820-51839/udp" - - "9080:80" - - "9443:443" + # Ports for WireGuard instances. + - "51820-51839:51820-51839/udp" cap_add: - NET_ADMIN - SYS_MODULE @@ -30,57 +28,11 @@ services: cluster-node-dns: container_name: cluster-node-dns restart: unless-stopped - build: - context: containers/dnsmasq - dockerfile: Dockerfile-dnsmasq - network_mode: "service:cluster-node" + image: eduardosilva/wireguard_webadmin_dns:latest environment: - TZ=${TIMEZONE} volumes: - cluster_node_dnsmasq_conf:/etc/dnsmasq/ - depends_on: - - cluster-node - - cluster-node-caddy: - container_name: cluster-node-caddy - restart: unless-stopped - build: - context: containers/caddy - dockerfile: Dockerfile-caddy - network_mode: "service:cluster-node" - environment: - - TZ=${TIMEZONE} - - CLUSTER_NODE=true - - AUTH_GATEWAY_INTERNAL_URL=http://cluster-node-auth-gateway:9091 - volumes: - - cluster_node_caddy_json:/caddy_json_export/ - - cluster_node_caddy_certificates:/caddy_certificates/:ro - - cluster_node_caddy_data:/data - - cluster_node_caddy_config:/config - depends_on: - - cluster-node - - cluster-node-auth-gateway - - cluster-node-auth-gateway: - container_name: cluster-node-auth-gateway - restart: unless-stopped - build: - context: containers/auth-gateway - dockerfile: Dockerfile-auth-gateway - environment: - - TZ=${TIMEZONE} - - AUTH_GATEWAY_CONFIG_DIR=/caddy_json_export - - AUTH_GATEWAY_DATABASE_PATH=/data/auth-gateway.sqlite3 - - AUTH_GATEWAY_SECURE_COOKIES=false - volumes: - - cluster_node_caddy_json:/caddy_json_export/ - - cluster_node_auth_gateway_data:/data - volumes: cluster_node_wireguard: cluster_node_dnsmasq_conf: - cluster_node_caddy_json: - cluster_node_caddy_certificates: - cluster_node_caddy_data: - cluster_node_caddy_config: - cluster_node_auth_gateway_data: diff --git a/cluster_node.yml b/cluster_node.yml index f821bed..5fab3de 100644 --- a/cluster_node.yml +++ b/cluster_node.yml @@ -1,3 +1,4 @@ +version: '3' services: cluster-node: container_name: cluster-node @@ -5,7 +6,8 @@ services: image: eduardosilva/wireguard-webadmin-cluster-node:latest environment: - MASTER_SERVER_ADDRESS=${MASTER_SERVER_ADDRESS} - - COMPOSE_VERSION=c2a + - DEBUG_MODE=${DEBUG_MODE} + - COMPOSE_VERSION=c1b - TZ=${TIMEZONE} - TOKEN=${TOKEN} volumes: @@ -25,15 +27,10 @@ services: container_name: cluster-node-dns restart: unless-stopped image: eduardosilva/wireguard_webadmin_dns:latest - # Shares the network of cluster-node, so DNS is answered directly on the WireGuard interfaces - network_mode: "service:cluster-node" environment: - TZ=${TIMEZONE} volumes: - cluster_node_dnsmasq_conf:/etc/dnsmasq/ - depends_on: - - cluster-node - volumes: cluster_node_wireguard: cluster_node_dnsmasq_conf: diff --git a/docker-compose-caddy.yml b/docker-compose-caddy.yml index de1509e..3921f0f 100644 --- a/docker-compose-caddy.yml +++ b/docker-compose-caddy.yml @@ -24,7 +24,6 @@ services: - app_secrets:/app_secrets/ - rrd_data:/rrd_data/ - caddy_json_export:/caddy_json_export/ - - caddy_cert_export:/caddy_cert_export/:ro ports: # Do not directly expose the Django port to the internet, use the reverse proxy below instead # - "127.0.0.1:8000:8000" @@ -88,7 +87,6 @@ services: volumes: - static_volume:/static - caddy_json_export:/caddy_json_export - - caddy_cert_export:/caddy_cert_export - caddy_data:/data - caddy_config:/config network_mode: "service:wireguard-webadmin" @@ -117,7 +115,6 @@ volumes: app_secrets: rrd_data: caddy_json_export: - caddy_cert_export: auth_gateway_data: caddy_data: caddy_config: diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index acc05e0..622d3e6 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -27,7 +27,6 @@ services: - app_secrets:/app_secrets/ - rrd_data:/rrd_data/ - caddy_json_export:/caddy_json_export/ - - caddy_cert_export:/caddy_cert_export/:ro ports: # Do not directly expose the Django port to the internet, use some kind of reverse proxy with SSL. - "8000:8000" @@ -100,7 +99,6 @@ services: volumes: - static_volume:/static - caddy_json_export:/caddy_json_export - - caddy_cert_export:/caddy_cert_export - caddy_data:/data - caddy_config:/config network_mode: "service:wireguard-webadmin" @@ -132,7 +130,6 @@ volumes: app_secrets: rrd_data: caddy_json_export: - caddy_cert_export: auth_gateway_data: caddy_data: caddy_config: diff --git a/testing-cluster_node-dev.yml b/testing-cluster_node-dev.yml new file mode 100644 index 0000000..9a973a1 --- /dev/null +++ b/testing-cluster_node-dev.yml @@ -0,0 +1,86 @@ +services: + cluster-node: + container_name: cluster-node + restart: unless-stopped + build: + context: containers/cluster_node + dockerfile: Dockerfile-cluster_node + environment: + - MASTER_SERVER_ADDRESS=${MASTER_SERVER_ADDRESS} + - COMPOSE_VERSION=c2a + - TZ=${TIMEZONE} + - TOKEN=${TOKEN} + volumes: + - cluster_node_wireguard:/etc/wireguard + - cluster_node_dnsmasq_conf:/etc/dnsmasq/ + - cluster_node_caddy_json:/caddy_json_export/ + - cluster_node_caddy_certificates:/caddy_certificates/ + ports: + # Different host ports, so the node can run on the same host as the development primary server + - "52820-52839:51820-51839/udp" + - "9080:80" + - "9443:443" + cap_add: + - NET_ADMIN + - SYS_MODULE + sysctls: + - net.ipv4.conf.all.src_valid_mark=1 + - net.ipv4.ip_forward=1 + + cluster-node-dns: + container_name: cluster-node-dns + restart: unless-stopped + build: + context: containers/dnsmasq + dockerfile: Dockerfile-dnsmasq + network_mode: "service:cluster-node" + environment: + - TZ=${TIMEZONE} + volumes: + - cluster_node_dnsmasq_conf:/etc/dnsmasq/ + depends_on: + - cluster-node + + cluster-node-caddy: + container_name: cluster-node-caddy + restart: unless-stopped + build: + context: containers/caddy + dockerfile: Dockerfile-caddy + network_mode: "service:cluster-node" + environment: + - TZ=${TIMEZONE} + - CLUSTER_NODE=true + - AUTH_GATEWAY_INTERNAL_URL=http://cluster-node-auth-gateway:9091 + volumes: + - cluster_node_caddy_json:/caddy_json_export/ + - cluster_node_caddy_certificates:/caddy_certificates/:ro + - cluster_node_caddy_data:/data + - cluster_node_caddy_config:/config + depends_on: + - cluster-node + - cluster-node-auth-gateway + + cluster-node-auth-gateway: + container_name: cluster-node-auth-gateway + restart: unless-stopped + build: + context: containers/auth-gateway + dockerfile: Dockerfile-auth-gateway + environment: + - TZ=${TIMEZONE} + - AUTH_GATEWAY_CONFIG_DIR=/caddy_json_export + - AUTH_GATEWAY_DATABASE_PATH=/data/auth-gateway.sqlite3 + - AUTH_GATEWAY_SECURE_COOKIES=false + volumes: + - cluster_node_caddy_json:/caddy_json_export/ + - cluster_node_auth_gateway_data:/data + +volumes: + cluster_node_wireguard: + cluster_node_dnsmasq_conf: + cluster_node_caddy_json: + cluster_node_caddy_certificates: + cluster_node_caddy_data: + cluster_node_caddy_config: + cluster_node_auth_gateway_data: diff --git a/cluster_node-gateway.yml b/testing-cluster_node-gateway.yml similarity index 89% rename from cluster_node-gateway.yml rename to testing-cluster_node-gateway.yml index 3ecb816..a9b7d84 100644 --- a/cluster_node-gateway.yml +++ b/testing-cluster_node-gateway.yml @@ -1,5 +1,5 @@ -# App Gateway for cluster nodes. Use together with cluster_node.yml: -# docker compose -f cluster_node.yml -f cluster_node-gateway.yml up -d +# App Gateway for cluster nodes. Use together with testing-cluster_node.yml: +# docker compose -f testing-cluster_node.yml -f testing-cluster_node-gateway.yml up -d services: cluster-node: volumes: diff --git a/testing-cluster_node.yml b/testing-cluster_node.yml new file mode 100644 index 0000000..f821bed --- /dev/null +++ b/testing-cluster_node.yml @@ -0,0 +1,39 @@ +services: + cluster-node: + container_name: cluster-node + restart: unless-stopped + image: eduardosilva/wireguard-webadmin-cluster-node:latest + environment: + - MASTER_SERVER_ADDRESS=${MASTER_SERVER_ADDRESS} + - COMPOSE_VERSION=c2a + - TZ=${TIMEZONE} + - TOKEN=${TOKEN} + volumes: + - cluster_node_wireguard:/etc/wireguard + - cluster_node_dnsmasq_conf:/etc/dnsmasq/ + ports: + # Ports for WireGuard instances. + - "51820-51839:51820-51839/udp" + cap_add: + - NET_ADMIN + - SYS_MODULE + sysctls: + - net.ipv4.conf.all.src_valid_mark=1 + - net.ipv4.ip_forward=1 + + cluster-node-dns: + container_name: cluster-node-dns + restart: unless-stopped + image: eduardosilva/wireguard_webadmin_dns:latest + # Shares the network of cluster-node, so DNS is answered directly on the WireGuard interfaces + network_mode: "service:cluster-node" + environment: + - TZ=${TIMEZONE} + volumes: + - cluster_node_dnsmasq_conf:/etc/dnsmasq/ + depends_on: + - cluster-node + +volumes: + cluster_node_wireguard: + cluster_node_dnsmasq_conf: diff --git a/testing-docker-compose-caddy.yml b/testing-docker-compose-caddy.yml new file mode 100644 index 0000000..de1509e --- /dev/null +++ b/testing-docker-compose-caddy.yml @@ -0,0 +1,123 @@ +version: '3' +services: + wireguard-webadmin: + container_name: wireguard-webadmin + restart: unless-stopped + image: eduardosilva/wireguard_webadmin:latest + environment: + - SERVER_ADDRESS=${SERVER_ADDRESS} + - DEBUG_MODE=${DEBUG_MODE} + - COMPOSE_VERSION=c2g + - TZ=${TIMEZONE} + - EXTRA_ALLOWED_HOSTS=${EXTRA_ALLOWED_HOSTS} + - WIREGUARD_STATUS_CACHE_ENABLED=${WIREGUARD_STATUS_CACHE_ENABLED} + - WIREGUARD_STATUS_CACHE_WEB_LOAD_PREVIOUS_COUNT=${WIREGUARD_STATUS_CACHE_WEB_LOAD_PREVIOUS_COUNT} + - WIREGUARD_STATUS_CACHE_REFRESH_INTERVAL=${WIREGUARD_STATUS_CACHE_REFRESH_INTERVAL} + - VPN_CLIENTS_CAN_ACCESS_DJANGO=${VPN_CLIENTS_CAN_ACCESS_DJANGO} + - WIREGUARD_MTU=${WIREGUARD_MTU} + - DISABLE_AUTO_APPLY=${DISABLE_AUTO_APPLY} + - CADDY_ENABLED=true + volumes: + - wireguard:/etc/wireguard + - static_volume:/app_static_files/ + - dnsmasq_conf:/etc/dnsmasq + - app_secrets:/app_secrets/ + - rrd_data:/rrd_data/ + - caddy_json_export:/caddy_json_export/ + - caddy_cert_export:/caddy_cert_export/:ro + ports: + # Do not directly expose the Django port to the internet, use the reverse proxy below instead + # - "127.0.0.1:8000:8000" + # Caddy ports — declared here because wireguard-webadmin-caddy shares this network namespace + - "80:80" + - "443:443" + # Warning: Docker will have a hard time handling large amount of ports. Expose only the ports that you need. + # Ports for multiple WireGuard instances. (Probably, you just need one) + - "51820-51839:51820-51839/udp" + # Ports for port forwarding rules. Add your own ports here if you need them. + - "8080-8089:8080-8089/tcp" + cap_add: + - NET_ADMIN + - SYS_MODULE + sysctls: + - net.ipv4.conf.all.src_valid_mark=1 + - net.ipv4.ip_forward=1 + command: /bin/bash /app/init.sh + + wireguard-webadmin-cron: + container_name: wireguard-webadmin-cron + restart: unless-stopped + image: eduardosilva/wireguard_webadmin_cron:latest + environment: + - TZ=${TIMEZONE} + - WIREGUARD_STATUS_CACHE_REFRESH_INTERVAL=${WIREGUARD_STATUS_CACHE_REFRESH_INTERVAL} + volumes: + - app_secrets:/app_secrets/ + depends_on: + - wireguard-webadmin + + wireguard-webadmin-rrdtool: + container_name: wireguard-webadmin-rrdtool + restart: unless-stopped + image: eduardosilva/wireguard_webadmin_rrdtool:latest + volumes: + - app_secrets:/app_secrets/ + - rrd_data:/rrd_data/ + environment: + - TZ=${TIMEZONE} + depends_on: + - wireguard-webadmin + + wireguard-webadmin-dns: + container_name: wireguard-webadmin-dns + restart: unless-stopped + image: eduardosilva/wireguard_webadmin_dns:latest + environment: + - TZ=${TIMEZONE} + volumes: + - dnsmasq_conf:/etc/dnsmasq/ + + wireguard-webadmin-caddy: + container_name: wireguard-webadmin-caddy + restart: unless-stopped + image: eduardosilva/wireguard_webadmin_caddy:latest + environment: + - SERVER_ADDRESS=${SERVER_ADDRESS} + - EXTRA_ALLOWED_HOSTS=${EXTRA_ALLOWED_HOSTS} + - TZ=${TIMEZONE} + volumes: + - static_volume:/static + - caddy_json_export:/caddy_json_export + - caddy_cert_export:/caddy_cert_export + - caddy_data:/data + - caddy_config:/config + network_mode: "service:wireguard-webadmin" + depends_on: + - wireguard-webadmin + - wireguard-webadmin-auth-gateway + + wireguard-webadmin-auth-gateway: + container_name: wireguard-webadmin-auth-gateway + restart: unless-stopped + image: eduardosilva/wireguard_webadmin_auth_gateway:latest + environment: + - TZ=${TIMEZONE} + - AUTH_GATEWAY_CONFIG_DIR=/caddy_json_export + - AUTH_GATEWAY_DATABASE_PATH=/data/auth-gateway.sqlite3 + volumes: + - caddy_json_export:/caddy_json_export + - auth_gateway_data:/data + depends_on: + - wireguard-webadmin + +volumes: + static_volume: + wireguard: + dnsmasq_conf: + app_secrets: + rrd_data: + caddy_json_export: + caddy_cert_export: + auth_gateway_data: + caddy_data: + caddy_config: diff --git a/testing-docker-compose-dev.yml b/testing-docker-compose-dev.yml new file mode 100644 index 0000000..acc05e0 --- /dev/null +++ b/testing-docker-compose-dev.yml @@ -0,0 +1,138 @@ +version: '3' +services: + wireguard-webadmin: + container_name: wireguard-webadmin + restart: unless-stopped + build: + context: . + environment: + - SERVER_ADDRESS=${SERVER_ADDRESS} + - DEBUG_MODE=${DEBUG_MODE} + - DEV_MODE=True + - COMPOSE_VERSION=c2g + - TZ=${TIMEZONE} + - EXTRA_ALLOWED_HOSTS=${EXTRA_ALLOWED_HOSTS} + - WIREGUARD_STATUS_CACHE_ENABLED=${WIREGUARD_STATUS_CACHE_ENABLED} + - WIREGUARD_STATUS_CACHE_WEB_LOAD_PREVIOUS_COUNT=${WIREGUARD_STATUS_CACHE_WEB_LOAD_PREVIOUS_COUNT} + - WIREGUARD_STATUS_CACHE_REFRESH_INTERVAL=${WIREGUARD_STATUS_CACHE_REFRESH_INTERVAL} + - VPN_CLIENTS_CAN_ACCESS_DJANGO=${VPN_CLIENTS_CAN_ACCESS_DJANGO} + - WIREGUARD_MTU=${WIREGUARD_MTU} + - DISABLE_AUTO_APPLY=${DISABLE_AUTO_APPLY} + - CADDY_ENABLED=true + volumes: + - wireguard:/etc/wireguard + - static_volume:/app_static_files/ + - .:/app + - dnsmasq_conf:/etc/dnsmasq + - app_secrets:/app_secrets/ + - rrd_data:/rrd_data/ + - caddy_json_export:/caddy_json_export/ + - caddy_cert_export:/caddy_cert_export/:ro + ports: + # Do not directly expose the Django port to the internet, use some kind of reverse proxy with SSL. + - "8000:8000" + # Caddy ports — declared here because wireguard-webadmin-caddy shares this network namespace + - "80:80" + - "443:443" + # Warning: Docker will have a hard time handling large amount of ports. Expose only the ports that you need. + # Ports for multiple WireGuard instances. (Probably, you just need one) + - "51820-51839:51820-51839/udp" + # Ports for port forwarding rules. Add your own ports here if you need them. + - "8080-8089:8080-8089/tcp" + + cap_add: + - NET_ADMIN + - SYS_MODULE + sysctls: + - net.ipv4.conf.all.src_valid_mark=1 + - net.ipv4.ip_forward=1 + command: /bin/bash /app/init.sh + + wireguard-webadmin-cron: + container_name: wireguard-webadmin-cron + restart: unless-stopped + build: + context: containers/cron + dockerfile: Dockerfile-cron + environment: + - TZ=${TIMEZONE} + - WIREGUARD_STATUS_CACHE_REFRESH_INTERVAL=${WIREGUARD_STATUS_CACHE_REFRESH_INTERVAL} + volumes: + - app_secrets:/app_secrets/ + depends_on: + - wireguard-webadmin + + wireguard-webadmin-rrdtool: + container_name: wireguard-webadmin-rrdtool + restart: unless-stopped + build: + context: ./containers/rrdtool + dockerfile: Dockerfile-rrdtool + volumes: + - app_secrets:/app_secrets/ + - rrd_data:/rrd_data/ + environment: + - TZ=${TIMEZONE} + depends_on: + - wireguard-webadmin + + wireguard-webadmin-dns: + container_name: wireguard-webadmin-dns + restart: unless-stopped + build: + context: ./containers/dnsmasq + dockerfile: Dockerfile-dnsmasq + environment: + - TZ=${TIMEZONE} + volumes: + - dnsmasq_conf:/etc/dnsmasq/ + + wireguard-webadmin-caddy: + container_name: wireguard-webadmin-caddy + restart: unless-stopped + build: + context: ./containers/caddy + dockerfile: Dockerfile-caddy + environment: + - SERVER_ADDRESS=${SERVER_ADDRESS} + - EXTRA_ALLOWED_HOSTS=${EXTRA_ALLOWED_HOSTS} + - TZ=${TIMEZONE} + volumes: + - static_volume:/static + - caddy_json_export:/caddy_json_export + - caddy_cert_export:/caddy_cert_export + - caddy_data:/data + - caddy_config:/config + network_mode: "service:wireguard-webadmin" + depends_on: + - wireguard-webadmin + - wireguard-webadmin-auth-gateway + + wireguard-webadmin-auth-gateway: + container_name: wireguard-webadmin-auth-gateway + restart: unless-stopped + build: + context: ./containers/auth-gateway + dockerfile: Dockerfile-auth-gateway + environment: + - TZ=${TIMEZONE} + - AUTH_GATEWAY_CONFIG_DIR=/caddy_json_export + - AUTH_GATEWAY_DATABASE_PATH=/data/auth-gateway.sqlite3 + - AUTH_GATEWAY_SECURE_COOKIES=false + volumes: + - caddy_json_export:/caddy_json_export + - auth_gateway_data:/data + depends_on: + - wireguard-webadmin + +volumes: + static_volume: + wireguard: + dnsmasq_conf: + app_secrets: + rrd_data: + caddy_json_export: + caddy_cert_export: + auth_gateway_data: + caddy_data: + caddy_config: