This repository has been archived by the owner on Feb 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Review#2 fix. Annotate commented string - Review#2 fix. Rm git install from dockerfile.dev - Fix forgotten env vars. Rm pdd task in favor of se#345 - Resurrect#1 gulp build - Launch tests #1 - Fix forgotten drone file - Review#1 fixes - Devops configs renew
- Loading branch information
Showing
26 changed files
with
411 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,99 @@ | ||
dc=docker-compose | ||
d=docker | ||
dcp=docker-compose -f docker-compose-production.yml | ||
dcb=$(dc) -f docker-compose-build.yml | ||
dcp=$(dc) -f docker-compose-production.yml | ||
|
||
.PHONY: migrate create-env build-static watch-static \ | ||
build test backup restore \ | ||
generate-production-static-data deploy | ||
|
||
|
||
# ---------------------- Dev section ---------------------- | ||
migrate: | ||
$(dc) exec stb-python python manage.py migrate | ||
|
||
# for local env | ||
static: | ||
@docker-compose run --rm stb-nodejs bash -c "\ | ||
npm install && \ | ||
npm install -g gulp-cli && \ | ||
gulp build" | ||
|
||
# for local env | ||
build: static | ||
$(dc) build stb-python | ||
|
||
# for local env | ||
test: static | ||
$(dc) up -d stb-selenium | ||
$(dc) exec stb-python python manage.py test --liveserver=stb-python:8001-8010 --parallel=8 | ||
$(dc) exec app python manage.py migrate | ||
|
||
fixtures: | ||
$(dc) run --rm app bash -c "\ | ||
python manage.py loaddata stroyprombeton/fixtures/admin.json \ | ||
&& python manage.py loaddata stroyprombeton/fixtures/dump.json \ | ||
" | ||
|
||
prices: | ||
$(dc) exec app python manage.py price | ||
|
||
create-env: | ||
@bash ./create-env.sh | ||
|
||
create-config: | ||
@bash ./create-config.sh | ||
|
||
build-static: | ||
$(dc) run --rm nodejs gulp build | ||
|
||
watch-static: | ||
$(dc) run --rm nodejs gulp watch | ||
|
||
collectstatic: | ||
$(dc) exec app python manage.py collectstatic --noinput | ||
|
||
test: build-static | ||
$(dc) up -d selenium | ||
$(dc) exec app python manage.py test --liveserver=app:8001-8009 --parallel | ||
$(dc) stop | ||
|
||
# for local env | ||
lint: | ||
$(dc) up -d stb-python | ||
$(d) run --rm --volumes-from stb-python --workdir=/usr/app/src -it coala/base coala | ||
$(dc) up -d app | ||
$(dc) run --rm lint | ||
$(dc) stop | ||
|
||
# for local env | ||
restore: | ||
@bash ../etc/stb-backup-restore.sh | ||
|
||
# for serv env | ||
deploy-dev: | ||
$(MAKE) create-env | ||
# uncomment in #167 | ||
# $(MAKE) create-config | ||
$(dc) pull | ||
$(dc) up -d app | ||
$(MAKE) build-static | ||
$(MAKE) migrate | ||
# Create admin user with login/pass: admin/asdfjkl; | ||
$(MAKE) fixtures | ||
# Launch "collectstatic" not in static recipe because ManifestStaticStorage writes to db | ||
$(MAKE) collectstatic | ||
# to make fresh collected static visible immediately | ||
$(dc) stop app && $(dc) up -d app | ||
|
||
|
||
# ---------------------- Production deploy section ---------------------- | ||
# @todo #142:60m Resurrect backup system. | ||
# Right now it's too dangerous and not used. | ||
backup: | ||
$(dcp) up stb-backup-data | ||
|
||
# start dev environment | ||
dev: build | ||
$(dc) up -d stb-python | ||
$(dc) exec stb-python python manage.py migrate | ||
# launch "collectstatic" not in static recipe because ManifestStaticStorage writes to db | ||
$(dc) exec stb-python python manage.py collectstatic --noinput | ||
$(dc) stop && $(dc) up -d # to make fresh collected static visible immediately | ||
|
||
# for serv env | ||
build-production: build | ||
$(dcp) build | ||
$(dcp) push | ||
|
||
deploy: backup | ||
$(dcp) run --rm backup-data sh /usr/bin/entrypoint.sh | ||
|
||
restore: | ||
@bash ../etc/backup/backup-restore.sh | ||
|
||
generate-production-static-data: | ||
$(dcp) exec app python manage.py price | ||
|
||
# drone should do this in working flow. | ||
# But if drone don't do this for some reasons, | ||
# you can run this recipe from local machine. | ||
prepare-deploy: | ||
rm -rf front/build | ||
$(dc) stop app && $(dcp) stop app | ||
$(dc) rm -f app && $(dcp) rm -f app | ||
$(MAKE) build-static | ||
$(dcb) build --no-cache python-dev python-prod | ||
$(dcb) push python-dev python-prod | ||
|
||
deploy: | ||
$(dcp) pull | ||
$(dcp) stop | ||
$(dcp) rm -f stb-source | ||
$(dcp) up -d | ||
$(dcp) exec stb-python python manage.py migrate | ||
# launch "collectstatic" not in build env, but on deploy. | ||
# Because ManifestStaticStorage writes to db | ||
$(dcp) exec stb-python python manage.py collectstatic --noinput | ||
$(dcp) stop && $(dcp) up -d # to make fresh collected static visible immediately | ||
# to flush nginx's inner static caches | ||
$(dcp) rm -f app nginx && $(dcp) up -d app nginx | ||
$(dcp) exec app python manage.py migrate | ||
$(MAKE) -j generate-production-static-data | ||
# Launch "collectstatic" not in static recipe because ManifestStaticStorage writes to db | ||
$(dcp) exec app python manage.py collectstatic --noinput | ||
# to make fresh collected static visible immediately | ||
$(dcp) stop && $(dcp) up -d |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.