forked from neomad-team/neomad.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (40 loc) · 1.5 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
goto_src=cd ~/$(env) && source ./venv/bin/activate
git_update=git fetch origin $(env) && git checkout $(env) && git reset --hard FETCH_HEAD
help:
@echo "Make tasks for deployment. Checkout the makefile content."
logs: # type=error|access
@${remote} "${goto_src} && tail -f ./log/${type}.log"
server_update: # env=prod|preprod
@make title text="Fetching prod branch and updating sources."
ssh neomad "${goto_src} && ${git_update}"
ssh neomad "${goto_src} && pip install -r requirements.txt"
server_reload: # env=prod|preprod
@make title text="Rebuilding the server."
ssh neomad "${goto_src} && pkill gunicorn; \
gunicorn -w 3 --daemon -b 127.0.0.1:5000 app \
--error-logfile ./log/error.log --access-logfile ./log/access.log"
prepare-deploy: # env=prod|preprod
git checkout $(env)
git fetch origin
git merge origin/master
git push origin $(env)
deploy: server_update server_reload # env=prod|preprod
backup_db:
# rsync -avz neomad:~/prod/data/db ./backups/prod-`(date +%s)`
ssh neomad "./scripts/dbbackup.sh"
rsync -avz neomad:scripts/dump/ ./backups/
install:
bash -c "bin/install.sh"
start:
bash -c "bin/start.sh"
title:
@echo "\n\033[92m>>> $(text)\033[0m"
install_files:
@make title text="Creating uploads dir"
mkdir -p static/uploads/avatars
chmod -R 777 static/uploads
@make title text="Creating your config file"
test -e settings.py || cp settings.example.py settings.py
fixtures:
@make title text="Inserting fixtures data"
bash -c "source ./venv/bin/activate && python3 bin/fixtures.py"