migrate
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<%- if tls_enabled and tls_email %>
|
||||
{
|
||||
email << tls_email >>
|
||||
}
|
||||
|
||||
<%- endif %>
|
||||
import /etc/caddy/config/*.caddy
|
||||
@@ -0,0 +1,47 @@
|
||||
services:
|
||||
<< service_name >>:
|
||||
image: docker.io/library/caddy:2.11.2-alpine
|
||||
restart: << restart_policy >>
|
||||
<%- if container_timezone %>
|
||||
environment:
|
||||
- TZ=<< container_timezone >>
|
||||
<%- endif %>
|
||||
ports:
|
||||
- "<< ports_http >>:80"
|
||||
- "<< ports_https >>:443"
|
||||
- "<< ports_https >>:443/udp"
|
||||
volumes:
|
||||
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
||||
- ./config:/etc/caddy/config:ro
|
||||
<%- if webserver_enabled %>
|
||||
<%- if webserver_content_type == 'mount' %>
|
||||
- << webserver_content_mount_path >>:/srv:ro
|
||||
<%- elif webserver_content_type == 'nfs' %>
|
||||
- caddy_site:/srv:ro
|
||||
<%- endif %>
|
||||
<%- endif %>
|
||||
- caddy_data:/data
|
||||
- caddy_config:/config
|
||||
networks:
|
||||
- << docker_network >>
|
||||
|
||||
networks:
|
||||
<< docker_network >>:
|
||||
<%- if docker_network_external %>
|
||||
external: true
|
||||
<%- else %>
|
||||
driver: bridge
|
||||
name: << docker_network >>
|
||||
<%- endif %>
|
||||
|
||||
volumes:
|
||||
<%- if webserver_enabled and webserver_content_type == 'nfs' %>
|
||||
caddy_site:
|
||||
driver: local
|
||||
driver_opts:
|
||||
type: nfs
|
||||
o: addr=<< webserver_content_nfs_server >>,nfsvers=4,<< webserver_content_nfs_options >>
|
||||
device: ":<< webserver_content_nfs_path >>"
|
||||
<%- endif %>
|
||||
caddy_data:
|
||||
caddy_config:
|
||||
@@ -0,0 +1,25 @@
|
||||
<%- if webserver_enabled %>
|
||||
<< webserver_domain >> {
|
||||
root * /srv
|
||||
file_server
|
||||
<%- if webserver_custom_config_content %>
|
||||
<%- for line in webserver_custom_config_content.split('\n') %>
|
||||
<< line >>
|
||||
<%- endfor %>
|
||||
<%- endif %>
|
||||
}
|
||||
<%- endif %>
|
||||
|
||||
<%- if reverse_proxy_enabled %>
|
||||
<< reverse_proxy_domain >> {
|
||||
<%- if reverse_proxy_custom_config_content %>
|
||||
reverse_proxy << reverse_proxy_upstream >> {
|
||||
<%- for line in reverse_proxy_custom_config_content.split('\n') %>
|
||||
<< line >>
|
||||
<%- endfor %>
|
||||
}
|
||||
<%- else %>
|
||||
reverse_proxy << reverse_proxy_upstream >>
|
||||
<%- endif %>
|
||||
}
|
||||
<%- endif %>
|
||||
@@ -0,0 +1,319 @@
|
||||
{
|
||||
"slug": "caddy",
|
||||
"kind": "compose",
|
||||
"metadata": {
|
||||
"name": "Caddy",
|
||||
"description": "Modern web server and reverse proxy with automatic HTTPS, modular Caddyfile config, and simple presets for static sites or upstream proxying.",
|
||||
"tags": [
|
||||
"reverse-proxy",
|
||||
"web-server",
|
||||
"tls"
|
||||
],
|
||||
"icon": {
|
||||
"provider": "selfhst",
|
||||
"id": "caddy",
|
||||
"color": "emerald"
|
||||
},
|
||||
"draft": false,
|
||||
"version": {
|
||||
"name": "2.11.2-alpine",
|
||||
"source_dep_name": "docker.io/library/caddy",
|
||||
"source_dep_version": "2.11.2-alpine"
|
||||
}
|
||||
},
|
||||
"variables": [
|
||||
{
|
||||
"name": "general",
|
||||
"title": "General",
|
||||
"description": "Basic container naming and lifecycle settings.",
|
||||
"items": [
|
||||
{
|
||||
"name": "service_name",
|
||||
"type": "str",
|
||||
"title": "Service Name",
|
||||
"required": false,
|
||||
"default": "caddy",
|
||||
"description": "Compose service name for the Caddy container.",
|
||||
"config": {
|
||||
"placeholder": "caddy"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "restart_policy",
|
||||
"type": "enum",
|
||||
"title": "Restart Policy",
|
||||
"required": true,
|
||||
"default": "unless-stopped",
|
||||
"description": "Restart policy applied to the container.",
|
||||
"config": {
|
||||
"options": [
|
||||
"unless-stopped",
|
||||
"always",
|
||||
"on-failure",
|
||||
"no"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "container_timezone",
|
||||
"type": "str",
|
||||
"title": "Container Timezone",
|
||||
"required": false,
|
||||
"description": "Optional timezone passed through as the `TZ` environment variable.",
|
||||
"config": {
|
||||
"placeholder": "UTC"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "network",
|
||||
"title": "Network",
|
||||
"description": "Port publishing and Docker network attachment.",
|
||||
"items": [
|
||||
{
|
||||
"name": "ports_http",
|
||||
"type": "int",
|
||||
"title": "HTTP Port",
|
||||
"required": true,
|
||||
"default": 80,
|
||||
"description": "Host port published for HTTP traffic on container port 80.",
|
||||
"config": {
|
||||
"placeholder": "80"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ports_https",
|
||||
"type": "int",
|
||||
"title": "HTTPS Port",
|
||||
"required": true,
|
||||
"default": 443,
|
||||
"description": "Host port published for HTTPS traffic on container port 443.",
|
||||
"config": {
|
||||
"placeholder": "443"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "docker_network",
|
||||
"type": "str",
|
||||
"title": "Docker Network",
|
||||
"required": true,
|
||||
"default": "caddy",
|
||||
"description": "Docker network that Caddy should join.",
|
||||
"config": {
|
||||
"placeholder": "caddy"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "docker_network_external",
|
||||
"type": "bool",
|
||||
"title": "External Network",
|
||||
"required": false,
|
||||
"default": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "tls",
|
||||
"title": "TLS",
|
||||
"description": "Optional global ACME metadata for Caddy.",
|
||||
"toggle": "tls_enabled",
|
||||
"items": [
|
||||
{
|
||||
"name": "tls_enabled",
|
||||
"type": "bool",
|
||||
"title": "TLS Settings",
|
||||
"required": false,
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "tls_email",
|
||||
"type": "str",
|
||||
"title": "ACME Email",
|
||||
"required": false,
|
||||
"description": "Email address used for ACME account registration.",
|
||||
"config": {
|
||||
"placeholder": "admin@example.com"
|
||||
},
|
||||
"needs": [
|
||||
"tls_enabled=true"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "webserver",
|
||||
"title": "Webserver",
|
||||
"description": "Optional generated static site config that serves files from `/srv`.",
|
||||
"toggle": "webserver_enabled",
|
||||
"items": [
|
||||
{
|
||||
"name": "webserver_enabled",
|
||||
"type": "bool",
|
||||
"title": "Static Webserver",
|
||||
"required": false,
|
||||
"default": false,
|
||||
"description": "Render a basic static site config into `config/webserver.caddy`."
|
||||
},
|
||||
{
|
||||
"name": "webserver_domain",
|
||||
"type": "str",
|
||||
"title": "Site Address",
|
||||
"required": true,
|
||||
"description": "Hostname or site address used by the generated static site config.",
|
||||
"config": {
|
||||
"placeholder": "example.com"
|
||||
},
|
||||
"needs": [
|
||||
"webserver_enabled=true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "webserver_content_type",
|
||||
"type": "enum",
|
||||
"title": "Site Content",
|
||||
"required": true,
|
||||
"default": "mount",
|
||||
"description": "Storage mode used for static site content mounted into `/srv`.",
|
||||
"config": {
|
||||
"options": [
|
||||
"mount",
|
||||
"nfs"
|
||||
]
|
||||
},
|
||||
"needs": [
|
||||
"webserver_enabled=true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "webserver_content_mount_path",
|
||||
"type": "str",
|
||||
"title": "Bind Mount Path",
|
||||
"required": true,
|
||||
"default": "./data",
|
||||
"description": "Host path used when site content is mounted directly from the filesystem.",
|
||||
"config": {
|
||||
"placeholder": "./data"
|
||||
},
|
||||
"needs": [
|
||||
"webserver_enabled=true",
|
||||
"webserver_content_type=mount"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "webserver_content_nfs_server",
|
||||
"type": "str",
|
||||
"title": "NFS Server",
|
||||
"required": true,
|
||||
"default": "192.0.2.1",
|
||||
"description": "Hostname or IP address of the NFS server that stores site content.",
|
||||
"config": {
|
||||
"placeholder": "192.0.2.1"
|
||||
},
|
||||
"needs": [
|
||||
"webserver_enabled=true",
|
||||
"webserver_content_type=nfs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "webserver_content_nfs_path",
|
||||
"type": "str",
|
||||
"title": "NFS Export Path",
|
||||
"required": true,
|
||||
"default": "/path/to/export",
|
||||
"config": {
|
||||
"placeholder": "/path/to/export"
|
||||
},
|
||||
"needs": [
|
||||
"webserver_enabled=true",
|
||||
"webserver_content_type=nfs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "webserver_content_nfs_options",
|
||||
"type": "str",
|
||||
"title": "NFS Mount Options",
|
||||
"required": true,
|
||||
"default": "rw,nolock,soft",
|
||||
"config": {
|
||||
"placeholder": "rw,nolock,soft"
|
||||
},
|
||||
"needs": [
|
||||
"webserver_enabled=true",
|
||||
"webserver_content_type=nfs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "webserver_custom_config_content",
|
||||
"type": "str",
|
||||
"title": "Custom Config Content",
|
||||
"required": false,
|
||||
"description": "Optional additional Caddyfile directives inserted into the generated webserver site block when not empty.",
|
||||
"config": {
|
||||
"placeholder": "encode zstd gzip",
|
||||
"textarea": true
|
||||
},
|
||||
"needs": [
|
||||
"webserver_enabled=true"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "reverse-proxy",
|
||||
"title": "Reverse Proxy",
|
||||
"description": "Optional generated reverse proxy config for forwarding requests to an upstream service.",
|
||||
"toggle": "reverse_proxy_enabled",
|
||||
"items": [
|
||||
{
|
||||
"name": "reverse_proxy_enabled",
|
||||
"type": "bool",
|
||||
"title": "Reverse Proxy",
|
||||
"required": false,
|
||||
"default": false,
|
||||
"description": "Append a reverse proxy site block to `config/webserver.caddy`."
|
||||
},
|
||||
{
|
||||
"name": "reverse_proxy_domain",
|
||||
"type": "str",
|
||||
"title": "Site Address",
|
||||
"required": true,
|
||||
"description": "Hostname or site address used by the generated reverse proxy config.",
|
||||
"config": {
|
||||
"placeholder": "app.example.com"
|
||||
},
|
||||
"needs": [
|
||||
"reverse_proxy_enabled=true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "reverse_proxy_upstream",
|
||||
"type": "str",
|
||||
"title": "Upstream",
|
||||
"required": true,
|
||||
"description": "Upstream target used by the generated reverse proxy config, for example `app:3000`.",
|
||||
"config": {
|
||||
"placeholder": "app:3000"
|
||||
},
|
||||
"needs": [
|
||||
"reverse_proxy_enabled=true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "reverse_proxy_custom_config_content",
|
||||
"type": "str",
|
||||
"title": "Custom Config Content",
|
||||
"required": false,
|
||||
"description": "Optional additional `reverse_proxy` subdirectives inserted into the generated reverse proxy block when not empty.",
|
||||
"config": {
|
||||
"placeholder": "header_up X-Forwarded-Proto https",
|
||||
"textarea": true
|
||||
},
|
||||
"needs": [
|
||||
"reverse_proxy_enabled=true"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user