diff --git a/.travis.sh b/.travis.sh index 55872b82..d54d86a7 100755 --- a/.travis.sh +++ b/.travis.sh @@ -14,14 +14,29 @@ fi case "$1" in after_failure) + if [[ -n "${TRAVIS_TAG}" ]]; then + echo "Skipping $1 for release" >&2 + exit 0 + fi + make logs ;; after_script) + if [[ -n "${TRAVIS_TAG}" ]]; then + echo "Skipping $1 for release" >&2 + exit 0 + fi + make clean-storage stop ;; after_success) + if [[ -n "${TRAVIS_TAG}" ]]; then + echo "Skipping $1 for release" >&2 + exit 0 + fi + if [[ "$TEST_MODE" = "local" ]]; then bash <(curl -s https://codecov.io/bash) fi @@ -43,10 +58,20 @@ case "$1" in ;; install) + if [[ -n "${TRAVIS_TAG}" ]]; then + echo "Skipping $1 for release" >&2 + exit 0 + fi + make build verify-build ;; script) + if [[ -n "${TRAVIS_TAG}" ]]; then + echo "Skipping $1 for release" >&2 + exit 0 + fi + if [[ "$TRAVIS_EVENT_TYPE" = "cron" ]]; then make renew-cert exit 0 diff --git a/docker-compose.yml b/docker-compose.yml index 993b7198..cee9b381 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -86,7 +86,7 @@ services: <<: *shared-app-environment OPWEN_EMAIL_SERVER_HOSTNAME: nginx:8888 WEBAPP_WORKERS: ${WEBAPP_WORKERS} - PORT: "8080" + WEBAPP_PORT: "8080" HOST: "0.0.0.0" depends_on: - azurite diff --git a/docker/client/Dockerfile b/docker/client/Dockerfile index 71e05eec..44ccb0fc 100644 --- a/docker/client/Dockerfile +++ b/docker/client/Dockerfile @@ -46,10 +46,10 @@ RUN sed -i "s|^__version__ = '[^']*'|__version__ = '${VERSION}'|g" opwen_email_c FROM python:${PYTHON_VERSION}-slim AS runtime # hadolint ignore=DL3010 -COPY --from=compiler /app/dist/pkg.tar.gz /app/pkg.tar.gz +COPY --from=compiler /app/dist/pkg.tar.gz /app/dist/pkg.tar.gz # hadolint ignore=DL3013 -RUN pip install --no-cache-dir "/app/pkg.tar.gz[opwen_email_server]" \ +RUN pip install --no-cache-dir "/app/dist/pkg.tar.gz[opwen_email_server]" \ && rm -rf /tmp/pip-ephem-wheel-cache* COPY --from=compiler /app/docker/client/run-gunicorn.sh /app/run-gunicorn.sh diff --git a/docker/client/run-gunicorn.sh b/docker/client/run-gunicorn.sh index c492558b..e46354e0 100755 --- a/docker/client/run-gunicorn.sh +++ b/docker/client/run-gunicorn.sh @@ -3,5 +3,5 @@ exec gunicorn \ --workers="${WEBAPP_WORKERS}" \ --log-level="${LOKOLE_LOG_LEVEL}" \ - --bind="0.0.0.0:${PORT}" \ + --bind="0.0.0.0:${WEBAPP_PORT}" \ opwen_email_client.webapp:app diff --git a/docker/docker-compose.prod.yml b/docker/docker-compose.prod.yml index 9763c694..59ec3cf7 100644 --- a/docker/docker-compose.prod.yml +++ b/docker/docker-compose.prod.yml @@ -4,12 +4,15 @@ x-shared-secret-environment: &shared-secret-environment environment: PORT: 8888 + HOST: 0.0.0.0 + WEBAPP_PORT: 8080 LOKOLE_STORAGE_PROVIDER: AZURE_BLOBS LOKOLE_QUEUE_BROKER_SCHEME: azureservicebus CONNEXION_SPEC: dir:/app/opwen_email_server/swagger CELERY_QUEUE_NAMES: all TESTING_UI: "False" LOKOLE_LOG_LEVEL: INFO + WEBAPP_WORKERS: 3 SERVER_WORKERS: 4 QUEUE_WORKERS: 5 env_file: diff --git a/helm/opwen_cloudserver/templates/webapp-deployment.yaml b/helm/opwen_cloudserver/templates/webapp-deployment.yaml index 1e9009a8..e11460cd 100644 --- a/helm/opwen_cloudserver/templates/webapp-deployment.yaml +++ b/helm/opwen_cloudserver/templates/webapp-deployment.yaml @@ -21,6 +21,12 @@ spec: - name: webapp image: {{.Values.version.imageRegistry}}/opwenwebapp:{{.Values.version.dockerTag}} env: + - name: HOST + value: "0.0.0.0" + - name: WEBAPP_PORT + value: "8080" + - name: WEBAPP_WORKERS + value: "{{.Values.server.webappWorkers}}" {{ include "opwen.environment.shared" . }} ports: - containerPort: 8080 diff --git a/helm/opwen_cloudserver/values.yaml b/helm/opwen_cloudserver/values.yaml index 34ed0367..8c04acbf 100644 --- a/helm/opwen_cloudserver/values.yaml +++ b/helm/opwen_cloudserver/values.yaml @@ -10,6 +10,7 @@ version: server: serverWorkers: 2 + webappWorkers: 2 worker: queueWorkers: 1 diff --git a/makefile b/makefile index 4e808a71..38f3c19a 100644 --- a/makefile +++ b/makefile @@ -122,6 +122,7 @@ verify-build: release-pypi: docker container create --name webapp "$(DOCKER_USERNAME)/opwenwebapp:$(DOCKER_TAG)" && \ docker cp "webapp:/app/dist" ./dist && \ + (mv ./dist/pkg.tar.gz "./dist/opwen_email_client-$(DOCKER_TAG).tar.gz" || true) && \ docker container rm webapp release-docker: @@ -176,7 +177,7 @@ deploy-pypi: docker-compose -f docker-compose.yml -f docker/docker-compose.setup.yml run --rm \ -v "$(PWD)/dist:/dist" \ setup \ - twine upload -u "$(PYPI_USERNAME)" -p "$(PYPI_PASSWORD)" /dist/* + twine upload --skip-existing -u "$(PYPI_USERNAME)" -p "$(PYPI_PASSWORD)" /dist/* deploy-docker: for tag in "latest" "$(DOCKER_TAG)"; do ( \ diff --git a/manage.py b/manage.py index 63865b5c..c119ac83 100644 --- a/manage.py +++ b/manage.py @@ -27,7 +27,7 @@ def devserver(): templates_glob = join(templates_directory, '**', '*.html') reload_server_if_changed = glob(templates_glob, recursive=True) - port = int(getenv('PORT', '5000')) + port = int(getenv('WEBAPP_PORT', '5000')) host = getenv('HOST', '127.0.0.1') app.run(debug=True, extra_files=reload_server_if_changed, host=host, port=port) # nosec