mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor(template): add domain to supabase template
This commit is contained in:
@@ -15,7 +15,13 @@ services:
|
|||||||
- dokploy-network
|
- dokploy-network
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: [ "CMD", "node", "-e", "require('http').get('http://localhost:3000/api/profile', (r) => {if (r.statusCode !== 200) throw new Error(r.statusCode)})" ]
|
test:
|
||||||
|
[
|
||||||
|
"CMD",
|
||||||
|
"node",
|
||||||
|
"-e",
|
||||||
|
"require('http').get('http://localhost:3000/api/profile', (r) => {if (r.statusCode !== 200) throw new Error(r.statusCode)})",
|
||||||
|
]
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
interval: 5s
|
interval: 5s
|
||||||
retries: 3
|
retries: 3
|
||||||
@@ -57,11 +63,6 @@ services:
|
|||||||
expose:
|
expose:
|
||||||
- 8000
|
- 8000
|
||||||
- 8443
|
- 8443
|
||||||
labels:
|
|
||||||
- traefik.enable=true
|
|
||||||
- traefik.http.routers.frontend-app.rule=Host(`${SUPABASE_HOST}`)
|
|
||||||
- traefik.http.routers.frontend-app.entrypoints=web
|
|
||||||
- traefik.http.services.frontend-app.loadbalancer.server.port=${KONG_HTTP_PORT}
|
|
||||||
depends_on:
|
depends_on:
|
||||||
analytics:
|
analytics:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -93,7 +94,15 @@ services:
|
|||||||
analytics:
|
analytics:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9999/health" ]
|
test:
|
||||||
|
[
|
||||||
|
"CMD",
|
||||||
|
"wget",
|
||||||
|
"--no-verbose",
|
||||||
|
"--tries=1",
|
||||||
|
"--spider",
|
||||||
|
"http://localhost:9999/health",
|
||||||
|
]
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
interval: 5s
|
interval: 5s
|
||||||
retries: 3
|
retries: 3
|
||||||
@@ -145,9 +154,6 @@ services:
|
|||||||
# GOTRUE_HOOK_PASSWORD_VERIFICATION_ATTEMPT_ENABLED="true"
|
# GOTRUE_HOOK_PASSWORD_VERIFICATION_ATTEMPT_ENABLED="true"
|
||||||
# GOTRUE_HOOK_PASSWORD_VERIFICATION_ATTEMPT_URI="pg-functions://postgres/public/password_verification_attempt"
|
# GOTRUE_HOOK_PASSWORD_VERIFICATION_ATTEMPT_URI="pg-functions://postgres/public/password_verification_attempt"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rest:
|
rest:
|
||||||
container_name: supabase-rest
|
container_name: supabase-rest
|
||||||
image: postgrest/postgrest:v12.2.0
|
image: postgrest/postgrest:v12.2.0
|
||||||
@@ -183,7 +189,18 @@ services:
|
|||||||
analytics:
|
analytics:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: [ "CMD", "curl", "-sSfL", "--head", "-o", "/dev/null", "-H", "Authorization: Bearer ${ANON_KEY}", "http://localhost:4000/api/tenants/realtime-dev/health" ]
|
test:
|
||||||
|
[
|
||||||
|
"CMD",
|
||||||
|
"curl",
|
||||||
|
"-sSfL",
|
||||||
|
"--head",
|
||||||
|
"-o",
|
||||||
|
"/dev/null",
|
||||||
|
"-H",
|
||||||
|
"Authorization: Bearer ${ANON_KEY}",
|
||||||
|
"http://localhost:4000/api/tenants/realtime-dev/health",
|
||||||
|
]
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
interval: 5s
|
interval: 5s
|
||||||
retries: 3
|
retries: 3
|
||||||
@@ -195,7 +212,7 @@ services:
|
|||||||
DB_USER: supabase_admin
|
DB_USER: supabase_admin
|
||||||
DB_PASSWORD: ${POSTGRES_PASSWORD}
|
DB_PASSWORD: ${POSTGRES_PASSWORD}
|
||||||
DB_NAME: ${POSTGRES_DB}
|
DB_NAME: ${POSTGRES_DB}
|
||||||
DB_AFTER_CONNECT_QUERY: 'SET search_path TO _realtime'
|
DB_AFTER_CONNECT_QUERY: "SET search_path TO _realtime"
|
||||||
DB_ENC_KEY: supabaserealtime
|
DB_ENC_KEY: supabaserealtime
|
||||||
API_JWT_SECRET: ${JWT_SECRET}
|
API_JWT_SECRET: ${JWT_SECRET}
|
||||||
SECRET_KEY_BASE: UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq
|
SECRET_KEY_BASE: UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq
|
||||||
@@ -220,7 +237,15 @@ services:
|
|||||||
imgproxy:
|
imgproxy:
|
||||||
condition: service_started
|
condition: service_started
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:5000/status" ]
|
test:
|
||||||
|
[
|
||||||
|
"CMD",
|
||||||
|
"wget",
|
||||||
|
"--no-verbose",
|
||||||
|
"--tries=1",
|
||||||
|
"--spider",
|
||||||
|
"http://localhost:5000/status",
|
||||||
|
]
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
interval: 5s
|
interval: 5s
|
||||||
retries: 3
|
retries: 3
|
||||||
@@ -249,7 +274,7 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- dokploy-network
|
- dokploy-network
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: [ "CMD", "imgproxy", "health" ]
|
test: ["CMD", "imgproxy", "health"]
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
interval: 5s
|
interval: 5s
|
||||||
retries: 3
|
retries: 3
|
||||||
@@ -311,7 +336,7 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- dokploy-network
|
- dokploy-network
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: [ "CMD", "curl", "http://localhost:4000/health" ]
|
test: ["CMD", "curl", "http://localhost:4000/health"]
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
interval: 5s
|
interval: 5s
|
||||||
retries: 10
|
retries: 10
|
||||||
@@ -410,13 +435,12 @@ services:
|
|||||||
healthcheck:
|
healthcheck:
|
||||||
test:
|
test:
|
||||||
[
|
[
|
||||||
|
|
||||||
"CMD",
|
"CMD",
|
||||||
"wget",
|
"wget",
|
||||||
"--no-verbose",
|
"--no-verbose",
|
||||||
"--tries=1",
|
"--tries=1",
|
||||||
"--spider",
|
"--spider",
|
||||||
"http://vector:9001/health"
|
"http://vector:9001/health",
|
||||||
]
|
]
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
interval: 5s
|
interval: 5s
|
||||||
@@ -426,12 +450,11 @@ services:
|
|||||||
- ${DOCKER_SOCKET_LOCATION}:/var/run/docker.sock:ro
|
- ${DOCKER_SOCKET_LOCATION}:/var/run/docker.sock:ro
|
||||||
environment:
|
environment:
|
||||||
LOGFLARE_API_KEY: ${LOGFLARE_API_KEY}
|
LOGFLARE_API_KEY: ${LOGFLARE_API_KEY}
|
||||||
command: [ "--config", "etc/vector/vector.yml" ]
|
command: ["--config", "etc/vector/vector.yml"]
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
db-config:
|
db-config:
|
||||||
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
dokploy-network:
|
dokploy-network:
|
||||||
external: true
|
external: true
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { createHmac, randomBytes } from "node:crypto";
|
import { createHmac } from "node:crypto";
|
||||||
import {
|
import {
|
||||||
|
type DomainSchema,
|
||||||
type Schema,
|
type Schema,
|
||||||
type Template,
|
type Template,
|
||||||
generateBase64,
|
generateBase64,
|
||||||
generateHash,
|
|
||||||
generatePassword,
|
generatePassword,
|
||||||
generateRandomDomain,
|
generateRandomDomain,
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
@@ -61,8 +61,7 @@ export function generateSupabaseServiceJWT(secret: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function generate(schema: Schema): Template {
|
export function generate(schema: Schema): Template {
|
||||||
const mainServiceHash = generateHash(schema.projectName);
|
const mainDomain = generateRandomDomain(schema);
|
||||||
const randomDomain = generateRandomDomain(schema);
|
|
||||||
|
|
||||||
const postgresPassword = generatePassword(32);
|
const postgresPassword = generatePassword(32);
|
||||||
const jwtSecret = generateBase64(32);
|
const jwtSecret = generateBase64(32);
|
||||||
@@ -71,9 +70,16 @@ export function generate(schema: Schema): Template {
|
|||||||
|
|
||||||
const annonKey = generateSupabaseAnonJWT(jwtSecret);
|
const annonKey = generateSupabaseAnonJWT(jwtSecret);
|
||||||
const serviceRoleKey = generateSupabaseServiceJWT(jwtSecret);
|
const serviceRoleKey = generateSupabaseServiceJWT(jwtSecret);
|
||||||
|
const domains: DomainSchema[] = [
|
||||||
|
{
|
||||||
|
serviceName: "kong",
|
||||||
|
host: mainDomain,
|
||||||
|
port: 8000,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const envs = [
|
const envs = [
|
||||||
`SUPABASE_HOST=${randomDomain}`,
|
`SUPABASE_HOST=${mainDomain}`,
|
||||||
`POSTGRES_PASSWORD=${postgresPassword}`,
|
`POSTGRES_PASSWORD=${postgresPassword}`,
|
||||||
`JWT_SECRET=${jwtSecret}`,
|
`JWT_SECRET=${jwtSecret}`,
|
||||||
`ANON_KEY=${annonKey}`,
|
`ANON_KEY=${annonKey}`,
|
||||||
@@ -114,7 +120,6 @@ export function generate(schema: Schema): Template {
|
|||||||
"DOCKER_SOCKET_LOCATION=/var/run/docker.sock",
|
"DOCKER_SOCKET_LOCATION=/var/run/docker.sock",
|
||||||
"GOOGLE_PROJECT_ID=GOOGLE_PROJECT_ID",
|
"GOOGLE_PROJECT_ID=GOOGLE_PROJECT_ID",
|
||||||
"GOOGLE_PROJECT_NUMBER=GOOGLE_PROJECT_NUMBER",
|
"GOOGLE_PROJECT_NUMBER=GOOGLE_PROJECT_NUMBER",
|
||||||
`HASH=${mainServiceHash}`,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const mounts: Template["mounts"] = [
|
const mounts: Template["mounts"] = [
|
||||||
@@ -983,6 +988,7 @@ sinks:
|
|||||||
];
|
];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
domains,
|
||||||
envs,
|
envs,
|
||||||
mounts,
|
mounts,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user