-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
72 lines (53 loc) · 2.07 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
.PHONY: all build_static get_latest_db restore_db backup_dev_db create_postgres drop_postgres connect_to_postgres create_database drop_database dbshell push_to_amch build_wheels build_image push_image migrate
CURRENT_VERSION = `cat CURRENT_VERSION`
all:
@echo "Current version: ${CURRENT_VERSION}"
build_static: # Build static javascript and css files.
yarn run gulp
get_latest_db:
scp clupea:/mnt/yandex.disk/backups/mysql/allmychanges/latest.sql.bz2 dumps/
RESTORE_DB = 'latest'
restore_db:
docker exec -ti mysql.allmychanges.com /dumps/restore.sh ${RESTORE_DB}
backup_dev_db:
docker exec mysql.allmychanges.com mysqldump -ppassword allmychanges > dumps/dev.sql
create_postgres:
# https://hub.docker.com/_/postgres/
# how to run psql
# $
docker exec -it postgres.allmychanges.com postgresadmin -ppassword create allmychanges
drop_postgres:
docker exec -it postgres.allmychanges.com postgresadmin -ppassword drop allmychanges
create_postgres
connect_to_postgres:
docker run -it --net amch --rm postgres \
sh -c 'exec psql -h postgres.allmychanges.com -p 5432 -U postgres'
create_database:
docker exec -it mysql.allmychanges.com mysqladmin -ppassword create allmychanges
drop_database:
docker exec -it mysql.allmychanges.com mysqladmin -ppassword drop allmychanges
create_database
dbshell:
docker exec -it mysql.allmychanges.com mysql -ppassword allmychanges
push_to_amch:
time pip2amch --tag allmychanges.com requirements/production.txt | amch push
build_wheels:
docker run --rm -v `pwd`:/wheels 40ants/wheel-builder --wheel-dir wheelhouse -r requirements/dev.txt
DEV_TAG = 'allmychanges.com:dev'
build_image:
docker build ./ -t ${DEV_TAG}
@echo "Built ${DEV_TAG}"
TAG = "registry.40ants.com:5000/allmychanges.com:${CURRENT_VERSION}"
push_image:
@echo "Using tag: ${TAG}"
docker build ./ -t ${TAG}
docker push ${TAG}
@echo "Pushed ${TAG}"
update_requirements:
pip-compile --annotate requirements.in
pip-compile --annotate requirements-dev.in
SERVER_PORT=80
run_server:
python ./manage.py runserver 0.0.0.0:${SERVER_PORT}
migrate:
python ./manage.py migrate