Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Metabase on Google App Engine

I'm trying to set up Metabase on a gcloud engine using Google Cloud SQL (MySQL).

I've got it running using this git and this app.yaml:

runtime: custom
env: flex

# Metabase does not support horizontal scaling
#   https://github.com/metabase/metabase/issues/2754
#   https://cloud.google.com/appengine/docs/flexible/java/configuring-your-app-with-app-yaml
manual_scaling:
  instances: 1

env_variables:
 # MB_JETTY_PORT: 8080
  MB_DB_TYPE: mysql
  MB_DB_DBNAME: [db_name]
 # MB_DB_PORT: 5432
  MB_DB_USER: [db_user]
  MB_DB_PASS: [db_password]
 # MB_DB_HOST: 127.0.0.1
  CLOUD_SQL_INSTANCE: [project-id]:[location]:[instance-id]

I have 2 issues:

  1. The Metabase fails in connecting to the Cloud SQL - the Cloud SQL is part of the same project and App Engine is authorized.

  2. After I create my admin user in Metabase, I am only able to login for a few seconds (and only sometimes), but it keeps throwing me to either /setup or /auth/login saying the password doesn't match (when it does).

I hope someone can help - thank you!

like image 964
digital aloe Avatar asked Apr 11 '18 15:04

digital aloe


1 Answers

So, we just got metabase running in Google App Engine with a Cloud SQL instance running PostgreSQL and these are the steps we went through.

First, create a Dockerfile:

FROM gcr.io/google-appengine/openjdk:8

EXPOSE 8080

ENV JAVA_OPTS "-XX:+IgnoreUnrecognizedVMOptions -Dfile.encoding=UTF-8 --add-opens=java.base/java.net=ALL-UNNAMED --add-modules=java.xml.bind"
ENV JAVA_TOOL_OPTIONS "-Xmx1g"

ADD https://downloads.metabase.com/enterprise/v1.1.6/metabase.jar $APP_DESTINATION

We tried pushing the memory further down, but 1 GB seemed to be the sweet spot. On to the app.yaml:

runtime: custom
env: flex

manual_scaling:
  instances: 1

resources:
  cpu: 1
  memory_gb: 1
  disk_size_gb: 10

readiness_check:
  path: "/api/health"
  check_interval_sec: 5
  timeout_sec: 5
  failure_threshold: 2
  success_threshold: 2
  app_start_timeout_sec: 600

beta_settings:
  cloud_sql_instances: <Instance-Connection-Name>=tcp:5432

env_variables:
  MB_DB_DBNAME: 'metabase'
  MB_DB_TYPE: 'postgres'
  MB_DB_HOST: '172.17.0.1'
  MB_DB_PORT: '5432'
  MB_DB_USER: '<username>'
  MB_DB_PASS: '<password>'
  MB_JETTY_PORT: '8080'

Note the beta_settings field at the bottom, which handles what akilesh raj was doing manually. Also, the trailing =tcp:5432 is required, since metabase does not support unix sockets yet.

Relevant documentation can be found here.

like image 100
Paddie Avatar answered Nov 12 '22 02:11

Paddie