Adding domains to lb docker aliases for loopback.
This commit is contained in:
9
Makefile
9
Makefile
@@ -15,12 +15,11 @@ APP_MAKEFILES := $(shell if [ -d app/ ]; then find app/ -type f -name 'Makefile'
|
||||
# .dirstamp plus && $@ is like make magic to get this rule
|
||||
# to only run if the contents of all-apps changes
|
||||
app/.dirstamp: copy-apps.sh $(apps_config) $(ALL_APPS_FILES)
|
||||
|
||||
rm -Rf app/
|
||||
mkdir app/
|
||||
cp all-apps/app.service app/
|
||||
cp all-apps/restic-snapshot.service app/
|
||||
cp all-apps/docker-compose.yaml app/
|
||||
./make-top-level-docker-compose.sh $(apps_config) > app/docker-compose.yaml
|
||||
./copy-apps.sh $(apps_config) && touch $@
|
||||
|
||||
# # compose .env files
|
||||
@@ -29,9 +28,9 @@ app/.env: $(apps_config) $(COMPOSE_ENVS)
|
||||
find app/ -name ".compose-env" -exec cat > app/.env {} +
|
||||
|
||||
# Caddy / lb
|
||||
app/lb/lb.env: $(apps_config) app/.dirstamp make-caddyfile.sh
|
||||
app/lb/lb.env: $(apps_config) app/.dirstamp make-caddyfile-env.sh
|
||||
mkdir -p app/lb
|
||||
./make-caddyfile.sh $(apps_config) > $@
|
||||
./make-caddyfile-env.sh $(apps_config) > $@
|
||||
|
||||
app/lb/Caddyfile: $(apps_config) app/.dirstamp
|
||||
echo "(maintenance_intercept) {" > app/lb/Caddyfile-tmp
|
||||
@@ -103,7 +102,7 @@ archive:
|
||||
echo "(" > all-apps/root-napp.scm
|
||||
find all-apps/ -name "napp.scm" -exec cat >> all-apps/root-napp.scm {} +
|
||||
echo ")" >> all-apps/root-napp.scm
|
||||
tar -cf nassella-latest.tar all-apps cl.yaml init-restic.sh main.tf make-caddyfile.sh Makefile \
|
||||
tar -cf nassella-latest.tar all-apps cl.yaml init-restic.sh main.tf make-caddyfile-env.sh make-top-level-docker-compose.sh Makefile \
|
||||
make-generated.sh make-restic-generated.sh make-restic-password.sh restic-snapshots.sh copy-apps.sh restic-restore.sh restic-snapshot.sh \
|
||||
.terraform.lock.hcl
|
||||
cp nassella-latest.tar src/
|
||||
|
||||
@@ -37,6 +37,7 @@ services:
|
||||
- wordpress_db
|
||||
- wordpress_instance
|
||||
- wordpress_outbound
|
||||
- lb
|
||||
secrets:
|
||||
- wordpress_db_password
|
||||
|
||||
|
||||
32
all-apps/docker-compose.yaml → make-top-level-docker-compose.sh
Normal file → Executable file
32
all-apps/docker-compose.yaml → make-top-level-docker-compose.sh
Normal file → Executable file
@@ -1,28 +1,44 @@
|
||||
version: '3'
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
. $1 # source the apps.config file with then env vars
|
||||
|
||||
read -r -a APP_CONFIGS <<< "$APP_CONFIGS"
|
||||
|
||||
cat <<'EOF'
|
||||
services:
|
||||
lb:
|
||||
image: docker.io/caddy:2.11.4-alpine
|
||||
env_file:
|
||||
- ./lb/lb.env
|
||||
volumes:
|
||||
# - /app/lb:/etc/caddy
|
||||
- ./lb/:/etc/caddy
|
||||
- /nassella/lb/config:/config
|
||||
- /nassella/lb/data:/data
|
||||
- /app/maintenance:/maintenance
|
||||
networks:
|
||||
- lb
|
||||
lb:
|
||||
aliases:
|
||||
EOF
|
||||
|
||||
for config_string in ${APP_CONFIGS[@]}; do
|
||||
IFS=','
|
||||
read -r -a config <<< "$config_string"
|
||||
|
||||
subdomain=${config[1]}
|
||||
|
||||
echo " - $subdomain.$ROOT_DOMAIN"
|
||||
done
|
||||
|
||||
cat <<'EOF'
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "443:443"
|
||||
- "80:80"
|
||||
nginx:
|
||||
image: nginx
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- lb
|
||||
networks:
|
||||
lb:
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.30.0.0/16
|
||||
EOF
|
||||
Reference in New Issue
Block a user