-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
112 lines (96 loc) · 2.34 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
SHELL := /bin/bash
run:
docker-compose up -d
run-postgres:
mkdir -p mastodon/postgres/
docker-compose -f docker-compose-postgres.yml \
up \
-d
bash wait-for-db.sh
run-caddy:
docker-compose -f docker-compose-caddy.yml \
up
LETS_ENCRYPT_EMAIL ?= admin@localhost
SITE_ADDRESS ?= localhost
TLS_INTERNAL ?= TLS_INTERNAL=tls internal
config-mastodon:
@sed -e "s;example.com;$(SITE_ADDRESS);g" .env.sample | \
tee .env.production
config-caddy:
@sed -e "s;[email protected];$(LETS_ENCRYPT_EMAIL);g" .env.caddy.sample | \
sed -e "s;example.com;$(SITE_ADDRESS);g" | \
tee .env.caddy.production
@echo "" | tee -a .env.caddy.production
@echo "$(TLS_INTERNAL)" | tee -a .env.caddy.production
config-secrets:
export SECRET_KEY_BASE=$$(docker run \
--rm \
tootsuite/mastodon \
bundle \
exec \
rake \
secret); \
export OTP_SECRET=$$(docker run \
--rm \
tootsuite/mastodon \
bundle \
exec \
rake \
secret); \
export VAPID_SECRETS=$$(docker run \
--rm \
tootsuite/mastodon \
bundle \
exec \
rake \
mastodon:webpush:generate_vapid_key); \
echo "SECRET_KEY_BASE=$${SECRET_KEY_BASE}" | tee -a .env.production; \
echo "OTP_SECRET=$${OTP_SECRET}" | tee -a .env.production; \
echo "$${VAPID_SECRETS}" | tee -a .env.production;
config: config-caddy config-mastodon config-secrets
setup: config-caddy
echo '' > .env.production
docker-compose -f docker-compose.yml \
run \
--rm \
-v ${CURDIR}/.env.production:/opt/mastodon/.env.production \
web \
bundle \
exec \
rake \
mastodon:setup
setup-db:
docker-compose -f docker-compose.yml \
run \
--rm \
-v ${CURDIR}/.env.production:/opt/mastodon/.env.production \
web \
bundle \
exec \
rake \
db:setup
setup-admin:
@echo "URL: https://${SITE_ADDRESS}"
@echo "Username: me@${SITE_ADDRESS}"
@docker-compose -f docker-compose.yml \
run \
--rm \
-v ${CURDIR}/.env.production:/opt/mastodon/.env.production \
web \
bin/tootctl accounts create \
me \
--email me@${SITE_ADDRESS} \
--confirmed \
--role Owner
setup-admin-txt:
make -s setup-admin | tee admin.txt
rollback:
touch .env.production
touch .env.caddy.production
docker-compose -f docker-compose.yml \
down
rm -rf caddy/ || true
rm -rf mastodon/ || true
rm -rf .env.production || true
rm -rf .env.caddy.production || true
all: rollback run-postgres config setup-db setup-admin-txt run