Automation and setup for sites I own.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- TF:=terraform
- SSH:=ssh
- USER_SSH_OPTS:=
- SSH_OPTS:=-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $(USER_SSH_OPTS)
- RUN_EPOCH:=$(shell date +%s)
-
- .PHONY: all
- all: up
-
- .PHONY: rebuild
- rebuild: down up
-
- .PHONY: up
- up:
- $(TF) apply -auto-approve
-
- .PHONY: down
- down:
- $(TF) destroy -auto-approve
-
- .PHONY: ssh
- ssh:
- $(SSH) $(SSH_OPTS) root@`$(TF) output ipv4`
-
- attic:
- install -dm755 $@
-
- .PHONY: backup
- backup: backup-history backup-ssl backup-gitea backup-syncthing
-
- .PHONY: backup-history
- backup-history: attic
- -$(SSH) $(SSH_OPTS) root@`$(TF) output ipv4` 'cat /root/.ash_history' > attic/.ash_history.$(RUN_EPOCH)
- [ -z attic/.ash_history.$(RUN_EPOCH) ] && rm attic/.ash_history.$(RUN_EPOCH) || ln -f attic/.ash_history.$(RUN_EPOCH) attic/.ash_history
-
- .PHONY: backup-gitea
- backup-gitea: attic
- $(SSH) $(SSH_OPTS) root@`$(TF) output ipv4` 'tar --exclude /var/lib/gitea/unix-domain-socket -cvJf - /var/lib/gitea /etc/gitea' > attic/gitea.txz.$(RUN_EPOCH)
- ln -f attic/gitea.txz.$(RUN_EPOCH) attic/gitea.txz
-
- .PHONY: backup-ssl
- backup-ssl: attic
- $(SSH) $(SSH_OPTS) root@`$(TF) output ipv4` 'tar cvJf - /etc/ssl/uacme' > attic/uacme.txz.$(RUN_EPOCH)
- ln -f attic/uacme.txz.$(RUN_EPOCH) attic/uacme.txz
-
- .PHONY: backup-syncthing
- backup-syncthing: attic
- $(SSH) $(SSH_OPTS) root@`$(TF) output ipv4` 'tar cvJf - /var/lib/syncthing' > attic/syncthing.txz.$(RUN_EPOCH)
- ln -f attic/syncthing.txz.$(RUN_EPOCH) attic/syncthing.txz
|