The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Add Vector to route logs from Docker to Logflare
Filipe Cabaco761d85abedbb
diff --git a/docker/.env.example b/docker/.env.exampleindex 3e78aeb4d0f..22554e9db66 100644--- a/docker/.env.example+++ b/docker/.env.example@@ -85,4 +85,9 @@ IMGPROXY_ENABLE_WEBP_DETECTION=true############LOGFLARE_LOGGER_BACKEND_API_KEY=your-super-secret-and-long-logflare-key+# Change vector.toml sinks.logflare to reflect this changeLOGFLARE_HTTP_PORT=4001+LOGFLARE_API_KEY=your-super-secret-and-long-logflare-key+# Change vector.toml sources.docker_syslog to reflect this change+VECTOR_PORT=9000+VECTOR_API_PORT=9001\ No newline at end of filediff --git a/docker/docker-compose.yml b/docker/docker-compose.ymlindex 51f3beef7a6..a758ed798ab 100644--- a/docker/docker-compose.yml+++ b/docker/docker-compose.yml@@ -11,6 +11,14 @@ services:container_name: supabase-studioimage: supabase/studio:20230216-e731b77restart: unless-stopped+ logging:+ driver: syslog+ options:+ syslog-address: "tcp://localhost:${VECTOR_PORT}"+ tag: studio+ depends_on:+ logs:+ condition: service_healthyhealthcheck:test:[@@ -40,6 +48,14 @@ services:container_name: supabase-kongimage: kong:2.8.1restart: unless-stopped+ logging:+ driver: syslog+ options:+ syslog-address: "tcp://localhost:${VECTOR_PORT}"+ tag: kong+ depends_on:+ logs:+ condition: service_healthyports:- ${KONG_HTTP_PORT}:8000/tcp- ${KONG_HTTPS_PORT}:8443/tcp@@ -62,6 +78,13 @@ services:db:# Disable this if you are using an external Postgres databasecondition: service_healthy+ logs:+ condition: service_healthy+ logging:+ driver: syslog+ options:+ syslog-address: "tcp://localhost:${VECTOR_PORT}"+ tag: authhealthcheck:test:[@@ -120,7 +143,14 @@ services:db:# Disable this if you are using an external Postgres databasecondition: service_healthy+ logs:+ condition: service_healthyrestart: unless-stopped+ logging:+ driver: syslog+ options:+ syslog-address: "tcp://localhost:${VECTOR_PORT}"+ tag: restenvironment:PGRST_DB_URI: postgres://authenticator:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}PGRST_DB_SCHEMAS: ${PGRST_DB_SCHEMAS}@@ -135,6 +165,13 @@ services:db:# Disable this if you are using an external Postgres databasecondition: service_healthy+ logs:+ condition: service_healthy+ logging:+ driver: syslog+ options:+ syslog-address: "tcp://localhost:${VECTOR_PORT}"+ tag: realtimehealthcheck:test:[@@ -168,7 +205,7 @@ services:logs:container_name: supabase-logs- image: supabase/logflare:1.0.0+ image: supabase/logflare:latesthealthcheck:test:[@@ -188,6 +225,8 @@ services:db:# Disable this if you are using an external Postgres databasecondition: service_healthy+ vector:+ condition: service_healthyports:- ${LOGFLARE_HTTP_PORT}:4000/tcpvolumes:@@ -205,6 +244,7 @@ services:DB_PASSWORD: ${POSTGRES_PASSWORD}DB_NAME: ${POSTGRES_DB}LOGFLARE_SINGLE_TENANT: true+ LOGFLARE_API_KEY: ${LOGFLARE_API_KEY}GOOGLE_PROJECT_ID: logflare-dev-238720GOOGLE_PROJECT_NUMBER: 1023172132421@@ -219,6 +259,13 @@ services:condition: service_startedimgproxy:condition: service_started+ logs:+ condition: service_healthy+ logging:+ driver: syslog+ options:+ syslog-address: "tcp://localhost:${VECTOR_PORT}"+ tag: storagehealthcheck:test:[@@ -274,6 +321,14 @@ services:db:# Disable this if you are using an external Postgres databasecondition: service_healthy+ logs:+ condition: service_healthy++ logging:+ driver: syslog+ options:+ syslog-address: "tcp://localhost:${VECTOR_PORT}"+ tag: metarestart: unless-stoppedenvironment:PG_META_PORT: 8080@@ -287,11 +342,19 @@ services:db:container_name: supabase-dbimage: supabase/postgres:15.1.0.54-rc0+ logging:+ driver: syslog+ options:+ syslog-address: "tcp://localhost:${VECTOR_PORT}"+ tag: dbhealthcheck:test: pg_isready -U postgres -h localhostinterval: 5stimeout: 5sretries: 10+ depends_on:+ vector:+ condition: service_healthycommand:- postgres- -c@@ -318,3 +381,26 @@ services:- ./volumes/db/roles.sql:/docker-entrypoint-initdb.d/init-scripts/99-roles.sql:Z# PGDATA directory is persisted between restarts- ./volumes/db/data:/var/lib/postgresql/data:Z+ vector:+ container_name: supabase-vector+ image: timberio/vector:0.28.1-alpine+ healthcheck:+ test:+ [++ "CMD",+ "wget",+ "--no-verbose",+ "--tries=1",+ "--spider",+ "http://localhost:9001/health"+ ]+ timeout: 5s+ interval: 5s+ retries: 3++ ports:+ - ${VECTOR_PORT}:${VECTOR_PORT}+ - ${VECTOR_API_PORT}:${VECTOR_API_PORT}+ volumes:+ - $PWD/vector.toml:/etc/vector/vector.toml:rodiff --git a/docker/vector.toml b/docker/vector.tomlnew file mode 100644index 00000000000..967f8160ec2--- /dev/null+++ b/docker/vector.toml@@ -0,0 +1,80 @@+[api]+enabled = true+address = "0.0.0.0:9001"++[sources.docker_syslog]+type = "syslog"+address = "0.0.0.0:9000"+mode = "tcp"+path = "/tmp/socket"++[transforms.router]+type = "route"+inputs = [ "docker_syslog" ]+ [transforms.router.route]+ studio = '.appname == "studio"'+ kong = '.appname == "kong"'+ auth = '.appname == "auth"'+ rest = '.appname == "rest"'+ realtime = '.appname == "realtime"'+ storage = '.appname == "storage"'+ imgproxy = '.appname == "imgproxy"'+ meta = '.appname == "meta"'+ db = '.appname == "db"'++[sinks.logflare_auth]+type = "http"+inputs = [ "router.auth" ]+encoding.codec = "json"+method = "post"+uri = "http://logs:4000/api/logs?source_name=gotrue.logs.prod&api_key=gd9tDpgiCVJe"++[sinks.logflare_realtime]+type = "http"+inputs = [ "router.realtime" ]+encoding.codec = "json"+method = "post"+uri = "http://logs:4000/api/logs?source_name=realtime.logs.prod&api_key=gd9tDpgiCVJe"++[sinks.studio]+inputs = ["router.studio"]+target = "stdout"+type = "console"+encoding.codec = "json"++[sinks.kong]+inputs = ["router.kong"]+target = "stdout"+type = "console"+encoding.codec = "json"++[sinks.rest]+inputs = ["router.rest"]+target = "stdout"+type = "console"+encoding.codec = "json"++[sinks.storage]+inputs = ["router.storage"]+target = "stdout"+type = "console"+encoding.codec = "json"++[sinks.imgproxy]+inputs = ["router.imgproxy"]+target = "stdout"+type = "console"+encoding.codec = "json"++[sinks.meta]+inputs = ["router.meta"]+target = "stdout"+type = "console"+encoding.codec = "json"++[sinks.db]+inputs = ["router.db"]+target = "stdout"+type = "console"+encoding.codec = "json"+