inital setup

This commit is contained in:
2023-06-10 21:08:44 +02:00
parent 522b2ddf8b
commit f3b17e69ff
6 changed files with 59 additions and 0 deletions

5
.env.sample Normal file
View File

@@ -0,0 +1,5 @@
TAG=
APIPORT=
BASEDIR=
EXTRANET=
INTRANET=

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
files/
.env

34
docker-compose.yml Normal file
View File

@@ -0,0 +1,34 @@
# https://docs.docker.com/compose/compose-file/compose-file-v3/
---
version: "3.9"
services:
caddy:
image: caddy:${TAG:-alpine}
container_name: caddy
env_file: .env
restart: unless-stopped
deploy:
replicas: 1 # in swarm set min 2
placement:
max_replicas_per_node: 1
update_config:
parallelism: 1
delay: 10s
ports:
- 80:80
- 443:443
- ${APIPORT:-2019}:2019
volumes:
- ${BASEDIR:-./files}/conf:/etc/caddy/
- ${BASEDIR:-./files}/data/:/data
networks:
- frontend
- backend
networks:
frontend:
name: ${EXTRANET:-frontend}
external: true
backend:
name: ${INTRANET:-backend}
external: true

2
files/conf/Caddyfile Normal file
View File

@@ -0,0 +1,2 @@
import snippets/*
import pages/*

View File

@@ -0,0 +1,4 @@
http://example.com {
import auth "*"
respond "example.com here!"
}

12
files/conf/snippets/auth Normal file
View File

@@ -0,0 +1,12 @@
## generate pass hash (debian):
# sudo apt install apache2-utils
# htpasswd -bnBC 10 "" password | tr -d ':'
# user: test
# password: password
(auth) {
basicauth {args.0} {
test $2y$10$XSrHHXUlQZeRumAc9nl7QevDzKv9H5TXVtb6nxr0Gmrk6VogHWRVK
}
}