Cara Deploy Redash di GCP

Berikut catatan deployment Redash dari referensi https://redash.io/help/open-source/setup#-Google-Compute-Engine

Buat image redash v8.0.0

gcloud compute images create "redash-8-0-0" \
  --source-uri gs://redash-images/redash.8.0.0-b32245-1.tar.gz \
  --project=project-name

Buat VM dengan image redash tersebut

gcloud compute instances create redash-vm \
  --machine-type=e2-medium \
  --zone=asia-southeast2-b \
  --image redash-8-0-0 \
  --project=project-name

Aktifkan SSL Redash

Login dengan ssh ke VM

gcloud compute ssh redash-vm --project=project-name
upstream redash {
    server redash:5000;
}

server {
    listen      80;
    #listen [::]:80;
    server_name redash.mydomain.com;

    location ^~ /ping {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;

        proxy_pass       http://redash;
    }

    location / {
        rewrite ^ https://$host$request_uri? permanent;
    }

    location ^~ /.well-known {
        allow all;
        root  /data/letsencrypt/;
    }
}

To renew the certificate in the future, you can use the following command:

$ docker run -t --rm -v /opt/redash/nginx/certs:/etc/letsencrypt \
                     -v /opt/redash/nginx/certs-data:/data/letsencrypt \
                     deliverous/certbot renew --webroot --webroot-path=/data/letsencrypt

$ docker-compose kill -s HUP nginx