From 242a45a92e6dadc59933a7d86393b98e3b8d36af Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Tue, 30 Mar 2021 22:30:11 +0300 Subject: [PATCH 1/4] deploy: change prod sub domain for live --- infoscreen/static/infoscreen/js/infoscreen_controllers.js | 3 ++- sikweb/settings.py | 2 +- stack-compose.yml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/infoscreen/static/infoscreen/js/infoscreen_controllers.js b/infoscreen/static/infoscreen/js/infoscreen_controllers.js index 4176671..7890587 100644 --- a/infoscreen/static/infoscreen/js/infoscreen_controllers.js +++ b/infoscreen/static/infoscreen/js/infoscreen_controllers.js @@ -56,7 +56,8 @@ app.filter('unsafe', function($sce) { app.controller('ABBController', function($scope, $http){ $scope.jobs = []; var min_date = moment().subtract(30,'days').format("YYYY-MM-DD%20HH:mm:ss"); - var url = "https://sahkoinsinoorikilta.fi/api/news.php"; + // TODO: FIX, we try to get rid of php, not depend on it! + var url = "https://old.sahkoinsinoorikilta.fi/api/news.php"; var params = "?type=11&lang=fi&title_search=ABB&min_date="+min_date $http.get(url+params).then(function(response){ $scope.jobs = _.filter(response.data, function(job){ diff --git a/sikweb/settings.py b/sikweb/settings.py index a845434..6ec495c 100644 --- a/sikweb/settings.py +++ b/sikweb/settings.py @@ -17,7 +17,7 @@ from sikweb.base import * DEBUG = os.getenv('DEBUG', False) == 'True' URL = os.getenv("HOST", "api.sahkoinsinoorikilta.fi") -FRONTEND_URL = os.getenv("FRONTEND_URL", "prod.sahkoinsinoorikilta.fi") +FRONTEND_URL = os.getenv("FRONTEND_URL", "sahkoinsinoorikilta.fi") ALLOWED_HOSTS = ["localhost", "127.0.0.1", FRONTEND_URL, URL] if DEBUG: ALLOWED_HOSTS = ["*"] diff --git a/stack-compose.yml b/stack-compose.yml index ca2e14b..ebd24ba 100644 --- a/stack-compose.yml +++ b/stack-compose.yml @@ -47,7 +47,7 @@ services: - DB_USER_FILE=/run/secrets/BACKEND_DB_USER - DB_PASSWD_FILE=/run/secrets/BACKEND_DB_PASSWD - HOST=api.sahkoinsinoorikilta.fi - - FRONTEND_URL=prod.sahkoinsinoorikilta.fi + - FRONTEND_URL=sahkoinsinoorikilta.fi - DB_HOST=db - DB_PORT=5432 - EMAIL_API_KEY_FILE=/run/secrets/BACKEND_EMAIL_API_KEY From 9a450ea44aeaa1f4db76961a4f39e737174d5705 Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Tue, 30 Mar 2021 23:21:47 +0300 Subject: [PATCH 2/4] restart policy unless-stopped --- stack-compose-dev.yml | 4 ++-- stack-compose.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stack-compose-dev.yml b/stack-compose-dev.yml index b02e055..1554640 100644 --- a/stack-compose-dev.yml +++ b/stack-compose-dev.yml @@ -5,7 +5,7 @@ services: deploy: replicas: 1 restart_policy: - condition: on-failure + condition: unless-stopped environment: - POSTGRES_PASSWORD=postgres ports: @@ -18,7 +18,7 @@ services: deploy: replicas: 1 restart_policy: - condition: on-failure + condition: unless-stopped update_config: order: start-first depends_on: diff --git a/stack-compose.yml b/stack-compose.yml index ebd24ba..b79bde6 100644 --- a/stack-compose.yml +++ b/stack-compose.yml @@ -5,7 +5,7 @@ services: deploy: replicas: 1 restart_policy: - condition: on-failure + condition: unless-stopped environment: - POSTGRES_USER_FILE=/run/secrets/BACKEND_DB_USER @@ -23,7 +23,7 @@ services: deploy: replicas: 1 restart_policy: - condition: on-failure + condition: unless-stopped update_config: order: start-first depends_on: From ba69f54465d04513c7431473c2d855945b20f885 Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Wed, 31 Mar 2021 00:02:26 +0300 Subject: [PATCH 3/4] Revert "restart policy unless-stopped" This reverts commit 9a450ea44aeaa1f4db76961a4f39e737174d5705. --- stack-compose-dev.yml | 4 ---- stack-compose.yml | 4 ---- 2 files changed, 8 deletions(-) diff --git a/stack-compose-dev.yml b/stack-compose-dev.yml index 1554640..4f86e37 100644 --- a/stack-compose-dev.yml +++ b/stack-compose-dev.yml @@ -4,8 +4,6 @@ services: image: postgres:12 deploy: replicas: 1 - restart_policy: - condition: unless-stopped environment: - POSTGRES_PASSWORD=postgres ports: @@ -17,8 +15,6 @@ services: image: registry.gitlab.com/sahkoinsinoorikilta/vtmk/web2.0-backend:latest deploy: replicas: 1 - restart_policy: - condition: unless-stopped update_config: order: start-first depends_on: diff --git a/stack-compose.yml b/stack-compose.yml index b79bde6..725585a 100644 --- a/stack-compose.yml +++ b/stack-compose.yml @@ -4,8 +4,6 @@ services: image: postgres:12 deploy: replicas: 1 - restart_policy: - condition: unless-stopped environment: - POSTGRES_USER_FILE=/run/secrets/BACKEND_DB_USER @@ -22,8 +20,6 @@ services: image: registry.gitlab.com/sahkoinsinoorikilta/vtmk/web2.0-backend:latest deploy: replicas: 1 - restart_policy: - condition: unless-stopped update_config: order: start-first depends_on: From 9fb9bd447abf2420d89a47884875c9b36d9fa526 Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Wed, 31 Mar 2021 19:52:47 +0300 Subject: [PATCH 4/4] remove throttling --- sikweb/base.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sikweb/base.py b/sikweb/base.py index 060f2c8..71ebf2d 100644 --- a/sikweb/base.py +++ b/sikweb/base.py @@ -187,14 +187,14 @@ REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework_jwt.authentication.JSONWebTokenAuthentication', ), - 'DEFAULT_THROTTLE_CLASSES': ( - 'members.throttles.BurstRateThrottle', - 'members.throttles.SustainedRateThrottle' - ), - 'DEFAULT_THROTTLE_RATES': { - 'burst': '60/min', - 'sustained': '1000/day' - }, + # 'DEFAULT_THROTTLE_CLASSES': ( + # 'members.throttles.BurstRateThrottle', + # 'members.throttles.SustainedRateThrottle' + # ), + # 'DEFAULT_THROTTLE_RATES': { + # 'burst': '60/min', + # 'sustained': '1000/day' + # }, 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination', 'PAGE_SIZE': 1000, 'DEFAULT_FILTER_BACKENDS': (