diff --git a/deploy/docker-compose.web.yml b/deploy/docker-compose.web.yml index 246d48a7..fda5eeba 100644 --- a/deploy/docker-compose.web.yml +++ b/deploy/docker-compose.web.yml @@ -44,7 +44,7 @@ services: - "postgres" - "redis" labels: - nl.surfpol.tasks: "tasks" + com.data-scope.tasks: "tasks" environment: - PYTHONUNBUFFERED=1 - DJANGO_MODE=${DJANGO_MODE} diff --git a/deploy/server/nginx/templates/goodfashionfriend-com.conf.template b/deploy/server/nginx/templates/goodfashionfriend-com.conf.template index c9b9c382..68f23343 100644 --- a/deploy/server/nginx/templates/goodfashionfriend-com.conf.template +++ b/deploy/server/nginx/templates/goodfashionfriend-com.conf.template @@ -13,7 +13,11 @@ server { # DJANGO location =/ { - rewrite ^ /nl/gff$uri break; + rewrite ^/nl/gff$uri break; + include /etc/nginx/uwsgi-pass.conf; + } + location ~ ^/(en/|nl/)?app { + rewrite ^/nl/gff/ break; include /etc/nginx/uwsgi-pass.conf; } location / { diff --git a/deploy/tasks.py b/deploy/tasks.py index 5a3dc1f9..5b991fb8 100644 --- a/deploy/tasks.py +++ b/deploy/tasks.py @@ -2,6 +2,7 @@ A file with tasks that can be executed on nodes This file needs to be compatible with invoke 0.11.0 """ +import os from datetime import datetime from pprint import pprint from getpass import getpass @@ -36,7 +37,7 @@ def get_versions_by_mode(ctx): def get_new_versions(ctx): # Get the lastest local version of an image local_images = ctx.run("docker image ls", hide=True) - last_local_image = local_images.stdout.split("\n")[1] + last_local_image = next(image for image in local_images.stdout.split("\n") if image.startswith(REPOSITORY)) last_local_version_columns = last_local_image.split() last_local_version = last_local_version_columns[1] if len(last_local_version_columns) else None # List all versions of the images from the remote @@ -133,27 +134,32 @@ def deploy(ctx): @task() -def migrate(ctx, mode): +def migrate(ctx): versions = get_versions_by_mode(ctx) postgres_password = getpass("Postgres password:") print("Running migration with root database user through docker-compose run ...") ctx.run( f"RELEASE_VERSION={versions['prd']} " f"INVOKE_POSTGRES_CREDENTIALS=postgres:{postgres_password} " - f"docker-compose -f docker-compose.yml run --rm {mode} python manage.py migrate" + f"docker exec -it $(docker ps -q -f name=service_tasks) python manage.py migrate", + pty=True, + echo=True ) @task() -def run(ctx, mode): +def run(ctx): versions = get_versions_by_mode(ctx) - print(f"Starting a bash shell in a {mode} container through docker-compose run ...") + print(f"Starting a bash shell in a tasks container through docker-compose run ...") ctx.run( f"RELEASE_VERSION={versions['prd']} " - f"docker-compose -f docker-compose.yml run --rm {mode} bash" + f"docker exec -it $(docker ps -q -f name=service_tasks) bash", + pty=True, + echo=True ) + @task() def publish_scripts(ctx): ctx.run("gsutil rsync -rd -J deploy gs://ds-deploy/") @@ -189,7 +195,8 @@ def db_load(ctx, dump_file): ctx.run(f"cat {dump_file} | psql -h localhost -U postgres datascope") # Now we need to reset sequences to make sure that autoid fields act normally # For this we store the output of reset.sql into a tmp file - ctx.run("psql -h localhost -U postgres -Atq -f deploy/reset.sql -o tmp.sql datascope") + reset_file_path = os.path.join(os.path.dirname(__file__), "reset.sql") + ctx.run(f"psql -h localhost -U postgres -Atq -f {reset_file_path} -o tmp.sql datascope") # And then we execute that output ctx.run("psql -h localhost -U postgres -f tmp.sql datascope") ctx.run("rm tmp.sql") diff --git a/src/apps/static/apps/gff/images/fako.jpg b/src/apps/static/apps/gff/images/fako.jpg index cbcb2f22..4d66e83a 100644 Binary files a/src/apps/static/apps/gff/images/fako.jpg and b/src/apps/static/apps/gff/images/fako.jpg differ diff --git a/src/apps/static/apps/gff/images/fransje.jpg b/src/apps/static/apps/gff/images/fransje.jpg index f26c7e13..8ceaa773 100644 Binary files a/src/apps/static/apps/gff/images/fransje.jpg and b/src/apps/static/apps/gff/images/fransje.jpg differ diff --git a/src/apps/static/apps/gff/images/gaspard.jpg b/src/apps/static/apps/gff/images/gaspard.jpg index 5148ceda..8d8631da 100644 Binary files a/src/apps/static/apps/gff/images/gaspard.jpg and b/src/apps/static/apps/gff/images/gaspard.jpg differ diff --git a/src/apps/static/apps/gff/images/hans.jpg b/src/apps/static/apps/gff/images/hans.jpg index cd1f99e1..64729af4 100644 Binary files a/src/apps/static/apps/gff/images/hans.jpg and b/src/apps/static/apps/gff/images/hans.jpg differ diff --git a/src/datascope/settings_base.py b/src/datascope/settings_base.py index 68dea210..6672799a 100644 --- a/src/datascope/settings_base.py +++ b/src/datascope/settings_base.py @@ -3,6 +3,7 @@ import sentry_sdk from sentry_sdk.integrations.django import DjangoIntegration +from sentry_sdk.integrations.logging import LoggingIntegration, ignore_logger from datascope.configuration import environment from datascope.version import get_project_version @@ -387,9 +388,15 @@ # https://sentry.io if not DEBUG: + sentry_logging = LoggingIntegration( + level=logging.INFO, + event_level=logging.WARNING + ) sentry_sdk.init( dsn="https://407d0ac6dc4542c9a60fb299e32e464d@sentry.io/241870", - integrations=[DjangoIntegration()], + integrations=[DjangoIntegration(), sentry_logging], release=DATASCOPE_VERSION, server_name='data-scope.com' ) + # We kill all DisallowedHost logging, because it happens so frequently on GCloud that we can't do much about it + ignore_logger('django.security.DisallowedHost') diff --git a/src/package.json b/src/package.json index 4ee096f2..19f0367d 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "datascope", - "version": "0.18.3", + "version": "0.18.4", "data": { "digital-ocean": { "data/online_discourse/dumps": "online_discourse/dumps"