-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (71 loc) · 2.47 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
#TAG ?= $(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)
include docker-deploy/.env
generate-certs:
cd docker-deploy && \
docker compose down && \
docker compose up -d nginx-certbot && \
docker compose run --rm certbot certonly --webroot --webroot-path /var/www/certbot/ -d $(DOMAIN_URL)
renew-certs:
cd docker-deploy && \
docker compose run --rm certbot renew
set-auto-renewing-certs:
sudo apt-get update
sudo apt-get install cron
echo "----------------------------------------------------------------------------------------------" && \
echo "Now you must add this string-command in your crontab to auto executing it each 1 month. Command:" && \
echo "" && \
echo "0 0 1 * * cd $$(pwd) && make run renew-certs >> ./certbot-renew.log" && \
echo "" && \
echo "Copy that command and press [Enter]. Then add this string in end of opened file." && \
read ENTER
crontab -e
run:
cd docker-deploy && \
docker compose down && \
docker compose up -d nginx
build:
cd docker-deploy && \
docker compose build --no-cache --progress=plain nginx
update:
git fetch --all
git reset --hard origin/master
git log --oneline -1
cd docker-deploy && \
docker compose up -d nginx --build
echo "Frontend updated successfully"
setup-ci:
#id -u github &>/dev/null || sudo adduser github # Add user if not exists
#sudo chown -R github:legend .
#sudo -u github ssh-keygen
#sudo cat /home/github/.ssh/id_rsa.pub >> /home/github/.ssh/authorized_keys
#sudo chmod 777 -R /home/github/.ssh
#sudo chmod 666 /home/github/.ssh/authorized_keys
#sudo -u github ssh-keygen
#echo "" && \
# echo 'Add this politics for github user: [press Enter]' && \
# echo 'AllowUsers github' && \
# echo 'Match User github' && \
# echo 'PasswordAuthentication no' && \
# echo 'AllowTCPForwarding no' && \
# echo 'X11Forwarding no' && \
# echo '[press Enter...]' && \
# read ENTER
#nano /etc/ssh/sshd_config
#echo "" && \
# echo 'Add this public rsa key to Deploy keys in your github directory: ' && \
# sudo cat /home/github/.ssh/id_rsa.pub
ssh-keygen -f /tmp/tmp_key
sudo mkdir -p ~/.ssh
sudo cat /tmp/tmp_key.pub >> ~/.ssh/authorized_keys
echo '' && \
echo 'Add this private rsa key secret deploy variables to SSH_DEPLOY_KEY on your github repo: ' && \
echo '[press Enter...]' && \
read ENTER
sudo less /tmp/tmp_key
all:
cp --no-clobber ./docker-deploy/.env.example ./docker-deploy/.env
nano ./docker-deploy/.env
make generate-scripts
make set-auto-renewing-certs
make setup-ci
make update