devx: run server locally with s3 minio container
This commit is contained in:
parent
ee48abb737
commit
f1fc61c0cf
10
.env.dev
10
.env.dev
@ -8,3 +8,13 @@ METRICS_PORT=9090
|
||||
|
||||
# Uncomment to enable centralized logging for AI debugging (creates .logs directory)
|
||||
DANGEROUSLY_LOG_TO_SERVER_FOR_AI_AUTO_DEBUGGING=true
|
||||
|
||||
# --- Local S3/MinIO ---
|
||||
# Defaults for local MinIO started via `yarn s3`
|
||||
S3_HOST=localhost
|
||||
S3_PORT=9000
|
||||
S3_USE_SSL=false
|
||||
S3_ACCESS_KEY=minioadmin
|
||||
S3_SECRET_KEY=minioadmin
|
||||
S3_BUCKET=happy
|
||||
S3_PUBLIC_URL=http://localhost:9000/happy
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@ node_modules
|
||||
.env
|
||||
dist
|
||||
.pgdata
|
||||
.minio
|
||||
|
||||
.env.local
|
||||
.env
|
||||
|
@ -16,7 +16,10 @@
|
||||
"generate": "prisma generate",
|
||||
"postinstall": "prisma generate",
|
||||
"db": "docker run -d -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=handy -v $(pwd)/.pgdata:/var/lib/postgresql/data -p 5432:5432 postgres",
|
||||
"redis": "docker run -d -p 6379:6379 redis"
|
||||
"redis": "docker run -d -p 6379:6379 redis",
|
||||
"s3": "docker run -d --name minio -p 9000:9000 -p 9001:9001 -e MINIO_ROOT_USER=minioadmin -e MINIO_ROOT_PASSWORD=minioadmin -v $(pwd)/.minio/data:/data minio/minio server /data --console-address :9001",
|
||||
"s3:down": "docker rm -f minio || true",
|
||||
"s3:init": "dotenv -e .env.dev -- docker run --rm --network container:minio --entrypoint /bin/sh minio/mc -c \"mc alias set local http://localhost:9000 $S3_ACCESS_KEY $S3_SECRET_KEY && mc mb -p local/$S3_BUCKET || true && mc anonymous set download local/$S3_BUCKET\""
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chalk": "^2.2.0",
|
||||
@ -64,4 +67,4 @@
|
||||
"zod": "^3.24.2",
|
||||
"zod-to-json-schema": "^3.24.3"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,13 @@
|
||||
import * as Minio from 'minio';
|
||||
|
||||
const s3Host = process.env.S3_HOST!;
|
||||
const s3Port = process.env.S3_PORT ? parseInt(process.env.S3_PORT, 10) : undefined;
|
||||
const s3UseSSL = process.env.S3_USE_SSL ? process.env.S3_USE_SSL === 'true' : true;
|
||||
|
||||
export const s3client = new Minio.Client({
|
||||
endPoint: process.env.S3_HOST!,
|
||||
useSSL: true,
|
||||
endPoint: s3Host,
|
||||
port: s3Port,
|
||||
useSSL: s3UseSSL,
|
||||
accessKey: process.env.S3_ACCESS_KEY!,
|
||||
secretKey: process.env.S3_SECRET_KEY!,
|
||||
});
|
||||
@ -26,4 +31,4 @@ export type ImageRef = {
|
||||
height: number;
|
||||
thumbhash: string;
|
||||
path: string;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user