-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
62 lines (50 loc) · 1.97 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
REMOTE_URBIT_ROOT=/data/urbit
include ./config.mk
help:
echo "look at the README"
aws-infra-%: COMMAND=$*
aws-infra-%:
make -C aws-infra $(COMMAND)
aws-ship-%: COMMAND=$*
aws-ship-%:
make -C aws-ship $(COMMAND)
ssh-%: IP_ADDRESS=$(shell cd aws-ship && terraform output --json | jq -r '.ship.value.public_ip')
ssh-go:
ssh -i $(SSH_KEY_PATH) ubuntu@${IP_ADDRESS}
ssh-push-scripts:
scp -i $(SSH_KEY_PATH) -r aws-ship/rendered-scripts ubuntu@$(IP_ADDRESS):/home/ubuntu/
ssh-script-%: SCRIPT=$*
ssh-script-%:
ssh -i $(SSH_KEY_PATH) ubuntu@${IP_ADDRESS} 'cd ~/rendered-scripts/$(SHIP) && ./$(SCRIPT).sh'
push-ship: IP_ADDRESS=$(shell cd aws-ship && terraform output --json | jq -r '.ship.value.public_ip')
push-ship:
@if [ -z "$(SHIP)" ]; then echo 'need $$SHIP set' && exit 1; fi
@if [ -z "$(SSH_KEY_PATH)" ]; then echo 'need $$SSH_KEY_PATH set' && exit 1; fi
@if [ -z "$(IP_ADDRESS)" ]; then echo 'need $$IP_ADDRESS set' && exit 1; fi
scp -i $(SSH_KEY_PATH) -r ./ships/$(SHIP) ubuntu@$(IP_ADDRESS):$(REMOTE_URBIT_ROOT)
fetch-ship: IP_ADDRESS=$(shell cd aws-ship && terraform output --json | jq -r '.ship.value.public_ip')
fetch-ship:
@if [ -z "$(SHIP)" ]; then echo 'need $$SHIP set' && exit 1; fi
@if [ -z "$(SSH_KEY_PATH)" ]; then echo 'need $$SSH_KEY_PATH set' && exit 1; fi
@if [ -z "$(IP_ADDRESS)" ]; then echo 'need $$IP_ADDRESS set' && exit 1; fi
scp -i $(SSH_KEY_PATH) -r ubuntu@$(IP_ADDRESS):$(REMOTE_URBIT_ROOT)/$(SHIP) ./ships/
build:
$(MAKE) ssh-push-scripts
$(MAKE) ssh-script-start_urbit
$(MAKE) ssh-script-setup_nginx
$(MAKE) ssh-script-add_s3_uploads
all:
$(MAKE) aws-infra-terraform.tfvars
$(MAKE) aws-infra-init
$(MAKE) aws-infra-plan
$(MAKE) aws-infra-apply
$(MAKE) aws-ship-terraform.tfvars
$(MAKE) aws-ship-init
$(MAKE) aws-ship-plan
$(MAKE) aws-ship-apply
$(MAKE) ssh-push-scripts
$(MAKE) push-ship
$(MAKE) ssh-script-start_urbit
$(MAKE) ssh-script-setup_nginx
$(MAKE) ssh-script-add_s3_uploads
.PHONY: help aws-ship-% aws-infra-% %-ship ship-% build all