Initial setup based on custom-html
This commit is contained in:
commit
e8ec567f43
|
@ -0,0 +1,17 @@
|
|||
TYPE=custom-html
|
||||
|
||||
DOMAIN=custom-html.example.com
|
||||
## Domain aliases
|
||||
#EXTRA_DOMAINS=', `www.custom-html.example.com`'
|
||||
LETS_ENCRYPT_ENV=production
|
||||
|
||||
COMPOSE_FILE="compose.yml"
|
||||
|
||||
# Single Sign On via Traefik "file provider"
|
||||
#COMPOSE_FILE="$COMPOSE_FILE:compose.sso.yml"
|
||||
|
||||
# Git-pull regularly
|
||||
#COMPOSE_FILE="$COMPOSE_FILE:compose.git-pull.yml"
|
||||
#GIT_REPO_URL="https://git.coopcloud.tech/dalmationer/hexbomb.gay"
|
||||
#CRON_SCHEDULE="*/1 * * * *"
|
||||
#GIT_REPO_SUBDIR=""
|
|
@ -0,0 +1,36 @@
|
|||
# Custom HTML
|
||||
|
||||
Custom HTML website, served using thttpd
|
||||
|
||||
<!-- metadata -->
|
||||
* **Category**: Apps
|
||||
* **Status**: 1, pre-alpha
|
||||
* **Image**: [`thttpd`](https://hub.docker.com/r/dragas/thttpd), 1, 3rd party
|
||||
* **Healthcheck**: No
|
||||
* **Backups**: No
|
||||
* **Email**: N/A
|
||||
* **Tests**: 0
|
||||
* **SSO**: Yes
|
||||
<!-- endmetadata -->
|
||||
|
||||
## Basic usage
|
||||
|
||||
1. Set up Docker Swarm and [`abra`]
|
||||
2. Deploy [`coop-cloud/traefik`]
|
||||
3. `abra app new custom-html`
|
||||
4. `abra app YOURAPPDOMAIN config` - be sure to change `$DOMAIN` to something that resolves to
|
||||
your Docker swarm box
|
||||
5. `abra app YOURAPPDOMAIN deploy`
|
||||
6. Copy your files to the container, using something like
|
||||
```
|
||||
abra app YOURAPPDOMAIN cp index.html app:/content
|
||||
```
|
||||
|
||||
[`abra`]: https://git.autonomic.zone/autonomic-cooperative/abra
|
||||
[`coop-cloud/traefik`]: https://git.autonomic.zone/coop-cloud/traefik
|
||||
|
||||
## Git Based Usage
|
||||
|
||||
1. Set up as above except for step 6.
|
||||
2. Deploy `swarm-cronjob` to the host
|
||||
2. `abra app config`, Uncomment Git lines in configuration, and set variables as appropriate.
|
|
@ -0,0 +1,27 @@
|
|||
version: "3.8"
|
||||
services:
|
||||
git:
|
||||
environment:
|
||||
- GIT_REPO_URL
|
||||
- GIT_REPO_SUBDIR
|
||||
image: alpine/git:v2.32.0
|
||||
entrypoint: /docker-entrypoint.sh
|
||||
volumes:
|
||||
- content:/git/${GIT_REPO_SUBDIR}
|
||||
configs:
|
||||
- source: entrypoint_conf
|
||||
target: /docker-entrypoint.sh
|
||||
mode: 0555
|
||||
deploy:
|
||||
mode: replicated
|
||||
replicas: 0
|
||||
labels:
|
||||
- "swarm.cronjob.enable=true"
|
||||
- "swarm.cronjob.schedule=${CRON_SCHEDULE:-*/5 * * * *}"
|
||||
restart_policy:
|
||||
condition: none
|
||||
|
||||
configs:
|
||||
entrypoint_conf:
|
||||
name: ${STACK_NAME}_entrypoint_conf_${ENTRYPOINT_CONF_VERSION}
|
||||
file: entrypoint.git-pull.sh
|
|
@ -0,0 +1,8 @@
|
|||
version: "3.8"
|
||||
services:
|
||||
app:
|
||||
environment:
|
||||
- TFA_MIDDLEWARE_NAME
|
||||
deploy:
|
||||
labels:
|
||||
- "traefik.http.routers.${STACK_NAME}.middlewares=${TFA_MIDDLEWARE_NAME}@file"
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
app:
|
||||
image: dragas/thttpd
|
||||
networks:
|
||||
- proxy
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
|
||||
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
|
||||
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
||||
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
||||
# Redirect from EXTRA_DOMAINS to DOMAIN
|
||||
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
|
||||
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"
|
||||
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
|
||||
- "coop-cloud.${STACK_NAME}.version=1.2.1+1.21.6"
|
||||
environment:
|
||||
volumes:
|
||||
- content:/var/www/http
|
||||
configs:
|
||||
#healthcheck:
|
||||
# test: ["CMD", "curl", "-f", "http://localhost"]
|
||||
# interval: 30s
|
||||
# timeout: 10s
|
||||
# retries: 10
|
||||
# start_period: 1m
|
||||
|
||||
volumes:
|
||||
content:
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
external: true
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ ! -d /git/.git ]; then
|
||||
echo "No repo found, emptying /git/ directory"
|
||||
rm -r /git/*
|
||||
echo "Cloning $GIT_REPO_URL into /git"
|
||||
git clone "$GIT_REPO_URL" /git
|
||||
else
|
||||
echo "Updating /git"
|
||||
git pull
|
||||
fi
|
Loading…
Reference in New Issue