Move Makefile versions to variables
Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -1,5 +1,15 @@
|
|||||||
.PHONY: clean-pyc clean-build
|
.PHONY: clean-pyc clean-build
|
||||||
|
|
||||||
|
DOCKER_MYSQL_IMAGE = mysql:8.0
|
||||||
|
DOCKER_ORACLE_IMAGE = wnameless/oracle-xe-11g
|
||||||
|
DOCKER_POSTGRES_IMAGE = postgres:9.6-alpine
|
||||||
|
DOCKER_REDIS_IMAGE = redis:5.0-alpine
|
||||||
|
|
||||||
|
PYTHON_MYSQL_VERSION = 1.4.4
|
||||||
|
PYTHON_PSYCOPG2_VERSION = 2.8.3
|
||||||
|
PYTHON_RABBITMQ_VERSION = 2.0.0
|
||||||
|
PYTHON_REDIS_VERSION = 3.2.1
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "Usage: make <target>\n"
|
@echo "Usage: make <target>\n"
|
||||||
@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z_-]+:.*?## / { printf " * %-40s -%s\n", $$1, $$2 }' $(MAKEFILE_LIST)|sort
|
@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z_-]+:.*?## / { printf " * %-40s -%s\n", $$1, $$2 }' $(MAKEFILE_LIST)|sort
|
||||||
@@ -33,10 +43,10 @@ test-all: clean-pyc
|
|||||||
test-launch-postgres:
|
test-launch-postgres:
|
||||||
@docker rm -f test-postgres || true
|
@docker rm -f test-postgres || true
|
||||||
@docker volume rm test-postgres || true
|
@docker volume rm test-postgres || true
|
||||||
docker run -d --name test-postgres -p 5432:5432 -v test-postgres:/var/lib/postgresql/data healthcheck/postgres
|
docker run -d --name test-postgres -p 5432:5432 -v test-postgres:/var/lib/postgresql/data $(DOCKER_POSTGRES_IMAGE)
|
||||||
sudo apt-get install -q libpq-dev
|
sudo apt-get install -q libpq-dev
|
||||||
pip install psycopg2
|
pip install psycopg2==$(PYTHON_PSYCOPG2_VERSION)
|
||||||
while ! docker inspect --format='{{json .State.Health}}' test-postgres|grep 'Status":"healthy"'; do sleep 1; done
|
while ! nc -z 127.0.0.1 5432; do sleep 1; done
|
||||||
|
|
||||||
test-with-postgres: ## MODULE=<python module name> - Run tests for a single app, module or test class against a Postgres database container.
|
test-with-postgres: ## MODULE=<python module name> - Run tests for a single app, module or test class against a Postgres database container.
|
||||||
test-with-postgres: test-launch-postgres
|
test-with-postgres: test-launch-postgres
|
||||||
@@ -53,10 +63,10 @@ test-with-postgres-all: test-launch-postgres
|
|||||||
test-launch-mysql:
|
test-launch-mysql:
|
||||||
@docker rm -f test-mysql || true
|
@docker rm -f test-mysql || true
|
||||||
@docker volume rm test-mysql || true
|
@docker volume rm test-mysql || true
|
||||||
docker run -d --name test-mysql -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=True -e MYSQL_DATABASE=mayan -v test-mysql:/var/lib/mysql healthcheck/mysql
|
docker run -d --name test-mysql -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=True -e MYSQL_DATABASE=mayan -v test-mysql:/var/lib/mysql $(DOCKER_MYSQL_IMAGE)
|
||||||
sudo apt-get install -q libmysqlclient-dev mysql-client
|
sudo apt-get install -q libmysqlclient-dev mysql-client
|
||||||
pip install mysqlclient
|
pip install mysqlclient==$(PYTHON_MYSQL_VERSION)
|
||||||
while ! docker inspect --format='{{json .State.Health}}' test-mysql|grep 'Status":"healthy"'; do sleep 1; done
|
while ! nc -z 127.0.0.1 3306; do sleep 1; done
|
||||||
mysql -h 127.0.0.1 -P 3306 -uroot -e "set global character_set_server=utf8mb4;"
|
mysql -h 127.0.0.1 -P 3306 -uroot -e "set global character_set_server=utf8mb4;"
|
||||||
|
|
||||||
test-with-mysql: ## MODULE=<python module name> - Run tests for a single app, module or test class against a MySQL database container.
|
test-with-mysql: ## MODULE=<python module name> - Run tests for a single app, module or test class against a MySQL database container.
|
||||||
@@ -75,7 +85,7 @@ test-with-mysql-all: test-launch-mysql
|
|||||||
test-launch-oracle:
|
test-launch-oracle:
|
||||||
@docker rm -f test-oracle || true
|
@docker rm -f test-oracle || true
|
||||||
@docker volume rm test-oracle || true
|
@docker volume rm test-oracle || true
|
||||||
docker run -d --name test-oracle -p 49160:22 -p 49161:1521 -e ORACLE_ALLOW_REMOTE=true -v test-oracle:/u01/app/oracle wnameless/oracle-xe-11g
|
docker run -d --name test-oracle -p 49160:22 -p 49161:1521 -e ORACLE_ALLOW_REMOTE=true -v test-oracle:/u01/app/oracle $(DOCKER_ORACLE_IMAGE)
|
||||||
# https://gist.github.com/kimus/10012910
|
# https://gist.github.com/kimus/10012910
|
||||||
pip install cx_Oracle
|
pip install cx_Oracle
|
||||||
while ! nc -z 127.0.0.1 49161; do sleep 1; done
|
while ! nc -z 127.0.0.1 49161; do sleep 1; done
|
||||||
@@ -243,11 +253,12 @@ shell_plus: ## Run the shell_plus command.
|
|||||||
./manage.py shell_plus --settings=mayan.settings.development
|
./manage.py shell_plus --settings=mayan.settings.development
|
||||||
|
|
||||||
test-with-docker-services-on: ## Launch and initialize production-like services using Docker (Postgres and Redis).
|
test-with-docker-services-on: ## Launch and initialize production-like services using Docker (Postgres and Redis).
|
||||||
docker run -d --name redis -p 6379:6379 redis
|
docker run -d --name redis -p 6379:6379 $(DOCKER_REDIS_IMAGE)
|
||||||
docker run -d --name postgres -p 5432:5432 postgres
|
docker run -d --name postgres -p 5432:5432 $(DOCKER_POSTGRES_IMAGE)
|
||||||
while ! nc -z 127.0.0.1 6379; do sleep 1; done
|
while ! nc -z 127.0.0.1 6379; do sleep 1; done
|
||||||
while ! nc -z 127.0.0.1 5432; do sleep 1; done
|
while ! nc -z 127.0.0.1 5432; do sleep 1; done
|
||||||
sleep 4
|
sleep 4
|
||||||
|
pip install psycopg2==$(PYTHON_PSYCOPG2_VERSION) redis==$(PYTHON_REDIS_VERSION)
|
||||||
./manage.py initialsetup --settings=mayan.settings.staging.docker
|
./manage.py initialsetup --settings=mayan.settings.staging.docker
|
||||||
|
|
||||||
test-with-docker-services-off: ## Stop and delete the Docker production-like services.
|
test-with-docker-services-off: ## Stop and delete the Docker production-like services.
|
||||||
@@ -261,7 +272,7 @@ test-with-docker-worker: ## Launch a worker instance that uses the production-li
|
|||||||
DJANGO_SETTINGS_MODULE=mayan.settings.staging.docker ./manage.py celery worker -A mayan -B -l INFO -O fair
|
DJANGO_SETTINGS_MODULE=mayan.settings.staging.docker ./manage.py celery worker -A mayan -B -l INFO -O fair
|
||||||
|
|
||||||
docker-mysql-on: ## Launch and initialize a MySQL Docker container.
|
docker-mysql-on: ## Launch and initialize a MySQL Docker container.
|
||||||
docker run -d --name mysql -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=True -e MYSQL_DATABASE=mayan_edms mysql
|
docker run -d --name mysql -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=True -e MYSQL_DATABASE=mayan_edms $(DOCKER_MYSQL_IMAGE)
|
||||||
while ! nc -z 127.0.0.1 3306; do sleep 1; done
|
while ! nc -z 127.0.0.1 3306; do sleep 1; done
|
||||||
|
|
||||||
docker-mysql-off: ## Stop and delete the MySQL Docker container.
|
docker-mysql-off: ## Stop and delete the MySQL Docker container.
|
||||||
@@ -269,7 +280,7 @@ docker-mysql-off: ## Stop and delete the MySQL Docker container.
|
|||||||
docker rm mysql
|
docker rm mysql
|
||||||
|
|
||||||
docker-postgres-on: ## Launch and initialize a PostgreSQL Docker container.
|
docker-postgres-on: ## Launch and initialize a PostgreSQL Docker container.
|
||||||
docker run -d --name postgres -p 5432:5432 postgres
|
docker run -d --name postgres -p 5432:5432 $(DOCKER_POSTGRES_IMAGE)
|
||||||
while ! nc -z 127.0.0.1 5432; do sleep 1; done
|
while ! nc -z 127.0.0.1 5432; do sleep 1; done
|
||||||
|
|
||||||
docker-postgres-off: ## Stop and delete the PostgreSQL Docker container.
|
docker-postgres-off: ## Stop and delete the PostgreSQL Docker container.
|
||||||
|
|||||||
Reference in New Issue
Block a user