-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (58 loc) · 1.45 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/make
$(shell touch ${CURDIR}/password.env)
include password.env
export
# run services
.PHONY: deploy
deploy: build-wordpress
docker compose up -d
# stop all services
.PHONY: stop
stop:
docker compose down
# build custom wordpress image
.PHONY: build-wordpress
build-wordpress:
docker compose build wordpress
# build custom alpine image
.PHONY: build-alpine
build-alpine:
docker compose build alpine
# build all custom images
.PHONY: build
build:
docker compose build
# backup content of all docker volumes locally
.PHONY: backup
backup:
docker compose run alpine bash -c "./bin/backup-volumes"
# synchonize backups to server
PHONY: backup-and-rsync
backup-and-rsync: backup
./bin/rsync-to-server
# restore data from backup
.PHONY: restore-from-backup
restore-from-backup: stop
docker compose run alpine bash -c "./bin/restore-volumes ${BACKUP_DATE}"
# reset the docker environment
.PHONY: docker-reset
docker-reset:
docker rm -f $$(docker ps -a -q); \
docker rmi -f $$(docker images -q); \
docker volume rm $$(docker volume ls -q); \
docker system prune -f
# install cron jobs (schedule backup)
.PHONY: install-cron-jobs
install-cron-jobs:
./bin/install-cron-jobs
# configure ssh config and keys
.PHONY: configure-ssh
configure-ssh:
./bin/setup-ssh-keys
# set password
.PHONY: set-admin-password
set-admin-password:
./bin/create-password
# setup host for this project
.PHONY: setup
setup: configure-ssh install-cron-jobs set-admin-password