-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
72 lines (65 loc) · 2.17 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
# ==============================================================================
# Ubuntu 20.04 (LTS) x64.
#================ enable root ssh login
# sudo su root
# passwd root
# vim /etc/ssh/sshd_config
# ## change “PermitRootLogin” to “yes”
# service sshd restart
#================ install rsync ===ubuntu 20.04 includes
# apt-get install rsync
#.envrc contains all the variable
include .envrc
# ==============================================================================
#SSH to remote
# ssh -i C:\\Users\\defiance\\.ssh\\gc\\id_rsa [email protected]
# apt-get install rsync
.PHONY:ssh-root
ssh-root:
ssh -i ${SSHKEYLOCATION} root@${REMOTE_IP}
#upload all scripts and files to remote
.PHONY:deploy-all-script
deploy-all-script:
rsync -rP --delete ./remote/ -e "ssh -i ${SSHKEYLOCATION}" root@${REMOTE_IP}:/root/remote
#execute dockerdeploy.sh to install docker and docker-compose
.PHONY:deploy-setup
deploy-setup:
ssh -i ${SSHKEYLOCATION} -t root@${REMOTE_IP} '\
vim /root/remote/setup/dockerdeploy.sh +"set ff=unix" +wq \
chmod +x /root/remote/setup/dockerdeploy.sh \
&& bash /root/remote/setup/dockerdeploy.sh\
'
#run docker-compose
.PHONY:deploy-production
deploy-production:
ssh -i ${SSHKEYLOCATION} -t root@${REMOTE_IP} '\
cd /remote/production && docker-compose up -d \
'
#update containers
#delete old containers
#pull new containers
#run new containers
.PHONY:update-containers
update-containers:
ssh -i ${SSHKEYLOCATION} -t root@${REMOTE_IP} '\
vim /root/remote/setup/updatecontainers.sh +"set ff=unix" +wq \
chmod +x /root/remote/setup/updatecontainers.sh \
&& bash /root/remote/setup/updatecontainers.sh\
'
# ==============================================================================
# Building system
##backend Golang tidy
.PHONY:tidy
tidy:
(cd backend; go mod tidy)
(cd backend; go mod vendor)
## build-backend: build the Go backend binary and output to /bin/api
.PHONY: build-backend
build-backend:
@echo 'Building Go Binary...'
(cd backend/app; GOOS=linux GOARCH=amd64 go build -o=./bin/api . )
## build-frontend: build the React frontend
.PHONY: build-frontend
build-frontend:
@echo 'Building React File ...'
(cd frontend; cnpm install; npm run build)