summaryrefslogtreecommitdiff
path: root/stacks/edge
diff options
context:
space:
mode:
Diffstat (limited to 'stacks/edge')
-rw-r--r--stacks/edge/.edge.env.template18
-rw-r--r--stacks/edge/.env.template16
-rw-r--r--stacks/edge/.gitignore6
-rw-r--r--stacks/edge/Caddyfile.template29
-rw-r--r--stacks/edge/compose.yml34
5 files changed, 103 insertions, 0 deletions
diff --git a/stacks/edge/.edge.env.template b/stacks/edge/.edge.env.template
new file mode 100644
index 0000000..737f239
--- /dev/null
+++ b/stacks/edge/.edge.env.template
@@ -0,0 +1,18 @@
+DOMAIN=
+DOCUMENT_ROOT=
+
+SERVICE0=
+SERVICE0_SUB=
+SERVICE0_PORT=
+
+SERVICE1=
+SERVICE1_SUB=
+SERVICE1_PORT=
+
+SERVICE2=
+SERVICE2_SUB=
+SERVICE2_PORT=
+
+SERVICE3=
+SERVICE3_SUB=
+SERVICE3_PORT=
diff --git a/stacks/edge/.env.template b/stacks/edge/.env.template
new file mode 100644
index 0000000..972ca33
--- /dev/null
+++ b/stacks/edge/.env.template
@@ -0,0 +1,16 @@
+#
+#
+# Stack Compose Variables
+
+# Namespace
+_STACK=
+_CONTAINER=
+
+# Network
+_NET=
+
+# Volumes
+_CADDYFILE=
+_DATA_VOLUME=
+_CONFIG_VOLUME=
+_WEBROOT=
diff --git a/stacks/edge/.gitignore b/stacks/edge/.gitignore
new file mode 100644
index 0000000..077b892
--- /dev/null
+++ b/stacks/edge/.gitignore
@@ -0,0 +1,6 @@
+# Ignore .env files
+*.env
+.srv/
+.data/
+.config/
+Caddyfile
diff --git a/stacks/edge/Caddyfile.template b/stacks/edge/Caddyfile.template
new file mode 100644
index 0000000..23a6498
--- /dev/null
+++ b/stacks/edge/Caddyfile.template
@@ -0,0 +1,29 @@
+# {
+# debug
+# auto_https off
+# }
+
+# NOTE: EDIT THIS FILE EXPLICITLY. DO NOT AUTOMATE.
+
+{$DOMAIN}:80 {
+ root * {$DOCUMENT_ROOT}
+ encode
+ try_files {path} index.html
+ file_server
+}
+
+{$SERVICE0_SUB}.{$DOMAIN}:80 {
+ reverse_proxy {$SERVICE0}:{$SERVICE0_PORT}
+}
+
+{$SERVICE1_SUB}.{$DOMAIN}:80 {
+ reverse_proxy {$SERVICE1}:{$SERVICE1_PORT}
+}
+
+{$SERVICE2_SUB}.{$DOMAIN}:80 {
+ reverse_proxy {$SERVICE2}:{$SERVICE2_PORT}
+}
+
+{$SERVICE3_SUB}.{$DOMAIN}:80 {
+ reverse_proxy {$SERVICE3}:{$SERVICE3_PORT}
+}
diff --git a/stacks/edge/compose.yml b/stacks/edge/compose.yml
new file mode 100644
index 0000000..1fc33a7
--- /dev/null
+++ b/stacks/edge/compose.yml
@@ -0,0 +1,34 @@
+name: ${_STACK}
+
+volumes:
+ data:
+ name: ${_DATA_VOLUME}
+ external: true
+ config:
+ name: ${_CONFIG_VOLUME}
+ external: true
+
+networks:
+ net:
+ name: ${_NET}
+ external: true
+
+services:
+ srv:
+ container_name: ${_CONTAINER}
+ image: caddy:latest
+ restart: unless-stopped
+ env_file:
+ - .edge.env
+ - .env
+ networks:
+ - net
+ ports:
+ - 80:80
+ - 443:443
+ - 443:443/udp
+ volumes:
+ - ${_CADDYFILE:-./Caddyfile}:/etc/caddy/Caddyfile
+ - ${_WEBROOT:-.srv/}:/srv
+ - ${data:-.data/}:/data
+ - ${config:-.config/}:/config