-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathMakefile
76 lines (61 loc) · 2.12 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
HOST ?= adsb-feeder.local
SSH_CONTROL=/tmp/adsb-setup-ssh-control-${HOST}
ssh-control:
# to avoid having to SSH every time,
# we make a SSH control port to use with rsync.
ssh -M -S "${SSH_CONTROL}" -fnNT root@$(HOST)
sync-and-update-nocontainer:
# sync relevant files and update
ssh -O check -S "${SSH_CONTROL}" root@$(HOST) || make ssh-control
# sync over changes from local repo
make sync-py-control
# restart webinterface
ssh -S "${SSH_CONTROL}" root@$(HOST) systemctl restart adsb-setup
sync-and-update:
# sync relevant files and update
ssh -O check -S "${SSH_CONTROL}" root@$(HOST) || make ssh-control
# stop webinterface
ssh -S "${SSH_CONTROL}" root@$(HOST) systemctl stop adsb-setup
# sync over changes from local repo
make sync-py-control
# update config
ssh -S "${SSH_CONTROL}" root@$(HOST) python3 /opt/adsb/adsb-setup/app.py --update-config || true
# docker pull / docker compose on the yml files
ssh -S "${SSH_CONTROL}" root@$(HOST) /opt/adsb/docker-update-adsb-im
# start webinterface back up
ssh -S "${SSH_CONTROL}" root@$(HOST) systemctl restart adsb-setup
sync-py-control:
# check if the SSH control port is open, if not, open it.
ssh -O check -S "${SSH_CONTROL}" root@$(HOST) || make ssh-control
rsync -av \
--delete --exclude="*.pyc" --progress \
-e "ssh -S ${SSH_CONTROL}" \
src/modules/adsb-feeder/filesystem/root/opt/adsb/adsb-setup/ \
root@$(HOST):/opt/adsb/adsb-setup/
rsync -av \
--exclude="*.pyc" --progress \
-e "ssh -S ${SSH_CONTROL}" \
src/modules/adsb-feeder/filesystem/root/opt/adsb/ \
root@$(HOST):/opt/adsb/
mkdir -p src/modules/adsb-feeder/filesystem/root/usr/bin
rsync -av \
--exclude="*.pyc" --progress \
-e "ssh -S ${SSH_CONTROL}" \
src/modules/adsb-feeder/filesystem/root/usr/bin/ \
root@$(HOST):/usr/bin/
rsync -av \
--exclude="*.pyc" --progress \
-e "ssh -S ${SSH_CONTROL}" \
src/modules/adsb-feeder/filesystem/root/etc/ \
root@$(HOST):/etc/
# For good measure, copy this Makefile too
rsync -av \
-e "ssh -S ${SSH_CONTROL}" \
Makefile \
root@$(HOST):/opt/adsb/adsb-setup/Makefile
run-loop:
# python3 app.py in a loop
while true; do \
python3 app.py; \
sleep 1; \
done