Compare commits
2 Commits
134e12d272
...
1424d3f46f
| Author | SHA1 | Date | |
|---|---|---|---|
| 1424d3f46f | |||
| 5ad6f158b4 |
9
.gitignore
vendored
9
.gitignore
vendored
@@ -8,17 +8,16 @@ flatcar/flatcar_production_qemu_image.img.fresh
|
|||||||
|
|
||||||
ignition.json
|
ignition.json
|
||||||
|
|
||||||
production.tfvars
|
|
||||||
|
|
||||||
terraform.tfstate
|
terraform.tfstate
|
||||||
terraform.tfstate.backup
|
terraform.tfstate.backup
|
||||||
|
|
||||||
app
|
app
|
||||||
|
|
||||||
apps.config
|
config/apps.config
|
||||||
|
config/restic-env
|
||||||
restic-env
|
config/restic-password
|
||||||
restic-password
|
config/production.tfvars
|
||||||
|
|
||||||
# generated files
|
# generated files
|
||||||
all-apps/lb/Caddyfile
|
all-apps/lb/Caddyfile
|
||||||
|
|||||||
53
Makefile
53
Makefile
@@ -1,4 +1,7 @@
|
|||||||
TERRAFORM_ENV=production
|
TERRAFORM_ENV := production
|
||||||
|
|
||||||
|
config_dir := ./config/
|
||||||
|
apps_config := $(config_dir)apps.config
|
||||||
|
|
||||||
# .dirstamp plus && $@ is like make magic to get this rule
|
# .dirstamp plus && $@ is like make magic to get this rule
|
||||||
# to only run if the contents of all-apps changes
|
# to only run if the contents of all-apps changes
|
||||||
@@ -12,24 +15,24 @@ $(wildcard all-apps/dozzle/*)
|
|||||||
cp -a all-apps app && touch $@
|
cp -a all-apps app && touch $@
|
||||||
|
|
||||||
# Caddy / lb
|
# Caddy / lb
|
||||||
all-apps/lb/Caddyfile: apps.config make-caddyfile.sh
|
all-apps/lb/Caddyfile: $(apps_config) make-caddyfile.sh
|
||||||
./make-caddyfile.sh > all-apps/lb/Caddyfile
|
./make-caddyfile.sh $(apps_config) > all-apps/lb/Caddyfile
|
||||||
|
|
||||||
# Nextcloud
|
# Nextcloud
|
||||||
all-apps/nextcloud/nextcloud_admin_user: apps.config
|
all-apps/nextcloud/nextcloud_admin_user: $(apps_config)
|
||||||
bash -c 'source ./apps.config; printf "%s\n" "$$NEXTCLOUD_ADMIN_USER" > $@'
|
bash -c 'source $(apps_config); printf "%s\n" "$$NEXTCLOUD_ADMIN_USER" > $@'
|
||||||
all-apps/nextcloud/nextcloud_admin_password: apps.config
|
all-apps/nextcloud/nextcloud_admin_password: $(apps_config)
|
||||||
bash -c 'source ./apps.config; printf "%s\n" "$$NEXTCLOUD_ADMIN_PASSWORD" > $@'
|
bash -c 'source $(apps_config); printf "%s\n" "$$NEXTCLOUD_ADMIN_PASSWORD" > $@'
|
||||||
all-apps/nextcloud/postgres_db: apps.config
|
all-apps/nextcloud/postgres_db: $(apps_config)
|
||||||
bash -c 'source ./apps.config; printf "%s\n" "$$NEXTCLOUD_POSTGRES_DB" > $@'
|
bash -c 'source ./$(apps_config); printf "%s\n" "$$NEXTCLOUD_POSTGRES_DB" > $@'
|
||||||
all-apps/nextcloud/postgres_user: apps.config
|
all-apps/nextcloud/postgres_user: $(apps_config)
|
||||||
bash -c 'source ./apps.config; printf "%s\n" "$$NEXTCLOUD_POSTGRES_USER" > $@'
|
bash -c 'source ./$(apps_config); printf "%s\n" "$$NEXTCLOUD_POSTGRES_USER" > $@'
|
||||||
all-apps/nextcloud/postgres_password: apps.config
|
all-apps/nextcloud/postgres_password: $(apps_config)
|
||||||
bash -c 'source ./apps.config; printf "%s\n" "$$NEXTCLOUD_POSTGRES_PASSWORD" > $@'
|
bash -c 'source ./$(apps_config); printf "%s\n" "$$NEXTCLOUD_POSTGRES_PASSWORD" > $@'
|
||||||
all-apps/nextcloud/redis_password: apps.config
|
all-apps/nextcloud/redis_password: $(apps_config)
|
||||||
bash -c 'source ./apps.config; printf "%s\n" "$$NEXTCLOUD_REDIS_PASSWORD" > $@'
|
bash -c 'source ./$(apps_config); printf "%s\n" "$$NEXTCLOUD_REDIS_PASSWORD" > $@'
|
||||||
all-apps/nextcloud/nextcloud.env: apps.config make-nextcloud-env.sh
|
all-apps/nextcloud/nextcloud.env: $(apps_config) make-nextcloud-env.sh
|
||||||
./make-nextcloud-env.sh
|
./make-nextcloud-env.sh $(apps_config)
|
||||||
|
|
||||||
ignition.json: cl.yaml app/.dirstamp \
|
ignition.json: cl.yaml app/.dirstamp \
|
||||||
all-apps/lb/Caddyfile \
|
all-apps/lb/Caddyfile \
|
||||||
@@ -42,17 +45,17 @@ all-apps/nextcloud/redis_password \
|
|||||||
all-apps/nextcloud/nextcloud.env
|
all-apps/nextcloud/nextcloud.env
|
||||||
cat cl.yaml | docker run --rm --volume /home/tjhintz/.ssh/id_rsa.pub:/pwd/ssh-keys --volume ${PWD}:/pwd --workdir /pwd -i quay.io/coreos/butane:latest -d /pwd > ignition.json
|
cat cl.yaml | docker run --rm --volume /home/tjhintz/.ssh/id_rsa.pub:/pwd/ssh-keys --volume ${PWD}:/pwd --workdir /pwd -i quay.io/coreos/butane:latest -d /pwd > ignition.json
|
||||||
|
|
||||||
generated.tfvars: apps.config make-generated.sh
|
generated.tfvars: $(apps_config) make-generated.sh
|
||||||
./make-generated.sh > generated.tfvars
|
./make-generated.sh $(apps_config) > generated.tfvars
|
||||||
|
|
||||||
plan: ignition.json $(TERRAFORM_ENV).tfvars generated.tfvars
|
plan: ignition.json $(config_dir)$(TERRAFORM_ENV).tfvars generated.tfvars
|
||||||
bash -c "terraform plan -var-file=<(cat $(TERRAFORM_ENV).tfvars generated.tfvars)"
|
bash -c "terraform plan -var-file=<(cat $(config_dir)$(TERRAFORM_ENV).tfvars generated.tfvars)"
|
||||||
|
|
||||||
apply: ignition.json $(TERRAFORM_ENV).tfvars generated.tfvars
|
apply: ignition.json $(config_dir)$(TERRAFORM_ENV).tfvars generated.tfvars
|
||||||
bash -c "terraform apply -var-file=<(cat $(TERRAFORM_ENV).tfvars generated.tfvars)"
|
bash -c "terraform apply -var-file=<(cat $(config_dir)$(TERRAFORM_ENV).tfvars generated.tfvars)"
|
||||||
|
|
||||||
destroy: ignition.json $(TERRAFORM_ENV).tfvars generated.tfvars
|
destroy: ignition.json $(config_dir)$(TERRAFORM_ENV).tfvars generated.tfvars
|
||||||
bash -c "terraform destroy -var-file=<(cat $(TERRAFORM_ENV).tfvars generated.tfvars)"
|
bash -c "terraform destroy -var-file=<(cat $(config_dir)$(TERRAFORM_ENV).tfvars generated.tfvars)"
|
||||||
|
|
||||||
## to help me remember the command to run to test the config locally
|
## to help me remember the command to run to test the config locally
|
||||||
testlocalhost:
|
testlocalhost:
|
||||||
|
|||||||
4
cl.yaml
4
cl.yaml
@@ -88,10 +88,10 @@ storage:
|
|||||||
files:
|
files:
|
||||||
- path: /restic-password
|
- path: /restic-password
|
||||||
contents:
|
contents:
|
||||||
local: restic-password
|
local: config/restic-password
|
||||||
- path: /restic-env
|
- path: /restic-env
|
||||||
contents:
|
contents:
|
||||||
local: restic-env
|
local: config/restic-env
|
||||||
### docker-compose sysext
|
### docker-compose sysext
|
||||||
### https://flatcar.github.io/sysext-bakery/docker_compose/
|
### https://flatcar.github.io/sysext-bakery/docker_compose/
|
||||||
- path: /opt/extensions/docker-compose/docker-compose-2.34.0-x86-64.raw
|
- path: /opt/extensions/docker-compose/docker-compose-2.34.0-x86-64.raw
|
||||||
|
|||||||
@@ -13,9 +13,9 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
. apps.config
|
. $1 # source the apps.config file with then env vars
|
||||||
|
|
||||||
host_admin_password_encoded=`echo "$HOST_ADMIN_PASSWORD" | sudo docker run --rm -i caddy:2 caddy hash-password`
|
host_admin_password_encoded=`echo "$HOST_ADMIN_PASSWORD" | docker run --rm -i caddy:2 caddy hash-password`
|
||||||
|
|
||||||
|
|
||||||
read -r -a APP_CONFIGS <<< "$APP_CONFIGS"
|
read -r -a APP_CONFIGS <<< "$APP_CONFIGS"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
. apps.config
|
. $1 # source the apps.config file with then env vars
|
||||||
|
|
||||||
read -r -a APP_CONFIGS <<< "$APP_CONFIGS"
|
read -r -a APP_CONFIGS <<< "$APP_CONFIGS"
|
||||||
APP_CONFIGS+=('lb,root')
|
APP_CONFIGS+=('lb,root')
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
. apps.config
|
. $1 # source the apps.config file with then env vars
|
||||||
|
|
||||||
read -r -a APP_CONFIGS <<< "$APP_CONFIGS"
|
read -r -a APP_CONFIGS <<< "$APP_CONFIGS"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user