diff --git a/HISTORY.rst b/HISTORY.rst index 04ff3b1f47..02ac8c4995 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -27,6 +27,7 @@ Thanks to Ezio Vernacotola (@eziove) for the report and solution. - Fix MAYAN_GUNICORN_TIMEOUT Docker image setting. GitLab issue #671. Thanks to Lennart Sauerbeck (@lennart_s) for the report. +- Add makefile target to launch a production staging Docker image. 3.2.8 (2019-10-01) ================== diff --git a/docker/Makefile b/docker/Makefile index bd2743759b..10ac96a8ec 100755 --- a/docker/Makefile +++ b/docker/Makefile @@ -1,7 +1,7 @@ APT_PROXY ?= `/sbin/ip route|awk '/docker0/ { print $$9 }'`:3142 -IMAGE_VERSION ?= `cat docker/rootfs/version` CONSOLE_COLUMNS ?= `echo $$(tput cols)` CONSOLE_LINES ?= `echo $$(tput lines)` +IMAGE_VERSION ?= `cat docker/rootfs/version` docker-build: ## Build a new image locally. docker build -t mayanedms/mayanedms:$(IMAGE_VERSION) -f docker/Dockerfile . @@ -12,14 +12,70 @@ docker-build-with-proxy: ## Build a new image locally using an APT proxy as APT_ docker-shell: ## Launch a bash instance inside a running container. Pass the container name via DOCKER_CONTAINER. docker exec -e TERM=$(TERM) -e "COLUMNS=$(CONSOLE_COLUMNS)" -e "LINES=$(CONSOLE_LINES)" -it $(DOCKER_CONTAINER) /bin/bash -docker-test-container: ## Build and run a test container. -docker-test-container: docker-build-with-proxy docker-test-cleanup - docker run -d --name test-mayan-edms -p 80:8000 -v test-mayan_data:/var/lib/mayan mayanedms/mayanedms:$(DOCKER_VERSION) +docker-runtest-container: ## Run a test container. +docker-runtest-container: docker-test-cleanup + docker run -d \ + --name test-mayan-edms \ + -p 80:8000 \ + -v test-mayan_data:/var/lib/mayan \ + mayanedms/mayanedms:$(IMAGE_VERSION) -docker-test-cleanup: ## Delete the test container and the test volume. +docker-runtest-cleanup: ## Delete the test container and the test volume. @docker rm -f test-mayan-edms || true @docker volume rm test-mayan_data || true -docker-test-all: ## Build and executed the test suite in a test container. -docker-test-all: docker-build-with-proxy +docker-runtest-all: ## Executed the test suite in a test container. docker run --rm run-tests + +docker-staging-network-create: + @docker network rm mayan-staging || true + docker network create mayan-staging + +docker-staging-container-postgresql-start: + docker run -d \ + --name mayan-staging-postgres \ + --network=mayan-staging \ + -e POSTGRES_USER=mayan \ + -e POSTGRES_DB=mayan \ + -e POSTGRES_PASSWORD=mayanuserpass \ + -v mayan-staging-postgres:/var/lib/postgresql/data \ + postgres:9.6-alpine + +docker-staging-container-redis-start: + docker run -d \ + --name mayan-staging-redis \ + --network=mayan-staging \ + redis:5.0-alpine \ + redis-server \ + --databases \ + "2" \ + --maxmemory-policy \ + allkeys-lru \ + --save \ + "" + +docker-staging-container-mayan-start: + docker run -d \ + --name mayan-staging-app \ + --network=mayan-staging \ + -p 80:8000 \ + -e MAYAN_DATABASE_ENGINE=django.db.backends.postgresql \ + -e MAYAN_DATABASE_HOST=mayan-staging-postgres \ + -e MAYAN_DATABASE_NAME=mayan \ + -e MAYAN_DATABASE_PASSWORD=mayanuserpass \ + -e MAYAN_DATABASE_USER=mayan \ + -e MAYAN_BROKER_URL="redis://mayan-staging-redis:6379/0" \ + -e MAYAN_CELERY_RESULT_BACKEND="redis://mayan-staging-redis:6379/1" \ + -v mayan-staging-app:/var/lib/mayan \ + mayanedms/mayanedms:$(IMAGE_VERSION) + +docker-staging-start: docker-staging-network-create docker-staging-container-postgresql-start docker-staging-container-redis-start docker-staging-container-mayan-start + docker logs -f mayan-staging-app + +docker-staging-cleanup: ## Delete the test container and the test volume. + @docker rm -f mayan-staging-app || true + @docker rm -f mayan-staging-redis || true + @docker rm -f mayan-staging-postgres || true + @docker volume rm mayan-staging-app || true + @docker volume rm mayan-staging-postgres || true + @docker network rm mayan-staging || true