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)
|
# Uncomment to enable centralized logging for AI debugging (creates .logs directory)
|
||||||
DANGEROUSLY_LOG_TO_SERVER_FOR_AI_AUTO_DEBUGGING=true
|
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
|
.env
|
||||||
dist
|
dist
|
||||||
.pgdata
|
.pgdata
|
||||||
|
.minio
|
||||||
|
|
||||||
.env.local
|
.env.local
|
||||||
.env
|
.env
|
||||||
|
@ -16,7 +16,10 @@
|
|||||||
"generate": "prisma generate",
|
"generate": "prisma generate",
|
||||||
"postinstall": "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",
|
"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": {
|
"devDependencies": {
|
||||||
"@types/chalk": "^2.2.0",
|
"@types/chalk": "^2.2.0",
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
import * as Minio from 'minio';
|
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({
|
export const s3client = new Minio.Client({
|
||||||
endPoint: process.env.S3_HOST!,
|
endPoint: s3Host,
|
||||||
useSSL: true,
|
port: s3Port,
|
||||||
|
useSSL: s3UseSSL,
|
||||||
accessKey: process.env.S3_ACCESS_KEY!,
|
accessKey: process.env.S3_ACCESS_KEY!,
|
||||||
secretKey: process.env.S3_SECRET_KEY!,
|
secretKey: process.env.S3_SECRET_KEY!,
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user