From 133fe7462ccd0685504076592c11093115c6c1ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20W=C3=B6hrl?= Date: Sun, 19 Apr 2020 09:42:36 +0200 Subject: [PATCH 1/7] Added zone to compute engine commands --- scripts/superset_init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/superset_init.sh b/scripts/superset_init.sh index e55ce35..076d193 100755 --- a/scripts/superset_init.sh +++ b/scripts/superset_init.sh @@ -28,11 +28,11 @@ if ! gcloud compute instances list | grep ${ADMIN_INSTANCE_NAME}; then create_admin_instance fi -gcloud compute scp config/superset_config.py superset@${ADMIN_INSTANCE_NAME}: +gcloud compute scp config/superset_config.py --zone ${ZONE} superset@${ADMIN_INSTANCE_NAME}: run_superset_command flask fab create-admin run_superset_command superset db upgrade run_superset_command superset init run_superset_command superset load_examples -gcloud compute instances delete ${ADMIN_INSTANCE_NAME} -q +gcloud compute instances delete ${ADMIN_INSTANCE_NAME} -q --zone ${ZONE} From 4a6990512cc79ee3b257c7ab4d2feab2003b4e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20W=C3=B6hrl?= Date: Sun, 19 Apr 2020 10:01:06 +0200 Subject: [PATCH 2/7] Added gcloud app create command --- scripts/deploy.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 13d546c..af4ed96 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -10,8 +10,9 @@ run() { cat ../../requirements-db.txt >> requirements.txt cp ../../../config/app.yaml . cp ../../../config/superset_config.py . + gcloud app create --region=$REGION gcloud app deploy -q } rm -rf .staging && mkdir .staging -(cd .staging && run) \ No newline at end of file +(cd .staging && run) From 601ddf4798ad51b960d6315f637c163ef30ace2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20W=C3=B6hrl?= Date: Sun, 19 Apr 2020 10:02:09 +0200 Subject: [PATCH 3/7] Update Dockerfile to latest Superset version 0.36 --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3753b4c..97efa9f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ ARG NODE_VERSION=latest -ARG PYTHON_VERSION=3.7 +ARG PYTHON_VERSION=3.7 # # --- Build assets with NodeJS @@ -72,7 +72,7 @@ RUN apt-get update && \ libsasl2-modules-gssapi-mit \ libssl1.0 && \ apt-get clean && \ - tar xzf superset.tar.gz && \ + tar xzf superset.tar.gz && \ pip install dist/*.tar.gz -r requirements-db.txt -r requirements.txt # Create superset user From f2b8728b5c9f39711dfb7f3f665bb5ed061cbdfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20W=C3=B6hrl?= Date: Sun, 19 Apr 2020 10:24:27 +0200 Subject: [PATCH 4/7] Removed duplicate brackets around PROJECT_ID --- scripts/setup_bigquery.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup_bigquery.sh b/scripts/setup_bigquery.sh index 37ea988..0d638fb 100755 --- a/scripts/setup_bigquery.sh +++ b/scripts/setup_bigquery.sh @@ -4,6 +4,6 @@ gcloud projects add-iam-policy-binding ${PROJECT_ID} \ --member "serviceAccount:${PROJECT_ID}@appspot.gserviceaccount.com" \ --role "roles/bigquery.dataViewer" -gcloud projects add-iam-policy-binding ${${PROJECT_ID}} \ +gcloud projects add-iam-policy-binding ${PROJECT_ID} \ --member "serviceAccount:${PROJECT_ID}@appspot.gserviceaccount.com" \ --role "roles/bigquery.jobUser" From 3c322ec9b88717cfa584a9a28aa74dc658a1595e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20W=C3=B6hrl?= Date: Sun, 19 Apr 2020 10:29:41 +0200 Subject: [PATCH 5/7] Remarks on how to run the scripts --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 732e9ee..251a20f 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,9 @@ For a more detailed guide on how to deploy [Apache Superset (Incubating)](https://superset.incubator.apache.org/) on Google Cloud refere tho this [blog post](https://medium.com/@feroult/serverless-superset-on-google-cloud-87d3cf324845). +Two addtions to the blog post: + +- Source all scripts so newly set environment variables are available for the next script: +*source ./scripts/...* instead of *./scripts/..* + +- Run bigquery_setup as very last step, as the service account that has to be modified is not available before From dfbe56658588220dd6fbc493d0bba2be544b05bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20W=C3=B6hrl?= Date: Mon, 20 Apr 2020 08:37:18 +0200 Subject: [PATCH 6/7] Add cookie policies to make embeds work --- config/superset_config.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/superset_config.py b/config/superset_config.py index fe19a33..a2189e0 100644 --- a/config/superset_config.py +++ b/config/superset_config.py @@ -10,6 +10,11 @@ def randomString(stringLength=10): SECRET_KEY = 'my-app-secret-123' DATA_DIR = "/tmp/superset-" + randomString(20) +# Cookie policies +# https://github.com/apache/incubator-superset/issues/8382 +SESSION_COOKIE_SAMESITE = None +SESSION_COOKIE_HTTPONLY = False + # Mapbox MAPBOX_API_KEY = os.getenv('MAPBOX_API_KEY', '') From c8cf2a04b963a7a4e7de194c7afde9857d132788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20W=C3=B6hrl?= Date: Mon, 20 Apr 2020 09:09:11 +0200 Subject: [PATCH 7/7] Add a sane row limit 10000 rows freezes some clients --- config/superset_config.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/superset_config.py b/config/superset_config.py index a2189e0..c2721c9 100644 --- a/config/superset_config.py +++ b/config/superset_config.py @@ -15,6 +15,10 @@ def randomString(stringLength=10): SESSION_COOKIE_SAMESITE = None SESSION_COOKIE_HTTPONLY = False + +# Add a row limit +ROW_LIMIT = 5000 + # Mapbox MAPBOX_API_KEY = os.getenv('MAPBOX_API_KEY', '')