Skip to content

Commit

Permalink
Fixed docker env
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Metzener committed Nov 10, 2016
1 parent 17b6014 commit a61ab6a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 41 deletions.
67 changes: 26 additions & 41 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,61 +1,46 @@
FILE=tmp.prod.json
DJANGO_ADMIN_USER=admin
.DEFAULT_GOAL := help
PGPASSWORD=freedomvote

help:
@echo "The following make targets are available:"
@echo " * sass - Compile sass to css"
@echo " * sass-watch - Compile sass to css on changes"
@echo " * docker - Start the docker containers"
@echo " * docker-init - Initialize docker containers"
@echo " * docker-clean - Remove all docker containers"
@echo " * docker-migrate - Apply migrations to docker env"
@echo " * docker-makemessages - Generate .po locale files"
@echo " * docker-compilemessages - Generate .mo locale files"
@echo " * docker-pw - Change django admin pw"
@echo ""
@echo ""
@echo "If you're new to the project, run this to get started:"
@echo ""
@echo " make docker-init docker"
@echo ""
@echo "If you want to change any sass files run this command:"
@echo ""
@echo " make dev-env sass-watch"

sass:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort -k 1,1 | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

sass: ## Compile SASS to CSS
@gulp sass

sass-watch:
sass-watch: ## Compile SASS to CSS on every change
@gulp sass:watch

dev-env:
dev-env: ## Install the development requirements
@npm i

docker:
docker: ## Start the docker environment
@docker-compose up --no-recreate

docker-clean:
docker-clean: ## Remove the docker environment
@docker-compose kill
@docker-compose rm -f

docker-init:
@docker-compose up -d db
docker-init: ## Initialize the docker environment
@docker-compose up --no-recreate -d db
@sleep 5
@docker-compose run --rm -e PGPASSWORD=freedomvote web psql -h db -U postgres freedomvote < tools/docker/cache_table.sql
@docker-compose run --rm web app/manage.py migrate
@docker-compose run --rm web app/manage.py loaddata tools/docker/user.json
@docker-compose up --no-recreate -d web
@PGPASSWORD=$(PGPASSWORD) psql -h localhost -U postgres freedomvote < tools/docker/cache_table.sql
@make docker-migrate
@docker exec -it freedomvote_web_1 app/manage.py loaddata tools/docker/user.json
@docker-compose stop

docker-makemigrations:
@docker-compose run --rm web python app/manage.py makemigrations
docker-makemigrations: ## Generate django migrations in the docker environment
@docker exec -it freedomvote_web_1 python app/manage.py makemigrations

docker-migrate:
@docker-compose run --rm web python app/manage.py migrate
docker-migrate: ## Run django migrations in the docker environment
@docker exec -it freedomvote_web_1 python app/manage.py migrate

docker-makemessages:
@docker-compose run --rm web python app/manage.py makemessages -a
docker-makemessages: ## Generate django translations in the docker environment
@docker exec -it freedomvote_web_1 python app/manage.py makemessages -a

docker-compilemessages:
@docker-compose run --rm web python app/manage.py compilemessages
docker-compilemessages: ## Compile docker translations in the docker environment
@docker exec -it freedomvote_web_1 python app/manage.py compilemessages

docker-pw:
@docker-compose run --rm web python app/manage.py changepassword ${DJANGO_ADMIN_USER}
docker-pw: ## Change the django superuser password in the docker environment
@docker exec -it freedomvote_web_1 python app/manage.py changepassword ${DJANGO_ADMIN_USER}
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ pillow==3.1.0
psycopg2==2.6.1
easy-thumbnails==2.3
django-cms==3.2.0
html5lib==0.9999999
djangocms_text_ckeditor==2.8.1
django-piwik==0.1

0 comments on commit a61ab6a

Please sign in to comment.