Skip to content

Commit

Permalink
Fix release
Browse files Browse the repository at this point in the history
  • Loading branch information
c-w committed Apr 29, 2020
1 parent 019611c commit 6d594d8
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 6 deletions.
25 changes: 25 additions & 0 deletions .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docker/client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker/client/run-gunicorn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions docker/docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions helm/opwen_cloudserver/templates/webapp-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions helm/opwen_cloudserver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ version:

server:
serverWorkers: 2
webappWorkers: 2

worker:
queueWorkers: 1
Expand Down
3 changes: 2 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 ( \
Expand Down
2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6d594d8

Please sign in to comment.