diff --git a/public/v4/apps/supabase-postgres.yml b/public/v4/apps/supabase-postgres.yml deleted file mode 100644 index f117f0ce5..000000000 --- a/public/v4/apps/supabase-postgres.yml +++ /dev/null @@ -1,49 +0,0 @@ -captainVersion: 4 -services: - $$cap_appname-db: - image: supabase/postgres:$$cap_app_version - volumes: - - $$cap_appname-db-data:/var/lib/postgresql/data - restart: always - 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: - - id: $$cap_app_version - label: Supabase Version - defaultValue: '0.14.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 - description: '' - validRegex: /.{1,}/ - - id: $$cap_pg_pass - label: Postgres Password - description: '' - validRegex: /.{1,}/ - - id: $$cap_pg_db - label: Postgres Default Database - description: '' - validRegex: /.{1,}/ - - id: $$cap_pg_initdb_args - label: "OPTIONAL: Arguments for 'postgres initdb'" - description: For example, --data-checksums - validRegex: /.{0,}/ - instructions: - start: >- - Postgres + goodies = Supabase Postgres - - Unmodified Postgres with some useful plugins. - - Our goal with this repo is not to modify Postgres, but to provide some of the most common extensions with a one-click install. - end: "Supabase (Postgres) is deployed and available as srv-captain--$$cap_appname-db:5432 to other apps. For example with NodeJS: 'const client = new Client({ user: 'cap_pg_user', host: 'srv-captain--$$cap_appname', database: 'cap_pg_db', password: '********', port: 5432})'" - displayName: Supabase PostgreSQL - isOfficial: true - description: Supabase makes it easy to use Postgres. - documentation: Taken from https://github.com/supabase/postgres diff --git a/public/v4/apps/supabase.yml b/public/v4/apps/supabase.yml new file mode 100644 index 000000000..29c77cc0c --- /dev/null +++ b/public/v4/apps/supabase.yml @@ -0,0 +1,421 @@ +captainVersion: 4 +services: + $$cap_appname-studio: + image: supabase/studio:$$cap_studio_version + restart: unless-stopped + environment: + STUDIO_PG_META_URL: http://$$cap_appname-pg-meta.$$cap_root_domain + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + + DEFAULT_ORGANIZATION: ${STUDIO_DEFAULT_ORGANIZATION} + DEFAULT_PROJECT: ${STUDIO_DEFAULT_PROJECT} + + SUPABASE_URL: http://$$cap_appname-supabase-kong.$$cap_root_domain + SUPABASE_PUBLIC_URL: http://$$cap_appname-supabase-studio.$$cap_root_domain + + # Kept for backwards compatibility with studio:0.22.08 + SUPABASE_REST_URL: http://$$cap_appname-rest.$$cap_root_domain/rest/v1/ + SUPABASE_ANON_KEY: $$cap_supabase_anon_key + SUPABASE_SERVICE_KEY: $$cap_supabase_service_key + caproverExtra: + containerHttpPort: $$cap_studio_http_port + + $$cap_appname-kong: + image: kong:$$cap_kong_version + volumes: + - $$cap_appname-kong-config:/var/lib/kong:ro + restart: unless-stopped + ports: + - $$cap_kong_https_port:8443 + 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 + KONG_NGINX_PROXY_PROXY_BUFFER_SIZE: 160k + KONG_NGINX_PROXY_PROXY_BUFFERS: 64 160k + 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 + API_EXTERNAL_URL: http://$$cap_appname-rest.$$cap_root_domain + + 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_ADMIN_ROLES: service_role + GOTRUE_JWT_AUD: authenticated + GOTRUE_JWT_DEFAULT_GROUP_NAME: authenticated + GOTRUE_JWT_EXP: $$cap_gotrue_jwt_expiry + GOTRUE_JWT_SECRET: $$cap_jwt_secret + + 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 + MFA_ENABLED: $$cap_gotrue_mfa_enabled + 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: $$cap_postgrest_db_schemas + PGRST_DB_ANON_ROLE: anon + PGRST_JWT_SECRET: $$cap_jwt_secret + PGRST_DB_USE_LEGACY_GUCS: 'false' + caproverExtra: + containerHttpPort: 3000 + + $$cap_appname-realtime: + image: supabase/realtime:$$cap_realtime_version + depends_on: + - $$cap_appname-db + restart: unless-stopped + environment: + PORT: 4000 + DB_HOST: srv-captain--$$cap_appname-db + DB_PORT: 5432 + DB_USER: $$cap_pg_user + DB_PASSWORD: $$cap_pg_pass + DB_NAME: $$cap_pg_db + DB_AFTER_CONNECT_QUERY: 'SET search_path TO _realtime' + DB_ENC_KEY: supabaserealtime + API_JWT_SECRET: $$cap_jwt_secret + FLY_ALLOC_ID: fly123 + FLY_APP_NAME: realtime + SECRET_KEY_BASE: UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq + ERL_AFLAGS: -proto_dist inet_tcp + ENABLE_TAILSCALE: 'false' + DNS_NODES: "''" + caproverExtra: + containerHttpPort: 4000 + dockerfileLines: + # https://github.com/caprover/one-click-apps/pull/833#issuecomment-1445213826 + - FROM supabase/realtime:$$cap_realtime_version - CMD sh -c "/app/bin/migrate && /app/bin/realtime eval 'Realtime.Release.seeds(Realtime.Repo)' && /app/bin/server" + + $$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 + FILE_SIZE_LIMIT: $$cap_storage_file_size_limit + STORAGE_BACKEND: file + FILE_STORAGE_BACKEND_PATH: /var/lib/storage + TENANT_ID: stub + REGION: stub + GLOBAL_S3_BUCKET: stub + ENABLE_IMAGE_TRANSFORMATION: 'true' + IMGPROXY_URL: http://$$cap_appname-imgproxy.$$cap_root_domain + caproverExtra: + containerHttpPort: 5000 + + $$cap_appname-imgproxy: + image: darthsim/imgproxy:$$cap_imgproxy_version + environment: + IMGPROXY_BIND: ':5001' + IMGPROXY_LOCAL_FILESYSTEM_ROOT: / + IMGPROXY_USE_ETAG: 'true' + volumes: + - $$cap_appname-imgproxy-storage:/var/lib/storage + caproverExtra: + containerHttpPort: 5001 + + $$cap_appname-pg-meta: + image: supabase/postgres-meta:$$cap_pg_meta_version + depends_on: + - $$cap_appname-db + restart: unless-stopped + environment: + PG_META_PORT: $$cap_pg_meta_port + PG_META_DB_HOST: srv-captain--$$cap_appname-db + PG_META_DB_PORT: 5432 + PG_META_DB_NAME: $$cap_pg_db + PG_META_DB_USER: $$cap_pg_user + PG_META_DB_PASSWORD: $$cap_pg_pass + 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-realtime:/docker-entrypoint-initdb.d/realtime.sql + - $$cap_appname-db-roles:/docker-entrypoint-initdb.d/roles.sql + # Must be superuser to enable pg_net extension + - $$cap_appname-db-webhooks:/etc/postgresql.schema.sql + - $$cap_appname-db-data:/var/lib/postgresql/data + + restart: unless-stopped + environment: + POSTGRES_HOST: /var/run/postgresql + PGPORT: 5432 + POSTGRES_PORT: 5432 + PGPASSWORD: $$cap_pg_pass + POSTGRES_PASSWORD: $$cap_pg_pass + PGDATABASE: $$cap_pg_db + POSTGRES_DB: $$cap_pg_db + 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: '20230216-e731b77' + 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.8.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.47.0' + 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_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: 'admin@example.com' + - 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)$/ + - id: $$cap_gotrue_mfa_enabled + label: Gotrue MFA enabled + defaultValue: 'false' + validRegex: /^(true|false)$/ + + # postgrest variables + - id: $$cap_postgrest_version + label: Postgrest Version + defaultValue: 'v10.1.2' + description: Check out their Docker page for the valid tags https://hub.docker.com/r/postgrest/postgrest/tags + validRegex: /^([^\s^\/])+$/ + - id: $$cap_postgrest_db_schemas + label: Postgrest DB Schemas + defaultValue: 'public, storage' + validRegex: /^([^\s^\/])+$/ + + # realtime variables + - id: $$cap_realtime_version + label: Storage Realtime Version + defaultValue: 'v2.5.1' + 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.28.2' + 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: '15.1.0.42-rc2' + 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,}/ + + # pg-meta variables + - id: $$cap_pg_meta_version + label: Postgres Meta Version + defaultValue: 'v0.60.7' + 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+$/ + + # imgproxy variables + - id: $$cap_imgproxy_version + label: ImgProxy Version + defaultValue: 'v3.11' + description: Check out their Docker page for the valid tags https://hub.docker.com/r/darthsim/imgproxy/tags + validRegex: /^([^\s^\/])+$/ + + 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 -r supabase/docker/volumes/db/* /var/lib/docker/volumes/captain--$$cap_appname-db-data/_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 diff --git a/public/v4/logos/supabase-postgres.png b/public/v4/logos/supabase.png similarity index 100% rename from public/v4/logos/supabase-postgres.png rename to public/v4/logos/supabase.png