one-click-apps icon indicating copy to clipboard operation
one-click-apps copied to clipboard

Adding Supabase

Open ak4zh opened this issue 4 years ago • 15 comments
trafficstars

WIP: need testers

The app deploys correctly but I do not use supabase personally so have not tested everything, if anyone uses supabase please deploy it using the Template option inside one click apps in caprover and report the bugs if any.

☑️ Self Check before Merge

  • [ ] I have tested the template using the method described in README.md thoroughly
  • [x] I have ensured that I put as much default values as possible (except passwords) to ensure minimum effort required for end users to get started.
  • [x] I have ensured that I am not using the "latest" tag as this tag is dynamically changing and might break the one-click app. Use a fixed version.
  • [x] I have made sure that instructions.start and instructions.end are clear and self-explanatory.
  • [x] Icon is added as a png file to the logos directory.

ak4zh avatar Nov 05 '21 17:11 ak4zh

You added an extra indent space to the ports section that you add in this commit: a1e10368b17b77cedf505282abb655a41daee341.

jonkurtis avatar Nov 10 '21 05:11 jonkurtis

@Ak4zh I was able to deploy your template, but echo "wal_level = 'logical'" >> $PGDATA/pg_hba.conf did not work for me. I had to edit wal_level inside the postgresql.conf file located here: /var/lib/docker/volumes/captain--supabase-db-data/_data#

zlever01 avatar Dec 18 '21 04:12 zlever01

@zlever01 Great, are all services working correctly? I don't really use supabase so haven't tested everything.

Let me know if everything works correctly or if you have found any bugs.

ak4zh avatar Dec 18 '21 13:12 ak4zh

@Ak4zh All the services appear to be working individually, but I'm not able to connect to the API. I included supabase/studio when deploying your template. Not sure if that's where I went wrong but everything is working in Studio except for the API as well.

Here are the changes I made to include Supabase Studio:

captainVersion: 4
services:
  $$cap_appname-studio:
    image: supabase/studio:$$cap_studio_version
    restart: unless-stopped
    ports:
      - $$cap_studio_http_port:3000
    environment:
      SUPABASE_URL: http://srv-captain--supabase-kong:8000
      STUDIO_PG_META_URL: http://srv-captain--supabase-pg-meta:8080
      SUPABASE_ANON_KEY: $$cap_studio_anon_key
      SUPABASE_SERVICE_KEY: $$cap_studio_service_role_key
      POSTGRES_PASSWORD: $$cap_pg_pass
    caproverExtra:
      containerHttpPort: $$cap_studio_http_port
  $$cap_appname-kong:
    image: kong:$$cap_kong_version
    volumes:
      - $$cap_appname-kong-config:/var/lib/kong
    restart: unless-stopped
    ports:
      - $$cap_kong_http_port:8000
      - $$cap_kong_https_port:8443
      - $$cap_kong_admin_port:8001
      - $$cap_kong_admin_ssl_port:8444
    environment:
      KONG_DATABASE: $$cap_kong_database
      # https://github.com/supabase/cli/issues/14
      KONG_DNS_ORDER: $$cap_kong_dns_order
      KONG_PLUGINS: $$cap_kong_plugins
      KONG_ADMIN_LISTEN: 0.0.0.0:$$cap_kong_admin_port, 0.0.0.0:$$cap_kong_admin_ssl_port ssl
    caproverExtra:
      containerHttpPort: $$cap_kong_http_port
  $$cap_appname-auth:
    image: supabase/gotrue:$$cap_auth_version
    depends_on:
      - $$cap_appname-db
    restart: unless-stopped
    environment:
      GOTRUE_API_HOST: $$cap_gotrue_api_host
      GOTRUE_API_PORT: $$cap_gotrue_api_port
      GOTRUE_DB_DRIVER: postgres
      GOTRUE_DB_DATABASE_URL: postgres://$$cap_pg_user:$$cap_pg_pass@srv-captain--$$cap_appname-db:5432/$$cap_pg_db?sslmode=disable&search_path=auth
      GOTRUE_SITE_URL: $$cap_appname-auth.$$cap_root_domain
      GOTRUE_URI_ALLOW_LIST: $$cap_gotrue_uri_allow_list
      GOTRUE_DISABLE_SIGNUP: $$cap_gotrue_disable_signup
      GOTRUE_JWT_SECRET: $$cap_jwt_secret
      GOTRUE_JWT_EXP: $$cap_gotrue_jwt_expiry
      GOTRUE_JWT_DEFAULT_GROUP_NAME: $$cap_gotrue_jwt_default_group_name
      GOTRUE_EXTERNAL_EMAIL_ENABLED: $$cap_gotrue_external_email_enabled
      GOTRUE_MAILER_AUTOCONFIRM: $$cap_gotrue_mailer_autoconfirm
      GOTRUE_SMTP_ADMIN_EMAIL: $$cap_gotrue_smtp_admin_email
      GOTRUE_SMTP_HOST: $$cap_gotrue_smtp_host
      GOTRUE_SMTP_PORT: $$cap_gotrue_smtp_port
      GOTRUE_SMTP_USER: $$cap_gotrue_smtp_user
      GOTRUE_SMTP_PASS: $$cap_gotrue_smtp_pass
      GOTRUE_SMTP_SENDER_NAME: $$cap_gotrue_smtp_sender_name
      GOTRUE_MAILER_URLPATHS_INVITE: /auth/v1/verify
      GOTRUE_MAILER_URLPATHS_CONFIRMATION: /auth/v1/verify
      GOTRUE_MAILER_URLPATHS_RECOVERY: /auth/v1/verify
      GOTRUE_MAILER_URLPATHS_EMAIL_CHANGE: /auth/v1/verify
      GOTRUE_EXTERNAL_PHONE_ENABLED: $$cap_gotrue_enable_phone_signup
      GOTRUE_SMS_AUTOCONFIRM: $$cap_gotrue_sms_autoconfirm
    caproverExtra:
      containerHttpPort: $$cap_gotrue_api_port
  $$cap_appname-rest:
    image: postgrest/postgrest:$$cap_postgrest_version
    depends_on:
      - $$cap_appname-db
    restart: unless-stopped
    environment:
      PGRST_DB_URI: postgres://$$cap_pg_user:$$cap_pg_pass@srv-captain--$$cap_appname-db:5432/$$cap_pg_db
      PGRST_DB_SCHEMA: public, storage
      PGRST_DB_ANON_ROLE: anon
      PGRST_JWT_SECRET: $$cap_jwt_secret
    caproverExtra:
      containerHttpPort: 3000
  $$cap_appname-realtime:
    image: supabase/realtime:$$cap_realtime_version
    depends_on:
      - $$cap_appname-db
    restart: unless-stopped
    environment:
      DB_HOST: srv-captain--$$cap_appname-db
      DB_PORT: 5432
      DB_NAME: $$cap_pg_db
      DB_USER: $$cap_pg_user
      DB_PASSWORD: $$cap_pg_pass
      SLOT_NAME: supabase_realtime
      PORT: 4000
      SECURE_CHANNELS: 'true'
      JWT_SECRET: $$cap_jwt_secret
    caproverExtra:
      containerHttpPort: 4000
  $$cap_appname-storage:
    image: supabase/storage-api:$$cap_storage_version
    depends_on:
      - $$cap_appname-db
      - $$cap_appname-rest
    restart: unless-stopped
    volumes:
      - $$cap_appname-storage:/var/lib/storage
    environment:
      ANON_KEY: $$cap_storage_anon_key
      SERVICE_KEY: $$cap_storage_service_key
      POSTGREST_URL: srv-captain--$$cap_appname-rest
      PGRST_JWT_SECRET: $$cap_jwt_secret
      DATABASE_URL: postgres://$$cap_pg_user:$$cap_pg_pass@srv-captain--$$cap_appname-db:5432/$$cap_pg_db
      PGOPTIONS: -c search_path=storage
      FILE_SIZE_LIMIT: $$cap_storage_file_size_limit
      STORAGE_BACKEND: file
      FILE_STORAGE_BACKEND_PATH: /var/lib/storage
      # TODO: https://github.com/supabase/storage-api/commit/a836fc9666c2434d89ca4b31402f74772d50fb6d
      PROJECT_REF: stub
      # TODO: https://github.com/supabase/storage-api/issues/55
      REGION: stub
      GLOBAL_S3_BUCKET: stub
    caproverExtra:
      containerHttpPort: 5000
  $$cap_appname-pg-meta:
    image: supabase/postgres-meta:$$cap_pg_meta_version
    depends_on:
      - $$cap_appname-db
    restart: unless-stopped
    environment:
      PG_META_DB_NAME: $$cap_pg_db
      PG_META_DB_USER: $$cap_pg_user
      PG_META_DB_PASSWORD: $$cap_pg_pass
      PG_META_DB_PORT: 5432
      PG_META_DB_HOST: srv-captain--$$cap_appname-db
      PG_META_PORT: $$cap_pg_meta_port
    caproverExtra:
      containerHttpPort: $$cap_pg_meta_port
  $$cap_appname-db:
    # not using postgres image because supabase/postgres
    # has some additional initdb script
    image: supabase/postgres:$$cap_db_version
    volumes:
      - $$cap_appname-db-data:/var/lib/postgresql/data
      - $$cap_appname-db-init:/docker-entrypoint-initdb.d
    restart: unless-stopped
    environment:
      POSTGRES_USER: $$cap_pg_user
      POSTGRES_PASSWORD: $$cap_pg_pass
      POSTGRES_DB: $$cap_pg_db
      POSTGRES_INITDB_ARGS: $$cap_pg_initdb_args
    caproverExtra:
      notExposeAsWebApp: 'true'
caproverOneClickApp:
  variables:
    # shared env
    - id: $$cap_jwt_secret
      label: JWT secret
      defaultValue: $$cap_gen_random_hex(32)
      validRegex: /^([^\s^\/])+$/

    # studio variables
    - id: $$cap_studio_version
      label: Studio version
      defaultValue: 'latest'
      description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/studio/tags
      validRegex: /^([^\s^\/])+$/
    - id: $$cap_studio_http_port
      label: Studio HTTP port
      defaultValue: '3000'
      validRegex: /^\d+$/
    - id: $$cap_studio_anon_key
      label: Supabase Anon Key
      defaultValue: ''
      validRegex: /^([^\s^\/])+$/
    - id: $$cap_studio_service_role_key
      label: Supabase Sevice Key
      defaultValue: ''
      validRegex: /^([^\s^\/])+$/

    # kong variables
    - id: $$cap_kong_version
      label: Kong version
      defaultValue: '2.1'
      description: Check out their Docker page for the valid tags https://hub.docker.com/_/kong?tab=tags
      validRegex: /^([^\s^\/])+$/
    - id: $$cap_kong_http_port
      label: Kong HTTP port
      defaultValue: '8000'
      validRegex: /^\d+$/
    - id: $$cap_kong_https_port
      label: Kong HTTPS port
      defaultValue: '8443'
      validRegex: /^\d+$/
    - id: $$cap_kong_admin_port
      label: Kong Admin Listen port
      defaultValue: '8001'
      validRegex: /^\d+$/
    - id: $$cap_kong_admin_ssl_port
      label: Kong Admin Listen SSL port
      defaultValue: '8444'
      validRegex: /^\d+$/
    - id: $$cap_kong_database
      label: Kong Database
      defaultValue: 'off'
      validRegex: /^([^\s^\/])+$/
    - id: $$cap_kong_dns_order
      label: Kong DNS order
      defaultValue: 'LAST,A,CNAME'
      validRegex: /^([^\s^\/])+$/
    - id: $$cap_kong_plugins
      label: Kong Plugins
      defaultValue: 'request-transformer,cors,key-auth'
      validRegex: /^([^\s^\/])+$/

    # auth variables
    - id: $$cap_auth_version
      label: Auth Version
      defaultValue: 'v2.1.8'
      description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/gotrue/tags
      validRegex: /^([^\s^\/])+$/
    - id: $$cap_gotrue_api_host
      label: Gotrue API Host
      defaultValue: '0.0.0.0'
      validRegex: /^([^\s^\/])+$/
    - id: $$cap_gotrue_api_port
      label: Gotrue API port
      defaultValue: '9999'
      validRegex: /^([^\s^\/])+$/
    - id: $$cap_gotrue_uri_allow_list
      label: Gotrue URI allow list
      defaultValue: ''
    - id: $$cap_gotrue_disable_signup
      label: Gotrue Disable Signup
      defaultValue: 'false'
      validRegex: /^(true|false)$/
    - id: $$cap_gotrue_jwt_expiry
      label: Gotrue JWT expiry
      defaultValue: '84600'
      validRegex: /^\d+$/
    - id: $$cap_gotrue_jwt_default_group_name
      label: Gotrue Default Group Name
      defaultValue: 'authenticated'
      validRegex: /^([^\s^\/])+$/
    - id: $$cap_gotrue_external_email_enabled
      label: Gotrue external email enabled
      defaultValue: 'true'
      validRegex: /^(true|false)$/
    - id: $$cap_gotrue_mailer_autoconfirm
      label: Gotrue mailer autoconfirm
      defaultValue: 'false'
      validRegex: /^(true|false)$/
    - id: $$cap_gotrue_smtp_admin_email
      label: Gotrue SMTP admin email
      defaultValue: '[email protected]'
    - id: $$cap_gotrue_smtp_host
      label: Gotrue SMTP Host
      defaultValue: ''
    - id: $$cap_gotrue_smtp_port
      label: Gotrue SMTP port
      defaultValue: '567'
      validRegex: /^\d+$/
    - id: $$cap_gotrue_smtp_user
      label: Gotrue SMTP user
      defaultValue: ''
    - id: $$cap_gotrue_smtp_pass
      label: Gotrue SMTP password
      defaultValue: ''
    - id: $$cap_gotrue_smtp_sender_name
      label: Gotrue SMTP sender name
      defaultValue: ''
    - id: $$cap_gotrue_enable_phone_signup
      label: Gotrue External Phone Signup
      defaultValue: 'true'
      validRegex: /^(true|false)$/
    - id: $$cap_gotrue_sms_autoconfirm
      label: Gotrue SMS autoconfirm
      defaultValue: 'false'
      validRegex: /^(true|false)$/

    # postgrest variables
    - id: $$cap_postgrest_version
      label: Postgrest Version
      defaultValue: 'v8.0.0'
      description: Check out their Docker page for the valid tags https://hub.docker.com/r/postgrest/postgrest/tags
      validRegex: /^([^\s^\/])+$/

    # realtime variables
    - id: $$cap_realtime_version
      label: Storage Realtime Version
      defaultValue: 'v0.15.0'
      description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/realtime/tags
      validRegex: /^([^\s^\/])+$/

    # storage variables
    - id: $$cap_storage_version
      label: Storage API Version
      defaultValue: 'v0.9.3'
      description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/gotrue/tags
      validRegex: /^([^\s^\/])+$/
    - id: $$cap_storage_anon_key
      label: Storage Anon Key
      defaultValue: ''
      description: Generate ANON_KEY using your JWT secret at https://supabase.io/docs/guides/hosting/overview#api-keys
      validRegex: /^([^\s^\/])+$/
    - id: $$cap_storage_service_key
      label: Storage Service Key
      defaultValue: ''
      description: Generate SERVICE_KEY using your JWT secret at https://supabase.io/docs/guides/hosting/overview#api-keys
      validRegex: /^([^\s^\/])+$/
    - id: $$cap_storage_file_size_limit
      label: Storage File Size Limit
      defaultValue: '52428800'
      validRegex: /^\d+$/

    # postgres variables
    - id: $$cap_db_version
      label: Postgres Version
      defaultValue: '13.3.0'
      description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/postgres/tags
      validRegex: /^([^\s^\/])+$/
    - id: $$cap_pg_user
      label: Postgres Username
      defaultValue: 'postgres'
      validRegex: /.{1,}/
    - id: $$cap_pg_pass
      label: Postgres Password
      defaultValue: $$cap_gen_random_hex(64)
      validRegex: /.{1,}/
    - id: $$cap_pg_db
      label: Postgres Default Database
      defaultValue: 'postgres'
      validRegex: /.{1,}/
    - id: $$cap_pg_initdb_args
      label: "OPTIONAL: Arguments for 'postgres initdb'"
      description: For example, --data-checksums
      validRegex: /.{0,}/

    # pg-meta variables
    - id: $$cap_pg_meta_version
      label: Postgres Meta Version
      defaultValue: 'v0.27.3'
      description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/postgres-meta/tags
      validRegex: /^([^\s^\/])+$/
    - id: $$cap_pg_meta_port
      label: Postgres Meta Port
      defaultValue: '8080'
      validRegex: /^\d+$/
  instructions:
    start: >-
      Supabase is an open source Firebase alternative.
    end: >
      Supabase is deployed.
      1. Make sure to enable websocket support inside $$cap_appname-realtime.
      2. You will also have to create a kong.yml inside /var/lib/docker/volumes/captain--$$cap_appname-kong-config/_data
         Check https://github.com/supabase/supabase/blob/master/docker/volumes/kong.yml for the example content
          (make sure to edit and add your ANON_KEY, SERVICE_KEY and service url)
      3. Set $$cap_appname-db instance count to 0
      4. Run the following command
        # delete already created database
        `rm -rf /var/lib/docker/volumes/captain--$$cap_appname-db-data/_data/*`
        # clone supabase repo to extract migrations
        `git clone https://github.com/supabase/supabase`
        # copy migrations required for supabase
        `cp supabase/docker/volumes/db/init/* /var/lib/docker/volumes/captain--supabase-db-init/_data/ && rm -rf supabase`
        # set wal_level to logical
        `echo "wal_level = 'logical'" >> $PGDATA/pg_hba.conf`
        # now set instance count for $$cap_appname-db back to 1 and save
  displayName: Supabase
  isOfficial: true
  description: Supabase is an open source Firebase alternative.
  documentation: Taken from https://github.com/supabase/supabase

zlever01 avatar Dec 18 '21 18:12 zlever01

Any status update?

aaron5670 avatar Jan 04 '22 11:01 aaron5670

I'm following this issue Studio API endpoint error #4550 for a fix on the API error.

zlever01 avatar Jan 04 '22 20:01 zlever01

The Studio API endpoint error has been fixed, but I can not figure out what the Rest API url should be.

zlever01 avatar Jan 14 '22 05:01 zlever01

@zlever01 Studio is sending request to correct url but it seems the issue is with kong https://github.com/Kong/kong/issues/8152

ak4zh avatar Jan 19 '22 23:01 ak4zh

Hi guys, any status update? 🙂

aaron5670 avatar Mar 16 '22 13:03 aaron5670

Hi guys, any update

SOG-web avatar Mar 17 '22 10:03 SOG-web

I'm trying to test this right now, but am having trouble since sb-realtime takes so long to deploy. Is there any way to put it last, or to allow for a longer deployment? (I realize this might require changes to the server code, so maybe not an option at the moment).

Edit: For example: image

This gave a 500 error, and it is deployed successfully a couple moments after the reported failure on the UI.

christopher-kapic avatar Apr 14 '22 00:04 christopher-kapic

I'm trying to test this right now, but am having trouble since sb-realtime takes so long to deploy. Is there any way to put it last, or to allow for a longer deployment? (I realize this might require changes to the server code, so maybe not an option at the moment).

Looks like this issue is with your server. I've just attempted it an its working fine. Realtime didn't take long to deploy image

Jordan-Hall avatar Apr 22 '22 21:04 Jordan-Hall

With that screenshot said though. I have still found some errors im trying to resolve

Jordan-Hall avatar Apr 23 '22 11:04 Jordan-Hall

Looks like this issue is with your server. I've just attempted it an its working fine. Realtime didn't take long to deploy

What are your server's specs?

christopher-kapic avatar Apr 23 '22 15:04 christopher-kapic

Looks like this issue is with your server. I've just attempted it an its working fine. Realtime didn't take long to deploy

What are your server's specs?

image

The issue i'm getting now is 404. However i have notice a few issues with he current script while debugger

This is the version of the script i'm using

captainVersion: 4
services:
    $$cap_appname-studio:
        image: supabase/studio:$$cap_studio_version
        restart: unless-stopped
        environment:
            SUPABASE_URL: http://$$cap_appname-kong.$$cap_root_domain
            STUDIO_PG_META_URL: http://$$cap_appname-pg-meta.$$cap_root_domain
            SUPABASE_ANON_KEY: $$cap_supabase_anon_key
            SUPABASE_SERVICE_KEY: $$cap_supabase_service_key
            POSTGRES_PASSWORD: $$cap_pg_pass
        caproverExtra:
            containerHttpPort: $$cap_studio_http_port
        depends_on:
            - $$cap_appname-db
            - $$cap_appname-kong
            - $$cap_appname-pg-meta
    $$cap_appname-kong:
        image: kong:$$cap_kong_version
        volumes:
            - $$cap_appname-kong-config:/var/lib/kong
        restart: unless-stopped
        environment:
            KONG_DATABASE: $$cap_kong_database
            KONG_DECLARATIVE_CONFIG: $$cap_kong_declaritive_config
            # https://github.com/supabase/cli/issues/14
            KONG_DNS_ORDER: $$cap_kong_dns_order
            KONG_PLUGINS: $$cap_kong_plugins
            KONG_ADMIN_LISTEN: 0.0.0.0:$$cap_kong_admin_port, 0.0.0.0:$$cap_kong_admin_ssl_port ssl
        caproverExtra:
            containerHttpPort: 8000
    $$cap_appname-auth:
        image: supabase/gotrue:$$cap_auth_version
        depends_on:
            - $$cap_appname-db
        restart: unless-stopped
        environment:
            GOTRUE_API_HOST: $$cap_gotrue_api_host
            GOTRUE_API_PORT: $$cap_gotrue_api_port
            GOTRUE_DB_DRIVER: postgres
            GOTRUE_DB_DATABASE_URL: postgres://$$cap_pg_user:$$cap_pg_pass@srv-captain--$$cap_appname-db:5432/$$cap_pg_db?sslmode=disable&search_path=auth
            GOTRUE_SITE_URL: $$cap_appname-auth.$$cap_root_domain
            GOTRUE_URI_ALLOW_LIST: $$cap_gotrue_uri_allow_list
            GOTRUE_DISABLE_SIGNUP: $$cap_gotrue_disable_signup
            GOTRUE_JWT_SECRET: $$cap_jwt_secret
            GOTRUE_JWT_EXP: $$cap_gotrue_jwt_expiry
            GOTRUE_JWT_DEFAULT_GROUP_NAME: $$cap_gotrue_jwt_default_group_name
            GOTRUE_EXTERNAL_EMAIL_ENABLED: $$cap_gotrue_external_email_enabled
            GOTRUE_MAILER_AUTOCONFIRM: $$cap_gotrue_mailer_autoconfirm
            GOTRUE_SMTP_ADMIN_EMAIL: $$cap_gotrue_smtp_admin_email
            GOTRUE_SMTP_HOST: $$cap_gotrue_smtp_host
            GOTRUE_SMTP_PORT: $$cap_gotrue_smtp_port
            GOTRUE_SMTP_USER: $$cap_gotrue_smtp_user
            GOTRUE_SMTP_PASS: $$cap_gotrue_smtp_pass
            GOTRUE_SMTP_SENDER_NAME: $$cap_gotrue_smtp_sender_name
            GOTRUE_MAILER_URLPATHS_INVITE: /auth/v1/verify
            GOTRUE_MAILER_URLPATHS_CONFIRMATION: /auth/v1/verify
            GOTRUE_MAILER_URLPATHS_RECOVERY: /auth/v1/verify
            GOTRUE_MAILER_URLPATHS_EMAIL_CHANGE: /auth/v1/verify
            GOTRUE_EXTERNAL_PHONE_ENABLED: $$cap_gotrue_enable_phone_signup
            GOTRUE_SMS_AUTOCONFIRM: $$cap_gotrue_sms_autoconfirm
        caproverExtra:
            containerHttpPort: $$cap_gotrue_api_port
    $$cap_appname-rest:
        image: postgrest/postgrest:$$cap_postgrest_version
        depends_on:
            - $$cap_appname-db
        restart: unless-stopped
        environment:
            PGRST_DB_URI: postgres://$$cap_pg_user:$$cap_pg_pass@srv-captain--$$cap_appname-db:5432/$$cap_pg_db
            PGRST_DB_SCHEMA: public, storage
            PGRST_DB_ANON_ROLE: anon
            PGRST_JWT_SECRET: $$cap_jwt_secret
        caproverExtra:
            containerHttpPort: 3000
    $$cap_appname-realtime:
        image: supabase/realtime:$$cap_realtime_version
        depends_on:
            - $$cap_appname-db
        restart: unless-stopped
        environment:
            DB_HOST: srv-captain--$$cap_appname-db
            DB_PORT: 5432
            DB_NAME: $$cap_pg_db
            DB_USER: $$cap_pg_user
            DB_PASSWORD: $$cap_pg_pass
            SLOT_NAME: supabase_realtime
            PORT: 4000
            SECURE_CHANNELS: 'true'
            JWT_SECRET: $$cap_jwt_secret
        caproverExtra:
            containerHttpPort: 4000
    $$cap_appname-storage:
        image: supabase/storage-api:$$cap_storage_version
        depends_on:
            - $$cap_appname-db
            - $$cap_appname-rest
        restart: unless-stopped
        volumes:
            - $$cap_appname-storage:/var/lib/storage
        environment:
            ANON_KEY: $$cap_supabase_anon_key
            SERVICE_KEY: $$cap_supabase_service_key
            POSTGREST_URL: srv-captain--$$cap_appname-rest
            PGRST_JWT_SECRET: $$cap_jwt_secret
            DATABASE_URL: postgres://$$cap_pg_user:$$cap_pg_pass@srv-captain--$$cap_appname-db:5432/$$cap_pg_db
            PGOPTIONS: -c search_path=storage
            FILE_SIZE_LIMIT: $$cap_storage_file_size_limit
            STORAGE_BACKEND: file
            FILE_STORAGE_BACKEND_PATH: /var/lib/storage
            # TODO: https://github.com/supabase/storage-api/commit/a836fc9666c2434d89ca4b31402f74772d50fb6d
            PROJECT_REF: stub
            # TODO: https://github.com/supabase/storage-api/issues/55
            REGION: stub
            GLOBAL_S3_BUCKET: stub
        caproverExtra:
            containerHttpPort: 5000
    $$cap_appname-pg-meta:
        image: supabase/postgres-meta:$$cap_pg_meta_version
        depends_on:
            - $$cap_appname-db
        restart: unless-stopped
        environment:
            PG_META_DB_NAME: $$cap_pg_db
            PG_META_DB_USER: $$cap_pg_user
            PG_META_DB_PASSWORD: $$cap_pg_pass
            PG_META_DB_PORT: 5432
            PG_META_DB_HOST: srv-captain--$$cap_appname-db
            PG_META_PORT: $$cap_pg_meta_port
        caproverExtra:
            containerHttpPort: $$cap_pg_meta_port
    $$cap_appname-db:
        # not using postgres image because supabase/postgres
        # has some additional initdb script
        image: supabase/postgres:$$cap_db_version
        volumes:
            - $$cap_appname-db-data:/var/lib/postgresql/data
            - $$cap_appname-db-init:/docker-entrypoint-initdb.d
        restart: unless-stopped
        environment:
            POSTGRES_USER: $$cap_pg_user
            POSTGRES_PASSWORD: $$cap_pg_pass
            POSTGRES_DB: $$cap_pg_db
            POSTGRES_INITDB_ARGS: $$cap_pg_initdb_args
        caproverExtra:
            notExposeAsWebApp: 'true'
caproverOneClickApp:
    variables:
        # shared env
        - id: $$cap_jwt_secret
          label: JWT secret
          defaultValue: $$cap_gen_random_hex(32)
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_supabase_anon_key
          label: Supabase Anon Key
          description: Generate ANON_KEY using your JWT secret at https://supabase.io/docs/guides/hosting/overview#api-keys
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_supabase_service_key
          label: Supabase Service Key
          description: Generate SERVICE_KEY using your JWT secret at https://supabase.io/docs/guides/hosting/overview#api-keys
          validRegex: /^([^\s^\/])+$/

        # studio variables
        - id: $$cap_studio_version
          label: Studio version
          defaultValue: 'latest'
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/studio/tags
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_studio_http_port
          label: Studio HTTP port
          defaultValue: '3000'
          validRegex: /^\d+$/

        # kong variables
        - id: $$cap_kong_version
          label: Kong version
          defaultValue: '2.1'
          description: Check out their Docker page for the valid tags https://hub.docker.com/_/kong?tab=tags
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_kong_http_port
          label: Kong HTTP port
          defaultValue: '8000'
          validRegex: /^\d+$/
        - id: $$cap_kong_https_port
          label: Kong HTTPS port
          defaultValue: '8443'
          validRegex: /^\d+$/
        - id: $$cap_kong_admin_port
          label: Kong Admin Listen port
          defaultValue: '8001'
          validRegex: /^\d+$/
        - id: $$cap_kong_admin_ssl_port
          label: Kong Admin Listen SSL port
          defaultValue: '8444'
          validRegex: /^\d+$/
        - id: $$cap_kong_database
          label: Kong Database
          defaultValue: 'off'
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_kong_declaritive_config
          label: Kong Declarative Config
          defaultValue: '/var/lib/kong/kong.yml'
        - id: $$cap_kong_dns_order
          label: Kong DNS order
          defaultValue: 'LAST,A,CNAME'
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_kong_plugins
          label: Kong Plugins
          defaultValue: 'request-transformer,cors,key-auth,acl'
          validRegex: /^([^\s^\/])+$/

        # auth variables
        - id: $$cap_auth_version
          label: Auth Version
          defaultValue: 'v2.2.12'
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/gotrue/tags
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_gotrue_api_host
          label: Gotrue API Host
          defaultValue: '0.0.0.0'
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_gotrue_api_port
          label: Gotrue API port
          defaultValue: '9999'
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_gotrue_uri_allow_list
          label: Gotrue URI allow list
          defaultValue: ''
        - id: $$cap_gotrue_disable_signup
          label: Gotrue Disable Signup
          defaultValue: 'false'
          validRegex: /^(true|false)$/
        - id: $$cap_gotrue_jwt_expiry
          label: Gotrue JWT expiry
          defaultValue: '84600'
          validRegex: /^\d+$/
        - id: $$cap_gotrue_jwt_default_group_name
          label: Gotrue Default Group Name
          defaultValue: 'authenticated'
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_gotrue_external_email_enabled
          label: Gotrue external email enabled
          defaultValue: 'true'
          validRegex: /^(true|false)$/
        - id: $$cap_gotrue_mailer_autoconfirm
          label: Gotrue mailer autoconfirm
          defaultValue: 'false'
          validRegex: /^(true|false)$/
        - id: $$cap_gotrue_smtp_admin_email
          label: Gotrue SMTP admin email
          defaultValue: '[email protected]'
        - id: $$cap_gotrue_smtp_host
          label: Gotrue SMTP Host
          defaultValue: ''
        - id: $$cap_gotrue_smtp_port
          label: Gotrue SMTP port
          defaultValue: '567'
          validRegex: /^\d+$/
        - id: $$cap_gotrue_smtp_user
          label: Gotrue SMTP user
          defaultValue: ''
        - id: $$cap_gotrue_smtp_pass
          label: Gotrue SMTP password
          defaultValue: ''
        - id: $$cap_gotrue_smtp_sender_name
          label: Gotrue SMTP sender name
          defaultValue: ''
        - id: $$cap_gotrue_enable_phone_signup
          label: Gotrue External Phone Signup
          defaultValue: 'true'
          validRegex: /^(true|false)$/
        - id: $$cap_gotrue_sms_autoconfirm
          label: Gotrue SMS autoconfirm
          defaultValue: 'false'
          validRegex: /^(true|false)$/

        # postgrest variables
        - id: $$cap_postgrest_version
          label: Postgrest Version
          defaultValue: 'v9.0.0'
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/postgrest/postgrest/tags
          validRegex: /^([^\s^\/])+$/

        # realtime variables
        - id: $$cap_realtime_version
          label: Storage Realtime Version
          defaultValue: 'v0.19.3'
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/realtime/tags
          validRegex: /^([^\s^\/])+$/

        # storage variables
        - id: $$cap_storage_version
          label: Storage API Version
          defaultValue: 'v0.10.0'
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/gotrue/tags
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_storage_file_size_limit
          label: Storage File Size Limit
          defaultValue: '52428800'
          validRegex: /^\d+$/

        # postgres variables
        - id: $$cap_db_version
          label: Postgres Version
          defaultValue: '14.1.0'
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/postgres/tags
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_pg_user
          label: Postgres Username
          defaultValue: 'postgres'
          validRegex: /.{1,}/
        - id: $$cap_pg_pass
          label: Postgres Password
          defaultValue: $$cap_gen_random_hex(64)
          validRegex: /.{1,}/
        - id: $$cap_pg_db
          label: Postgres Default Database
          defaultValue: 'postgres'
          validRegex: /.{1,}/
        - id: $$cap_pg_initdb_args
          label: "OPTIONAL: Arguments for 'postgres initdb'"
          description: For example, --data-checksums
          validRegex: /.{0,}/

        # pg-meta variables
        - id: $$cap_pg_meta_version
          label: Postgres Meta Version
          defaultValue: 'v0.29.0'
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/postgres-meta/tags
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_pg_meta_port
          label: Postgres Meta Port
          defaultValue: '8080'
          validRegex: /^\d+$/
    instructions:
        start: >-
            Supabase is an open source Firebase alternative.
        end: >
            Supabase is deployed.
            1. Make sure to enable websocket support inside $$cap_appname-realtime.
            2. You will also have to create a kong.yml inside /var/lib/docker/volumes/captain--$$cap_appname-kong-config/_data
               Check https://github.com/supabase/supabase/blob/master/docker/volumes/api/kong.yml for the example content
                (make sure to edit and add your ANON_KEY, SERVICE_KEY and service url)
            3. # Set $$cap_appname-db instance count to 0
              `docker service scale srv-captain--$$cap_appname-db=0`
            4. Run the following command
              # delete already created database
              `rm -rf /var/lib/docker/volumes/captain--$$cap_appname-db-data/_data/*`
              # clone supabase repo to extract migrations
              `git clone https://github.com/supabase/supabase`
              # copy migrations required for supabase
              `cp supabase/docker/volumes/db/init/* /var/lib/docker/volumes/captain--$$cap_appname-db-init/_data/ && rm -rf supabase`
              # now set instance count for $$cap_appname-db back to 1
              `docker service scale srv-captain--$$cap_appname-db=1`
              # once database is started, set wal_level to logical and restart database again
              `echo "wal_level = 'logical'" >> /var/lib/docker/volumes/captain--$$cap_appname-db-data/_data/postgresql.conf`
    displayName: Supabase
    isOfficial: true
    description: Supabase is an open source Firebase alternative.
    documentation: Taken from https://github.com/supabase/supabase

Jordan-Hall avatar Apr 23 '22 16:04 Jordan-Hall

This package installed successfully for me (latest), and I did follow all the custom instructions correctly.

When I launch studio it keeps loading forever and other menu's give same result:

afbeelding

papoola avatar Aug 21 '22 19:08 papoola

https://github.com/caprover/one-click-apps/issues/705

githubsaturn avatar Aug 22 '22 03:08 githubsaturn

i can help to test if needed. cheers

jomuji avatar Sep 02 '22 19:09 jomuji

@christopher-kapic You can pull all images before hand. Go to terminal and pull all the images used in the app, then run the deploy from dashboard it will happen quickly

ak4zh avatar Sep 03 '22 04:09 ak4zh

@papoola This happens because the api is not working, the dashboard is unable to connect with the gotrue. I am not sure of the error.

ak4zh avatar Sep 03 '22 04:09 ak4zh

@christopher-kapic You can avoid the timeout error by pulling all the required images first using the terminal.

docker pull supabase/realtime:latest

ak4zh avatar Jan 10 '23 07:01 ak4zh