mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-09 15:07:55 -05:00
fix(docker): added pgvector image to docker builds, modified push to migrate to ameliorate vector data type issue (#452)
* added pgvector image to docker builds, modified push to migrate to ameliorate vector data type issue * added zod and t3-ss/env-nextjs to minimal set of dependencies for db image * added healthcheck to docker services
This commit is contained in:
@@ -17,13 +17,33 @@ services:
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
migrations:
|
||||
condition: service_completed_successfully
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "3001:3001"
|
||||
working_dir: /workspace
|
||||
healthcheck:
|
||||
test: ['CMD', 'wget', '--spider', '--quiet', 'http://127.0.0.1:3000']
|
||||
interval: 90s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
|
||||
migrations:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/db.Dockerfile
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://postgres:postgres@db:5432/simstudio
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
command: ['bun', 'run', 'db:migrate']
|
||||
restart: 'no'
|
||||
|
||||
db:
|
||||
image: postgres:17-alpine
|
||||
image: pgvector/pgvector:pg17
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
-- Current sql file was generated after introspecting the database
|
||||
-- If you want to run this migration please uncomment this code before executing migrations
|
||||
/*
|
||||
|
||||
CREATE TABLE "verification" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"identifier" text NOT NULL,
|
||||
@@ -50,5 +49,4 @@ CREATE TABLE "session" (
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "account" ADD CONSTRAINT "account_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
|
||||
*/
|
||||
ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
|
||||
@@ -29,7 +29,7 @@ ALTER TABLE "user_settings" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
|
||||
DROP TABLE "logs" CASCADE;--> statement-breakpoint
|
||||
DROP TABLE "user_environment" CASCADE;--> statement-breakpoint
|
||||
DROP TABLE "user_settings" CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "workflow" ALTER COLUMN "state" SET DATA TYPE json;--> statement-breakpoint
|
||||
ALTER TABLE "workflow" ALTER COLUMN "state" SET DATA TYPE json USING state::json;--> statement-breakpoint
|
||||
ALTER TABLE "workflow_logs" ADD CONSTRAINT "workflow_logs_workflow_id_workflow_id_fk" FOREIGN KEY ("workflow_id") REFERENCES "public"."workflow"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "settings" ADD CONSTRAINT "settings_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "environment" ADD CONSTRAINT "environment_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
|
||||
@@ -27,6 +27,12 @@ services:
|
||||
condition: service_healthy
|
||||
migrations:
|
||||
condition: service_completed_successfully
|
||||
healthcheck:
|
||||
test: ['CMD', 'wget', '--spider', '--quiet', 'http://127.0.0.1:3000']
|
||||
interval: 90s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
|
||||
migrations:
|
||||
build:
|
||||
@@ -35,12 +41,13 @@ services:
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@db:5432/${POSTGRES_DB:-simstudio}
|
||||
depends_on:
|
||||
- db
|
||||
command: ['bun', 'run', 'db:push']
|
||||
db:
|
||||
condition: service_healthy
|
||||
command: ['bun', 'run', 'db:migrate']
|
||||
restart: 'no'
|
||||
|
||||
db:
|
||||
image: postgres:17-alpine
|
||||
image: pgvector/pgvector:pg17
|
||||
restart: always
|
||||
ports:
|
||||
- '5432:5432'
|
||||
|
||||
@@ -26,18 +26,25 @@ services:
|
||||
condition: service_healthy
|
||||
migrations:
|
||||
condition: service_completed_successfully
|
||||
healthcheck:
|
||||
test: ['CMD', 'wget', '--spider', '--quiet', 'http://127.0.0.1:3000']
|
||||
interval: 90s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
|
||||
migrations:
|
||||
image: ghcr.io/simstudioai/migrations:latest
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@db:5432/${POSTGRES_DB:-simstudio}
|
||||
depends_on:
|
||||
- db
|
||||
command: ['bun', 'run', 'db:push']
|
||||
db:
|
||||
condition: service_healthy
|
||||
command: ['bun', 'run', 'db:migrate']
|
||||
restart: 'no'
|
||||
|
||||
db:
|
||||
image: postgres:17-alpine
|
||||
image: pgvector/pgvector:pg17
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- '5432:5432'
|
||||
|
||||
@@ -10,7 +10,7 @@ COPY apps/sim/package.json ./apps/sim/db/
|
||||
|
||||
# Install minimal dependencies in one layer
|
||||
RUN bun install --omit dev --ignore-scripts && \
|
||||
bun install --omit dev --ignore-scripts drizzle-kit drizzle-orm postgres next-runtime-env
|
||||
bun install --omit dev --ignore-scripts drizzle-kit drizzle-orm postgres next-runtime-env zod @t3-oss/env-nextjs
|
||||
|
||||
# ========================================
|
||||
# Runner Stage: Production Environment
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "simstudio",
|
||||
"version": "0.1.17",
|
||||
"version": "0.1.18",
|
||||
"description": "Sim Studio CLI - Run Sim Studio with a single command",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
|
||||
@@ -101,7 +101,7 @@ async function main() {
|
||||
if (options.pull) {
|
||||
await pullImage('ghcr.io/simstudioai/simstudio:latest')
|
||||
await pullImage('ghcr.io/simstudioai/migrations:latest')
|
||||
await pullImage('postgres:17-alpine')
|
||||
await pullImage('pgvector/pgvector:pg17')
|
||||
}
|
||||
|
||||
// Ensure Docker network exists
|
||||
@@ -144,7 +144,7 @@ async function main() {
|
||||
`${dataDir}/postgres:/var/lib/postgresql/data`,
|
||||
'-p',
|
||||
'5432:5432',
|
||||
'postgres:17-alpine',
|
||||
'pgvector/pgvector:pg17',
|
||||
])
|
||||
|
||||
if (!dbSuccess) {
|
||||
|
||||
Reference in New Issue
Block a user