|
| 1 | +.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 |
| 2 | + |
| 3 | +CURRENT_VERSION = `cat CURRENT_VERSION` |
| 4 | + |
| 5 | +all: |
| 6 | + @echo "Current version: ${CURRENT_VERSION}" |
| 7 | + |
| 8 | +build_static: # Build static javascript and css files. |
| 9 | + yarn run gulp |
| 10 | + |
| 11 | +get_latest_db: |
| 12 | + scp clupea:/mnt/yandex.disk/backups/mysql/allmychanges/latest.sql.bz2 dumps/ |
| 13 | + |
| 14 | +RESTORE_DB = 'latest' |
| 15 | +restore_db: |
| 16 | + docker exec -ti mysql.allmychanges.com /dumps/restore.sh ${RESTORE_DB} |
| 17 | + |
| 18 | +backup_dev_db: |
| 19 | + docker exec mysql.allmychanges.com mysqldump -ppassword allmychanges > dumps/dev.sql |
| 20 | + |
| 21 | +create_postgres: |
| 22 | + # https://hub.docker.com/_/postgres/ |
| 23 | + # how to run psql |
| 24 | + # $ |
| 25 | + docker exec -it postgres.allmychanges.com postgresadmin -ppassword create allmychanges |
| 26 | + |
| 27 | +drop_postgres: |
| 28 | + docker exec -it postgres.allmychanges.com postgresadmin -ppassword drop allmychanges |
| 29 | + create_postgres |
| 30 | + |
| 31 | +connect_to_postgres: |
| 32 | + docker run -it --net amch --rm postgres \ |
| 33 | + sh -c 'exec psql -h postgres.allmychanges.com -p 5432 -U postgres' |
| 34 | + |
| 35 | +create_database: |
| 36 | + docker exec -it mysql.allmychanges.com mysqladmin -ppassword create allmychanges |
| 37 | + |
| 38 | +drop_database: |
| 39 | + docker exec -it mysql.allmychanges.com mysqladmin -ppassword drop allmychanges |
| 40 | + create_database |
| 41 | + |
| 42 | +dbshell: |
| 43 | + docker exec -it mysql.allmychanges.com mysql -ppassword allmychanges |
| 44 | + |
| 45 | +push_to_amch: |
| 46 | + time pip2amch --tag allmychanges.com requirements/production.txt | amch push |
| 47 | + |
| 48 | +build_wheels: |
| 49 | + docker run --rm -v `pwd`:/wheels 40ants/wheel-builder --wheel-dir wheelhouse -r requirements/dev.txt |
| 50 | + |
| 51 | +DEV_TAG = 'allmychanges.com:dev' |
| 52 | +build_image: |
| 53 | + docker build ./ -t ${DEV_TAG} |
| 54 | + @echo "Built ${DEV_TAG}" |
| 55 | + |
| 56 | +TAG = "registry.40ants.com:5000/allmychanges.com:${CURRENT_VERSION}" |
| 57 | +push_image: |
| 58 | + @echo "Using tag: ${TAG}" |
| 59 | + docker build ./ -t ${TAG} |
| 60 | + docker push ${TAG} |
| 61 | + @echo "Pushed ${TAG}" |
| 62 | + |
| 63 | +update_requirements: |
| 64 | + pip-compile --annotate requirements.in |
| 65 | + pip-compile --annotate requirements-dev.in |
| 66 | + |
| 67 | +SERVER_PORT=80 |
| 68 | +run_server: |
| 69 | + python ./manage.py runserver 0.0.0.0:${SERVER_PORT} |
| 70 | + |
| 71 | +migrate: |
| 72 | + python ./manage.py migrate |
0 commit comments