diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..689146d --- /dev/null +++ b/.env.example @@ -0,0 +1,123 @@ +############ +# Secrets +# YOU MUST CHANGE THESE BEFORE GOING INTO PRODUCTION +############ + +POSTGRES_PASSWORD=your-super-secret-and-long-postgres-password +JWT_SECRET=your-super-secret-jwt-token-with-at-least-32-characters-long +ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE +SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q +DASHBOARD_USERNAME=supabase +DASHBOARD_PASSWORD=this_password_is_insecure_and_should_be_updated +SECRET_KEY_BASE=UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq +VAULT_ENC_KEY=your-encryption-key-32-chars-min + + +############ +# Database - You can change these to any PostgreSQL database that has logical replication enabled. +############ + +POSTGRES_HOST=db +POSTGRES_DB=postgres +POSTGRES_PORT=5432 +# default user is postgres + + +############ +# Supavisor -- Database pooler +############ +POOLER_PROXY_PORT_TRANSACTION=6543 +POOLER_DEFAULT_POOL_SIZE=20 +POOLER_MAX_CLIENT_CONN=100 +POOLER_TENANT_ID=your-tenant-id + + +############ +# API Proxy - Configuration for the Kong Reverse proxy. +############ + +KONG_HTTP_PORT=8000 +KONG_HTTPS_PORT=8443 + + +############ +# API - Configuration for PostgREST. +############ + +PGRST_DB_SCHEMAS=public,storage,graphql_public + + +############ +# Auth - Configuration for the GoTrue authentication server. +############ + +## General +SITE_URL=http://localhost:3000 +ADDITIONAL_REDIRECT_URLS= +JWT_EXPIRY=3600 +DISABLE_SIGNUP=false +API_EXTERNAL_URL=http://localhost:8000 + +## Mailer Config +MAILER_URLPATHS_CONFIRMATION="/auth/v1/verify" +MAILER_URLPATHS_INVITE="/auth/v1/verify" +MAILER_URLPATHS_RECOVERY="/auth/v1/verify" +MAILER_URLPATHS_EMAIL_CHANGE="/auth/v1/verify" + +## Email auth +ENABLE_EMAIL_SIGNUP=true +ENABLE_EMAIL_AUTOCONFIRM=true +SMTP_ADMIN_EMAIL=admin@example.com +SMTP_HOST=supabase-mail +SMTP_PORT=2500 +SMTP_USER=fake_mail_user +SMTP_PASS=fake_mail_password +SMTP_SENDER_NAME=fake_sender +ENABLE_ANONYMOUS_USERS=false + +## Phone auth +ENABLE_PHONE_SIGNUP=true +ENABLE_PHONE_AUTOCONFIRM=true + + +############ +# Studio - Configuration for the Dashboard +############ + +STUDIO_DEFAULT_ORGANIZATION=Default Organization +STUDIO_DEFAULT_PROJECT=Default Project + +STUDIO_PORT=3000 +# replace if you intend to use Studio outside of localhost +SUPABASE_PUBLIC_URL=http://localhost:8000 + +# Enable webp support +IMGPROXY_ENABLE_WEBP_DETECTION=true + +# Add your OpenAI API key to enable SQL Editor Assistant +OPENAI_API_KEY= + + +############ +# Functions - Configuration for Functions +############ +# NOTE: VERIFY_JWT applies to all functions. Per-function VERIFY_JWT is not supported yet. +FUNCTIONS_VERIFY_JWT=false + + +############ +# Logs - Configuration for Logflare +# Please refer to https://supabase.com/docs/reference/self-hosting-analytics/introduction +############ + +LOGFLARE_LOGGER_BACKEND_API_KEY=your-super-secret-and-long-logflare-key + +# Change vector.toml sinks to reflect this change +LOGFLARE_API_KEY=your-super-secret-and-long-logflare-key + +# Docker socket location - this value will differ depending on your OS +DOCKER_SOCKET_LOCATION=/var/run/docker.sock + +# Google Cloud Project details +GOOGLE_PROJECT_ID=GOOGLE_PROJECT_ID +GOOGLE_PROJECT_NUMBER=GOOGLE_PROJECT_NUMBER \ No newline at end of file diff --git a/backend/.env.example b/backend/.env.example index f17bb4b..27eefa0 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -121,3 +121,15 @@ DOCKER_SOCKET_LOCATION=/var/run/docker.sock # Google Cloud Project details GOOGLE_PROJECT_ID=GOOGLE_PROJECT_ID GOOGLE_PROJECT_NUMBER=GOOGLE_PROJECT_NUMBER + + +## FLOWSINT-API + +SUPABASE_URL=http://localhost:8000 +SUPABASE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE + +## FLOWSINT-WEB + +NEXT_PUBLIC_AUTH_REDIRECT=http://localhost:3000/auth/callback +NEXT_PUBLIC_SUPABASE_URL=https://tylhnsayytaoaaiqsgdp.supabase.co +NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InR5bGhuc2F5eXRhb2FhaXFzZ2RwIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MzgzMzY3MzAsImV4cCI6MjA1MzkxMjczMH0.iVcpz8RpOgzVSamp_tNQQmjdLL9_Olx6m4LfsLVw1bg \ No newline at end of file diff --git a/backend/docker-compose.s3.yml b/backend/docker-compose.s3.yml deleted file mode 100644 index 043691a..0000000 --- a/backend/docker-compose.s3.yml +++ /dev/null @@ -1,94 +0,0 @@ -services: - - minio: - image: minio/minio - ports: - - '9000:9000' - - '9001:9001' - environment: - MINIO_ROOT_USER: supa-storage - MINIO_ROOT_PASSWORD: secret1234 - command: server --console-address ":9001" /data - healthcheck: - test: [ "CMD", "curl", "-f", "http://minio:9000/minio/health/live" ] - interval: 2s - timeout: 10s - retries: 5 - volumes: - - ./volumes/storage:/data:z - - minio-createbucket: - image: minio/mc - depends_on: - minio: - condition: service_healthy - entrypoint: > - /bin/sh -c " - /usr/bin/mc alias set supa-minio http://minio:9000 supa-storage secret1234; - /usr/bin/mc mb supa-minio/stub; - exit 0; - " - - storage: - container_name: supabase-storage - image: supabase/storage-api:v1.11.13 - depends_on: - db: - # Disable this if you are using an external Postgres database - condition: service_healthy - rest: - condition: service_started - imgproxy: - condition: service_started - minio: - condition: service_healthy - healthcheck: - test: - [ - "CMD", - "wget", - "--no-verbose", - "--tries=1", - "--spider", - "http://localhost:5000/status" - ] - timeout: 5s - interval: 5s - retries: 3 - restart: unless-stopped - environment: - ANON_KEY: ${ANON_KEY} - SERVICE_KEY: ${SERVICE_ROLE_KEY} - POSTGREST_URL: http://rest:3000 - PGRST_JWT_SECRET: ${JWT_SECRET} - DATABASE_URL: postgres://supabase_storage_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB} - FILE_SIZE_LIMIT: 52428800 - STORAGE_BACKEND: s3 - GLOBAL_S3_BUCKET: stub - GLOBAL_S3_ENDPOINT: http://minio:9000 - GLOBAL_S3_PROTOCOL: http - GLOBAL_S3_FORCE_PATH_STYLE: true - AWS_ACCESS_KEY_ID: supa-storage - AWS_SECRET_ACCESS_KEY: secret1234 - AWS_DEFAULT_REGION: stub - FILE_STORAGE_BACKEND_PATH: /var/lib/storage - TENANT_ID: stub - # TODO: https://github.com/supabase/storage-api/issues/55 - REGION: stub - ENABLE_IMAGE_TRANSFORMATION: "true" - IMGPROXY_URL: http://imgproxy:5001 - volumes: - - ./volumes/storage:/var/lib/storage:z - - imgproxy: - container_name: supabase-imgproxy - image: darthsim/imgproxy:v3.8.0 - healthcheck: - test: [ "CMD", "imgproxy", "health" ] - timeout: 5s - interval: 5s - retries: 3 - environment: - IMGPROXY_BIND: ":5001" - IMGPROXY_USE_ETAG: "true" - IMGPROXY_ENABLE_WEBP_DETECTION: ${IMGPROXY_ENABLE_WEBP_DETECTION} diff --git a/docker-compose.override.yml b/docker-compose.override.yml new file mode 100644 index 0000000..b119b21 --- /dev/null +++ b/docker-compose.override.yml @@ -0,0 +1,91 @@ +name: flowsint + +services: + # Traefik reverse proxy + reverse-proxy: + image: traefik:v3.1 + container_name: traefik-reverse-proxy + command: + - "--api.insecure=true" + - "--providers.docker" + - "--entrypoints.ws.address=:80" + - "--providers.file.watch=true" + ports: + - "80:80" + - "8080:8080" + restart: unless-stopped + volumes: + - /var/run/docker.sock:/var/run/docker.sock + networks: + - traefik + + # Next.js application + flowsint-web: + build: + context: flowsint-web + dockerfile: Dockerfile + container_name: flowsint-web + ports: + - "3000:3000" + env_file: + - .env + networks: + - traefik + labels: + - "traefik.enable=true" + - "traefik.http.routers.nextjs.rule=Host(`app.flowsint.localhost`)" + - "traefik.http.services.nextjs.loadbalancer.server.port=3000" + + # Flask-like application with Celery + flowsint-api: + build: + context: flowsint-api + dockerfile: Dockerfile + container_name: flowsint-api + ports: + - "5000:5000" + depends_on: + - redis + environment: + - REDIS_URL=redis://redis:6379/0 + - ENV=prod + command: ["/app/entrypoint.sh", "app"] + restart: always + networks: + - traefik + labels: + - "traefik.enable=true" + - "traefik.http.routers.app.rule=Host(`api.flowsint.localhost`)" + - "traefik.http.services.app.loadbalancer.server.port=5000" + + celery: + build: + context: flowsint-api + dockerfile: Dockerfile + container_name: celery-worker + depends_on: + - redis + - flowsint-api + environment: + - REDIS_URL=redis://redis:6379/0 + - ENV=prod + command: ["/app/entrypoint.sh", "celery"] + restart: always + networks: + - traefik + + redis: + image: "redis:alpine" + container_name: redis-cache + ports: + - "6379:6379" + networks: + - traefik + +networks: + traefik: + name: traefik + driver: bridge + +volumes: + db-config: \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml deleted file mode 100644 index 038f52f..0000000 --- a/docker-compose.yaml +++ /dev/null @@ -1,22 +0,0 @@ -version: '3.8' - -services: - backend: - build: ./flowsint-api - ports: - - "5000:5000" - volumes: - - ./flowsint-api:/app - environment: - - FLASK_ENV=development - - frontend: - build: ./flowsint-web - ports: - - "3000:3000" - volumes: - - ./flowsint-web:/app - depends_on: - - backend - environment: - - NEXT_PUBLIC_API_URL=http://localhost:5000 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1ae2dc1 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,575 @@ +name: flowsint + +services: + # Traefik reverse proxy + reverse-proxy: + image: traefik:v3.1 + container_name: traefik-reverse-proxy + command: + - "--api.insecure=true" + - "--providers.docker" + - "--entrypoints.ws.address=:80" + - "--providers.file.watch=true" + ports: + - "80:80" + - "8080:8080" + restart: unless-stopped + volumes: + - /var/run/docker.sock:/var/run/docker.sock + networks: + - traefik + + # Next.js application + flowsint-web: + build: + context: flowsint-web + dockerfile: Dockerfile + container_name: flowsint-web + ports: + - "3000:3000" + env_file: + - .env + networks: + - traefik + labels: + - "traefik.enable=true" + - "traefik.http.routers.nextjs.rule=Host(`app.flowsint.localhost`)" + - "traefik.http.services.nextjs.loadbalancer.server.port=3000" + + # Flask-like application with Celery + flowsint-api: + build: + context: flowsint-api + dockerfile: Dockerfile + container_name: flowsint-api + ports: + - "5000:5000" + depends_on: + - redis + environment: + - REDIS_URL=redis://redis:6379/0 + - ENV=prod + command: ["/app/entrypoint.sh", "app"] + restart: always + networks: + - traefik + labels: + - "traefik.enable=true" + - "traefik.http.routers.app.rule=Host(`api.flowsint.localhost`)" + - "traefik.http.services.app.loadbalancer.server.port=5000" + + celery: + build: + context: flowsint-api + dockerfile: Dockerfile + container_name: celery-worker + depends_on: + - redis + - flowsint-api + environment: + - REDIS_URL=redis://redis:6379/0 + - ENV=prod + command: ["/app/entrypoint.sh", "celery"] + restart: always + networks: + - traefik + + redis: + image: "redis:alpine" + container_name: redis-cache + ports: + - "6379:6379" + networks: + - traefik + + # Supabase services + studio: + container_name: supabase-studio + image: supabase/studio:20250224-d10db0f + restart: unless-stopped + healthcheck: + test: + [ + "CMD", + "node", + "-e", + "fetch('http://studio:3000/api/platform/profile').then((r) => {if (r.status !== 200) throw new Error(r.status)})" + ] + timeout: 10s + interval: 5s + retries: 3 + depends_on: + analytics: + condition: service_healthy + environment: + STUDIO_PG_META_URL: http://meta:8080 + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + DEFAULT_ORGANIZATION_NAME: ${STUDIO_DEFAULT_ORGANIZATION} + DEFAULT_PROJECT_NAME: ${STUDIO_DEFAULT_PROJECT} + OPENAI_API_KEY: ${OPENAI_API_KEY:-} + SUPABASE_URL: http://kong:8000 + SUPABASE_PUBLIC_URL: ${SUPABASE_PUBLIC_URL} + SUPABASE_ANON_KEY: ${ANON_KEY} + SUPABASE_SERVICE_KEY: ${SERVICE_ROLE_KEY} + AUTH_JWT_SECRET: ${JWT_SECRET} + LOGFLARE_API_KEY: ${LOGFLARE_API_KEY} + LOGFLARE_URL: http://analytics:4000 + NEXT_PUBLIC_ENABLE_LOGS: true + NEXT_ANALYTICS_BACKEND_PROVIDER: postgres + networks: + - traefik + labels: + - "traefik.enable=true" + - "traefik.http.routers.studio.rule=Host(`studio.flowsint.localhost`)" + - "traefik.http.services.studio.loadbalancer.server.port=3000" + + kong: + container_name: supabase-kong + image: kong:2.8.1 + restart: unless-stopped + ports: + - ${KONG_HTTP_PORT}:8000/tcp + - ${KONG_HTTPS_PORT}:8443/tcp + volumes: + - ./backend/volumes/api/kong.yml:/home/kong/temp.yml:ro,z + depends_on: + analytics: + condition: service_healthy + environment: + KONG_DATABASE: "off" + KONG_DECLARATIVE_CONFIG: /home/kong/kong.yml + KONG_DNS_ORDER: LAST,A,CNAME + KONG_PLUGINS: request-transformer,cors,key-auth,acl,basic-auth + KONG_NGINX_PROXY_PROXY_BUFFER_SIZE: 160k + KONG_NGINX_PROXY_PROXY_BUFFERS: 64 160k + SUPABASE_ANON_KEY: ${ANON_KEY} + SUPABASE_SERVICE_KEY: ${SERVICE_ROLE_KEY} + DASHBOARD_USERNAME: ${DASHBOARD_USERNAME} + DASHBOARD_PASSWORD: ${DASHBOARD_PASSWORD} + entrypoint: bash -c 'eval "echo \"$$(cat ~/temp.yml)\"" > ~/kong.yml && /docker-entrypoint.sh kong docker-start' + networks: + - traefik + labels: + - "traefik.enable=true" + - "traefik.http.routers.kong.rule=Host(`kong.flowsint.localhost`)" + - "traefik.http.services.kong.loadbalancer.server.port=8000" + + auth: + container_name: supabase-auth + image: supabase/gotrue:v2.170.0 + restart: unless-stopped + healthcheck: + test: + [ + "CMD", + "wget", + "--no-verbose", + "--tries=1", + "--spider", + "http://localhost:9999/health" + ] + timeout: 5s + interval: 5s + retries: 3 + depends_on: + db: + condition: service_healthy + analytics: + condition: service_healthy + environment: + GOTRUE_API_HOST: 0.0.0.0 + GOTRUE_API_PORT: 9999 + API_EXTERNAL_URL: ${API_EXTERNAL_URL} + GOTRUE_DB_DRIVER: postgres + GOTRUE_DB_DATABASE_URL: postgres://supabase_auth_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB} + GOTRUE_SITE_URL: ${SITE_URL} + GOTRUE_URI_ALLOW_LIST: ${ADDITIONAL_REDIRECT_URLS} + GOTRUE_DISABLE_SIGNUP: ${DISABLE_SIGNUP} + GOTRUE_JWT_ADMIN_ROLES: service_role + GOTRUE_JWT_AUD: authenticated + GOTRUE_JWT_DEFAULT_GROUP_NAME: authenticated + GOTRUE_JWT_EXP: ${JWT_EXPIRY} + GOTRUE_JWT_SECRET: ${JWT_SECRET} + GOTRUE_EXTERNAL_EMAIL_ENABLED: ${ENABLE_EMAIL_SIGNUP} + GOTRUE_EXTERNAL_ANONYMOUS_USERS_ENABLED: ${ENABLE_ANONYMOUS_USERS} + GOTRUE_MAILER_AUTOCONFIRM: ${ENABLE_EMAIL_AUTOCONFIRM} + GOTRUE_SMTP_ADMIN_EMAIL: ${SMTP_ADMIN_EMAIL} + GOTRUE_SMTP_HOST: ${SMTP_HOST} + GOTRUE_SMTP_PORT: ${SMTP_PORT} + GOTRUE_SMTP_USER: ${SMTP_USER} + GOTRUE_SMTP_PASS: ${SMTP_PASS} + GOTRUE_SMTP_SENDER_NAME: ${SMTP_SENDER_NAME} + GOTRUE_MAILER_URLPATHS_INVITE: ${MAILER_URLPATHS_INVITE} + GOTRUE_MAILER_URLPATHS_CONFIRMATION: ${MAILER_URLPATHS_CONFIRMATION} + GOTRUE_MAILER_URLPATHS_RECOVERY: ${MAILER_URLPATHS_RECOVERY} + GOTRUE_MAILER_URLPATHS_EMAIL_CHANGE: ${MAILER_URLPATHS_EMAIL_CHANGE} + GOTRUE_EXTERNAL_PHONE_ENABLED: ${ENABLE_PHONE_SIGNUP} + GOTRUE_SMS_AUTOCONFIRM: ${ENABLE_PHONE_AUTOCONFIRM} + networks: + - traefik + + rest: + container_name: supabase-rest + image: postgrest/postgrest:v12.2.8 + restart: unless-stopped + depends_on: + db: + condition: service_healthy + analytics: + condition: service_healthy + environment: + PGRST_DB_URI: postgres://authenticator:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB} + PGRST_DB_SCHEMAS: ${PGRST_DB_SCHEMAS} + PGRST_DB_ANON_ROLE: anon + PGRST_JWT_SECRET: ${JWT_SECRET} + PGRST_DB_USE_LEGACY_GUCS: "false" + PGRST_APP_SETTINGS_JWT_SECRET: ${JWT_SECRET} + PGRST_APP_SETTINGS_JWT_EXP: ${JWT_EXPIRY} + command: + [ + "postgrest" + ] + networks: + - traefik + + realtime: + container_name: realtime-dev.supabase-realtime + image: supabase/realtime:v2.34.40 + restart: unless-stopped + depends_on: + db: + condition: service_healthy + analytics: + condition: service_healthy + healthcheck: + test: + [ + "CMD", + "curl", + "-sSfL", + "--head", + "-o", + "/dev/null", + "-H", + "Authorization: Bearer ${ANON_KEY}", + "http://localhost:4000/api/tenants/realtime-dev/health" + ] + timeout: 5s + interval: 5s + retries: 3 + environment: + PORT: 4000 + DB_HOST: ${POSTGRES_HOST} + DB_PORT: ${POSTGRES_PORT} + DB_USER: supabase_admin + DB_PASSWORD: ${POSTGRES_PASSWORD} + DB_NAME: ${POSTGRES_DB} + DB_AFTER_CONNECT_QUERY: 'SET search_path TO _realtime' + DB_ENC_KEY: supabaserealtime + API_JWT_SECRET: ${JWT_SECRET} + SECRET_KEY_BASE: ${SECRET_KEY_BASE} + ERL_AFLAGS: -proto_dist inet_tcp + DNS_NODES: "''" + RLIMIT_NOFILE: "10000" + APP_NAME: realtime + SEED_SELF_HOST: true + RUN_JANITOR: true + networks: + - traefik + + storage: + container_name: supabase-storage + image: supabase/storage-api:v1.19.3 + restart: unless-stopped + volumes: + - ./backend/volumes/storage:/var/lib/storage:z + healthcheck: + test: + [ + "CMD", + "wget", + "--no-verbose", + "--tries=1", + "--spider", + "http://storage:5000/status" + ] + timeout: 5s + interval: 5s + retries: 3 + depends_on: + db: + condition: service_healthy + rest: + condition: service_started + imgproxy: + condition: service_started + environment: + ANON_KEY: ${ANON_KEY} + SERVICE_KEY: ${SERVICE_ROLE_KEY} + POSTGREST_URL: http://rest:3000 + PGRST_JWT_SECRET: ${JWT_SECRET} + DATABASE_URL: postgres://supabase_storage_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB} + FILE_SIZE_LIMIT: 52428800 + 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://imgproxy:5001 + networks: + - traefik + + imgproxy: + container_name: supabase-imgproxy + image: darthsim/imgproxy:v3.8.0 + restart: unless-stopped + volumes: + - ./backend/volumes/storage:/var/lib/storage:z + healthcheck: + test: + [ + "CMD", + "imgproxy", + "health" + ] + timeout: 5s + interval: 5s + retries: 3 + environment: + IMGPROXY_BIND: ":5001" + IMGPROXY_LOCAL_FILESYSTEM_ROOT: / + IMGPROXY_USE_ETAG: "true" + IMGPROXY_ENABLE_WEBP_DETECTION: ${IMGPROXY_ENABLE_WEBP_DETECTION} + networks: + - traefik + + meta: + container_name: supabase-meta + image: supabase/postgres-meta:v0.86.1 + restart: unless-stopped + depends_on: + db: + condition: service_healthy + analytics: + condition: service_healthy + environment: + PG_META_PORT: 8080 + PG_META_DB_HOST: ${POSTGRES_HOST} + PG_META_DB_PORT: ${POSTGRES_PORT} + PG_META_DB_NAME: ${POSTGRES_DB} + PG_META_DB_USER: supabase_admin + PG_META_DB_PASSWORD: ${POSTGRES_PASSWORD} + networks: + - traefik + + functions: + container_name: supabase-edge-functions + image: supabase/edge-runtime:v1.67.2 + restart: unless-stopped + volumes: + - ./backend/volumes/functions:/home/deno/functions:Z + depends_on: + analytics: + condition: service_healthy + environment: + JWT_SECRET: ${JWT_SECRET} + SUPABASE_URL: http://kong:8000 + SUPABASE_ANON_KEY: ${ANON_KEY} + SUPABASE_SERVICE_ROLE_KEY: ${SERVICE_ROLE_KEY} + SUPABASE_DB_URL: postgresql://postgres:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB} + VERIFY_JWT: "${FUNCTIONS_VERIFY_JWT}" + command: + [ + "start", + "--main-service", + "/home/deno/functions/main" + ] + networks: + - traefik + labels: + - "traefik.enable=true" + - "traefik.http.routers.functions.rule=Host(`functions.flowsint.localhost`)" + - "traefik.http.services.functions.loadbalancer.server.port=9000" + + analytics: + container_name: supabase-analytics + image: supabase/logflare:1.12.5 + restart: unless-stopped + ports: + - 4000:4000 + healthcheck: + test: + [ + "CMD", + "curl", + "http://localhost:4000/health" + ] + timeout: 5s + interval: 5s + retries: 10 + depends_on: + db: + condition: service_healthy + environment: + LOGFLARE_NODE_HOST: 127.0.0.1 + DB_USERNAME: supabase_admin + DB_DATABASE: _supabase + DB_HOSTNAME: ${POSTGRES_HOST} + DB_PORT: ${POSTGRES_PORT} + DB_PASSWORD: ${POSTGRES_PASSWORD} + DB_SCHEMA: _analytics + LOGFLARE_API_KEY: ${LOGFLARE_API_KEY} + LOGFLARE_SINGLE_TENANT: true + LOGFLARE_SUPABASE_MODE: true + LOGFLARE_MIN_CLUSTER_SIZE: 1 + POSTGRES_BACKEND_URL: postgresql://supabase_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/_supabase + POSTGRES_BACKEND_SCHEMA: _analytics + LOGFLARE_FEATURE_FLAG_OVERRIDE: multibackend=true + networks: + - traefik + + db: + container_name: supabase-db + image: supabase/postgres:15.8.1.049 + restart: unless-stopped + volumes: + - ./backend/volumes/db/realtime.sql:/docker-entrypoint-initdb.d/migrations/99-realtime.sql:Z + - ./backend/volumes/db/webhooks.sql:/docker-entrypoint-initdb.d/init-scripts/98-webhooks.sql:Z + - ./backend/volumes/db/roles.sql:/docker-entrypoint-initdb.d/init-scripts/99-roles.sql:Z + - ./backend/volumes/db/jwt.sql:/docker-entrypoint-initdb.d/init-scripts/99-jwt.sql:Z + - ./backend/volumes/db/data:/var/lib/postgresql/data:Z + - ./backend/volumes/db/_supabase.sql:/docker-entrypoint-initdb.d/migrations/97-_supabase.sql:Z + - ./backend/volumes/db/logs.sql:/docker-entrypoint-initdb.d/migrations/99-logs.sql:Z + - ./backend/volumes/db/pooler.sql:/docker-entrypoint-initdb.d/migrations/99-pooler.sql:Z + - db-config:/etc/postgresql-custom + healthcheck: + test: + [ + "CMD", + "pg_isready", + "-U", + "postgres", + "-h", + "localhost" + ] + interval: 5s + timeout: 5s + retries: 10 + depends_on: + vector: + condition: service_healthy + environment: + POSTGRES_HOST: /var/run/postgresql + PGPORT: ${POSTGRES_PORT} + POSTGRES_PORT: ${POSTGRES_PORT} + PGPASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + PGDATABASE: ${POSTGRES_DB} + POSTGRES_DB: ${POSTGRES_DB} + JWT_SECRET: ${JWT_SECRET} + JWT_EXP: ${JWT_EXPIRY} + command: + [ + "postgres", + "-c", + "config_file=/etc/postgresql/postgresql.conf", + "-c", + "log_min_messages=fatal" + ] + networks: + - traefik + + vector: + container_name: supabase-vector + image: timberio/vector:0.28.1-alpine + restart: unless-stopped + volumes: + - ./backend/volumes/logs/vector.yml:/etc/vector/vector.yml:ro,z + - ${DOCKER_SOCKET_LOCATION}:/var/run/docker.sock:ro,z + healthcheck: + test: + [ + "CMD", + "wget", + "--no-verbose", + "--tries=1", + "--spider", + "http://vector:9001/health" + ] + timeout: 5s + interval: 5s + retries: 3 + environment: + LOGFLARE_API_KEY: ${LOGFLARE_API_KEY} + command: + [ + "--config", + "/etc/vector/vector.yml" + ] + security_opt: + - "label=disable" + networks: + - traefik + + supavisor: + container_name: supabase-pooler + image: supabase/supavisor:2.4.12 + restart: unless-stopped + ports: + - ${POSTGRES_PORT}:5432 + - ${POOLER_PROXY_PORT_TRANSACTION}:6543 + volumes: + - ./backend/volumes/pooler/pooler.exs:/etc/pooler/pooler.exs:ro,z + healthcheck: + test: + [ + "CMD", + "curl", + "-sSfL", + "--head", + "-o", + "/dev/null", + "http://127.0.0.1:4000/api/health" + ] + interval: 10s + timeout: 5s + retries: 5 + depends_on: + db: + condition: service_healthy + analytics: + condition: service_healthy + environment: + PORT: 4000 + POSTGRES_PORT: ${POSTGRES_PORT} + POSTGRES_DB: ${POSTGRES_DB} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + DATABASE_URL: ecto://supabase_admin:${POSTGRES_PASSWORD}@db:${POSTGRES_PORT}/_supabase + CLUSTER_POSTGRES: true + SECRET_KEY_BASE: ${SECRET_KEY_BASE} + VAULT_ENC_KEY: ${VAULT_ENC_KEY} + API_JWT_SECRET: ${JWT_SECRET} + METRICS_JWT_SECRET: ${JWT_SECRET} + REGION: local + ERL_AFLAGS: -proto_dist inet_tcp + POOLER_TENANT_ID: ${POOLER_TENANT_ID} + POOLER_DEFAULT_POOL_SIZE: ${POOLER_DEFAULT_POOL_SIZE} + POOLER_MAX_CLIENT_CONN: ${POOLER_MAX_CLIENT_CONN} + POOLER_POOL_MODE: transaction + command: + [ + "/bin/sh", + "-c", + "/app/bin/migrate && /app/bin/supavisor eval \"$$(cat /etc/pooler/pooler.exs)\" && /app/bin/server" + ] + networks: + - traefik + +networks: + traefik: + name: traefik + driver: bridge + +volumes: + db-config: \ No newline at end of file diff --git a/flowsint-api/docker-compose.yml b/flowsint-api/docker-compose.yml deleted file mode 100644 index 2aa2c33..0000000 --- a/flowsint-api/docker-compose.yml +++ /dev/null @@ -1,28 +0,0 @@ -services: - app: - build: - context: . - dockerfile: Dockerfile - ports: - - "5000:5000" - depends_on: - - redis - environment: - - REDIS_URL=redis://redis:6379/0 - command: ["/app/entrypoint.sh", "app"] - - celery: - build: - context: . - dockerfile: Dockerfile - depends_on: - - redis - - app - environment: - - REDIS_URL=redis://redis:6379/0 - command: ["/app/entrypoint.sh", "celery"] - - redis: - image: "redis:alpine" - ports: - - "6379:6379" diff --git a/flowsint-web/Dockerfile b/flowsint-web/Dockerfile index 408ce55..4db8d4b 100644 --- a/flowsint-web/Dockerfile +++ b/flowsint-web/Dockerfile @@ -1,7 +1,66 @@ -FROM node:18 +# syntax=docker.io/docker/dockerfile:1 + +FROM node:18-alpine AS base + +# Install dependencies only when needed +FROM base AS deps +# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. +RUN apk add --no-cache libc6-compat WORKDIR /app -COPY package.json yarn.lock ./ -RUN pnpm install + +# Install dependencies based on the preferred package manager +COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./ +RUN \ + if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ + elif [ -f package-lock.json ]; then npm ci; \ + elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \ + else echo "Lockfile not found." && exit 1; \ + fi + + +# Rebuild the source code only when needed +FROM base AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules COPY . . + +# Next.js collects completely anonymous telemetry data about general usage. +# Learn more here: https://nextjs.org/telemetry +# Uncomment the following line in case you want to disable telemetry during the build. +# ENV NEXT_TELEMETRY_DISABLED=1 + +RUN \ + if [ -f yarn.lock ]; then yarn run build; \ + elif [ -f package-lock.json ]; then npm run build; \ + elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \ + else echo "Lockfile not found." && exit 1; \ + fi + +# Production image, copy all the files and run next +FROM base AS runner +WORKDIR /app + +ENV NODE_ENV=production +# Uncomment the following line in case you want to disable telemetry during runtime. +# ENV NEXT_TELEMETRY_DISABLED=1 + +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 nextjs + +COPY --from=builder /app/public ./public + +# Automatically leverage output traces to reduce image size +# https://nextjs.org/docs/advanced-features/output-file-tracing +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static + +USER nextjs + EXPOSE 3000 -CMD ["yarn", "dev"] + +ENV PORT=3000 + +# server.js is created by next build from the standalone output +# https://nextjs.org/docs/pages/api-reference/config/next-config-js/output +ENV HOSTNAME="0.0.0.0" +CMD ["node", "server.js"] \ No newline at end of file diff --git a/flowsint-web/next.config.js b/flowsint-web/next.config.js index 2dd01c7..52a13a9 100644 --- a/flowsint-web/next.config.js +++ b/flowsint-web/next.config.js @@ -1,5 +1,6 @@ /** @type {import('next').NextConfig} */ const nextConfig = { + output: "standalone", experimental: { authInterrupts: true, }, diff --git a/flowsint-web/src/app/auth/confirm/route.ts b/flowsint-web/src/app/auth/confirm/route.ts index 4a46dca..beee77c 100644 --- a/flowsint-web/src/app/auth/confirm/route.ts +++ b/flowsint-web/src/app/auth/confirm/route.ts @@ -22,7 +22,6 @@ export async function GET(request: NextRequest) { redirect(next) } } - // redirect the user to an error page with some instructions redirect('/error') } \ No newline at end of file diff --git a/flowsint-web/src/app/dashboard/page.tsx b/flowsint-web/src/app/dashboard/page.tsx index 57c2009..332f634 100644 --- a/flowsint-web/src/app/dashboard/page.tsx +++ b/flowsint-web/src/app/dashboard/page.tsx @@ -46,7 +46,7 @@ const DashboardPage = () => {
- {JSON.stringify(data, null, 2)}
-
- )
+ toast.success("Appearance settings updated.")
}
return (
diff --git a/flowsint-web/src/app/dashboard/settings/display/display-form.tsx b/flowsint-web/src/app/dashboard/settings/display/display-form.tsx
index 9139caa..a5afc10 100644
--- a/flowsint-web/src/app/dashboard/settings/display/display-form.tsx
+++ b/flowsint-web/src/app/dashboard/settings/display/display-form.tsx
@@ -64,11 +64,7 @@ export function DisplayForm() {
})
function onSubmit(data: DisplayFormValues) {
- toast(
-
- {JSON.stringify(data, null, 2)}
-
- )
+ toast.success("Display settings updated.")
}
return (
diff --git a/flowsint-web/src/app/error.tsx b/flowsint-web/src/app/error.tsx
index e260a7e..18bcb97 100644
--- a/flowsint-web/src/app/error.tsx
+++ b/flowsint-web/src/app/error.tsx
@@ -13,7 +13,6 @@ export default function Error({
reset: () => void
}) {
useEffect(() => {
- // Log the error to an error reporting service
console.error(error)
}, [error])
diff --git a/flowsint-web/src/components/app-sidebar.tsx b/flowsint-web/src/components/app-sidebar.tsx
index 464ce21..45ad6f6 100644
--- a/flowsint-web/src/components/app-sidebar.tsx
+++ b/flowsint-web/src/components/app-sidebar.tsx
@@ -140,7 +140,7 @@ export function AppSidebar({ user, ...props }: AppSidebarProps) {