From cca60705098da449af4519f68611532e695f4c0f Mon Sep 17 00:00:00 2001 From: Caleb Jones Date: Mon, 15 Apr 2024 13:18:32 -0400 Subject: [PATCH] chore: some updates to get silk working --- .github/workflows/build-master.yml | 1 - .gitignore | 2 ++ docker/README.md | 2 +- docker/docker-compose.stack.yml | 7 ++++--- k8s/helm/values-staging.yaml | 1 + k8s/memcached/values.yaml | 11 +++++++++++ src/spacelaunchnow/settings/__init__.py | 2 +- 7 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 k8s/memcached/values.yaml diff --git a/.github/workflows/build-master.yml b/.github/workflows/build-master.yml index 61776ee4..d1258fdd 100644 --- a/.github/workflows/build-master.yml +++ b/.github/workflows/build-master.yml @@ -97,7 +97,6 @@ jobs: else helm upgrade $RELEASE_NAME k8s/helm/ --namespace=$DEPLOYMENT_NAMESPACE --values $VALUES kubectl rollout restart deploy $WEB_DEPLOYMENT --namespace=$DEPLOYMENT_NAMESPACE - kubectl rollout restart deploy $SERVICE_DEPLOYMENT --namespace=$DEPLOYMENT_NAMESPACE fi release: diff --git a/.gitignore b/.gitignore index 53cc986c..5eedc344 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ report/ *secret*.yaml dist/** .vscode/** +docker/*.backup +*.log \ No newline at end of file diff --git a/docker/README.md b/docker/README.md index ce524b49..fa0c5c3c 100644 --- a/docker/README.md +++ b/docker/README.md @@ -12,7 +12,7 @@ ### Restore Database **Example** -`docker exec -i sln_db pg_restore -U spacelaunchnow_prod_user -v -d spacelaunchnow_local < spacelaunchnow_2024.01.11-16.42.44.backup &> restore.log` +`docker exec -i sln_db pg_restore -U spacelaunchnow_prod_user -v -d sln_db < spacelaunchnow.backup &> restore.log` ## Run full stack locally Run `docker-compose -f docker-compose.stack.yml up -d --build` diff --git a/docker/docker-compose.stack.yml b/docker/docker-compose.stack.yml index a1f2a5c2..8c7ff0e6 100644 --- a/docker/docker-compose.stack.yml +++ b/docker/docker-compose.stack.yml @@ -3,12 +3,14 @@ version: '3' services: sln_db: container_name: sln_db - image: postgres:14-alpine + image: postgres:14.10 env_file: - .env sln_cache: container_name: sln_cache image: memcached + args: + - MEMCACHED_ENABLE_SASL=1 expose: - "11211" sln_web: @@ -20,8 +22,7 @@ services: - PRIVATE_PASSWORD=${POETRY_HTTP_BASIC_TSD_PASSWORD} image: space_launch_now_local command: > - bash -c "python manage.py migrate --noinput - && gunicorn --workers 1 --threads 2 --bind :8080 --log-level INFO spacelaunchnow.wsgi" + bash -c "gunicorn --workers 1 --threads 2 --bind :8080 --log-level INFO spacelaunchnow.wsgi" ports: - "8080:8080" env_file: diff --git a/k8s/helm/values-staging.yaml b/k8s/helm/values-staging.yaml index 10a76386..72fee48d 100644 --- a/k8s/helm/values-staging.yaml +++ b/k8s/helm/values-staging.yaml @@ -27,6 +27,7 @@ env: SLN_ENVIRONMENT: "staging" ENABLE_SILKY: "True" SILKY_INTERCEPT_PERCENT: "100" + SILKY_ANALYZE_QUERIES: "False" worker: IS_WEBSERVER: "False" diff --git a/k8s/memcached/values.yaml b/k8s/memcached/values.yaml new file mode 100644 index 00000000..dfb6b516 --- /dev/null +++ b/k8s/memcached/values.yaml @@ -0,0 +1,11 @@ +resources: + requests: + cpu: 10m + memory: 75Mi + limits: + cpu: 25m + memory: 500Mi + +args: + - /run.sh + - -I 100m \ No newline at end of file diff --git a/src/spacelaunchnow/settings/__init__.py b/src/spacelaunchnow/settings/__init__.py index 8f3be2fe..60a00ad9 100644 --- a/src/spacelaunchnow/settings/__init__.py +++ b/src/spacelaunchnow/settings/__init__.py @@ -422,4 +422,4 @@ def get_user_permissions(user): SILKY_AUTHORISATION = True # User must have permissions SILKY_PERMISSIONS = get_user_permissions SILKY_INTERCEPT_PERCENT = env.int("SILKY_INTERCEPT_PERCENT", 50) - SILKY_ANALYZE_QUERIES = env.bool("SILKY_ANALYZE_QUERIES", True) + SILKY_ANALYZE_QUERIES = env.bool("SILKY_ANALYZE_QUERIES", False)