adding local docker compose with local postgres

This commit is contained in:
webcoderz 2024-03-28 11:15:46 -04:00
parent 7189f13263
commit a56ef1b06f
5 changed files with 103 additions and 2 deletions

54
docker-compose.yaml Normal file
View File

@ -0,0 +1,54 @@
version: '3.9'
services:
comfy-deploy:
build:
context: .
dockerfile: ./local/Dockerfile
restart: unless-stopped
volumes:
- ./local/scripts/entrypoint.sh:/comfyui-deploy/web/deploy_entrypoint.sh
entrypoint: /comfyui-deploy/web/deploy_entrypoint.sh
ports:
- 3000:3000
depends_on:
- postgres
- pg_proxy
- localstack
environment:
VSCODE_DEV_CONTAINER: true
### comfy-deploy services
postgres:
image: "postgres:15.2-alpine"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: verceldb
expose:
- 5432
pg_proxy:
image: ghcr.io/neondatabase/wsproxy:latest
environment:
APPEND_PORT: "postgres:5432"
ALLOW_ADDR_REGEX: ".*"
LOG_TRAFFIC: "true"
expose:
- 80
depends_on:
- postgres
localstack:
image: localstack/localstack:latest
environment:
SERVICES: s3
ports:
- 4566:4566
volumes:
- ../localstack/aws:/etc/localstack/init/ready.d
- ../localstack/aws:/app/web/aws

16
local/Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM node:21-bullseye AS comfy_deploy
RUN npm install -g bun
COPY ./web /web
WORKDIR /web
RUN cp .env.local.example .env.local
RUN bun i
ENTRYPOINT [ "bun", "dev" ]

View File

@ -0,0 +1,9 @@
#!/bin/bash
echo "comfy deploy container starting.."
echo "Running migrations.."
bun migrate-local
echo "Starting comfy deploy.."
bun dev

22
web/.env.local.example Normal file
View File

@ -0,0 +1,22 @@
POSTGRES_SSL="false"
POSTGRES_URL="postgres://postgres:postgres@postgres:5432/verceldb"
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
CLERK_SECRET_KEY=
SPACES_ENDPOINT="http://localhost:4566"
SPACES_ENDPOINT_CDN="http://localhost:4566"
SPACES_REGION="nyc3"
SPACES_BUCKET="comfyui-deploy"
SPACES_KEY="xyz"
SPACES_SECRET="aaa"
SPACES_CDN_DONT_INCLUDE_BUCKET="false"
SPACES_CDN_FORCE_PATH_STYLE="true"
MODAL_BUILDER_URL=
JWT_SECRET="openssl rand -hex 32"
PLAUSIBLE_DOMAIN=
NEXT_PUBLIC_POSTHOG_KEY="your-api-key"
NEXT_PUBLIC_POSTHOG_HOST="your-ph-address"

View File

@ -9,10 +9,10 @@ if (process.env.VERCEL_ENV !== "production") {
// Set the WebSocket proxy to work with the local instance
if (isDevContainer) {
// Running inside a VS Code devcontainer
neonConfig.wsProxy = (host) => "host.docker.internal:5481/v1";
neonConfig.wsProxy = (host) => "pg_proxy:80/v1";
} else {
// Not running inside a VS Code devcontainer
neonConfig.wsProxy = (host) => `${host}:5481/v1`;
neonConfig.wsProxy = (host) => "pg_proxy:80/v1";
}
// Disable all authentication and encryption
neonConfig.useSecureWebSocket = false;