You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.4 KiB
Makefile

TERRAFORM_ENV=production
# .dirstamp plus && $@ is like make magic to get this rule
# to only run if the contents of all-apps changes
app/.dirstamp: all-apps/app.service all-apps/docker-compose.yaml $(wildcard all-apps/lb/*) $(wildcard all-apps/Nextcloud/*) $(wildcard all-apps/wg-easy/*)
rm -Rf app/
cp -a all-apps app && touch $@
all-apps/lb/Caddyfile: apps.config make-caddyfile.sh
./make-caddyfile.sh > all-apps/lb/Caddyfile
ignition.json: cl.yaml app/.dirstamp all-apps/lb/Caddyfile
cat cl.yaml | sudo 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
./make-generated.sh > generated.tfvars
plan: ignition.json $(TERRAFORM_ENV).tfvars generated.tfvars
bash -c "terraform plan -var-file=<(cat $(TERRAFORM_ENV).tfvars generated.tfvars)"
apply: ignition.json $(TERRAFORM_ENV).tfvars generated.tfvars
bash -c "terraform apply -var-file=<(cat $(TERRAFORM_ENV).tfvars generated.tfvars)"
## to help me remember the command to run to test the config locally
testlocalhost:
curl -k --resolve localhost:443:146.190.12.129 https://localhost
flatcarbuild: ignition.json
cp --reflink=auto flatcar/flatcar_production_qemu_image.img.fresh flatcar/flatcar_production_qemu_image.img
flatcarrun:
./flatcar/flatcar_production_qemu.sh -i ignition.json