Update environment variables and enhance Docker configurations for improved deployment
- Modified .env.portainer to include new environment variables for S3 private bucket URL, Nostr JWT secrets, and SendGrid options. - Updated docker-compose.yml to support the new environment variables, enhancing service configurations. - Added a seed content script to the backend package.json for initializing the database with sample data. - Refactored helper functions to construct S3 URLs more robustly, accommodating potential missing configurations. - Enhanced dev.sh script to seed the database if empty, ensuring content availability during development.
This commit is contained in:
@@ -26,7 +26,8 @@
|
|||||||
"typeorm:create-migration": "npm run typeorm -- migration:create src/database/migrations/$npm_config_name",
|
"typeorm:create-migration": "npm run typeorm -- migration:create src/database/migrations/$npm_config_name",
|
||||||
"typeorm:generate-migration": "npm run typeorm -- -d src/database/ormconfig.ts migration:generate src/database/migrations/$npm_config_name",
|
"typeorm:generate-migration": "npm run typeorm -- -d src/database/ormconfig.ts migration:generate src/database/migrations/$npm_config_name",
|
||||||
"typeorm:revert-migration": "npm run typeorm -- -d src/database/ormconfig.ts migration:revert",
|
"typeorm:revert-migration": "npm run typeorm -- -d src/database/ormconfig.ts migration:revert",
|
||||||
"typeorm:run-migrations": "npm run typeorm migration:run -- -d src/database/ormconfig.ts"
|
"typeorm:run-migrations": "npm run typeorm migration:run -- -d src/database/ormconfig.ts",
|
||||||
|
"seed:content": "ts-node src/scripts/seed-content.ts"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"commitizen": {
|
"commitizen": {
|
||||||
|
|||||||
@@ -22,7 +22,10 @@ export function getPublicS3Url(fileKey: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getPrivateS3Url(fileKey: string): string {
|
export function getPrivateS3Url(fileKey: string): string {
|
||||||
return `${process.env.S3_PRIVATE_BUCKET_URL}${encodeS3KeyForUrl(fileKey)}`;
|
const base =
|
||||||
|
process.env.S3_PRIVATE_BUCKET_URL ||
|
||||||
|
`${process.env.S3_ENDPOINT || 'http://localhost:9000'}/${process.env.S3_PRIVATE_BUCKET_NAME || 'indeedhub-private'}/`;
|
||||||
|
return `${base}${encodeS3KeyForUrl(fileKey)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTranscodedFileRoute(fileKey: string): string {
|
export function getTranscodedFileRoute(fileKey: string): string {
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ services:
|
|||||||
S3_PRIVATE_BUCKET_NAME: ${S3_PRIVATE_BUCKET:-indeedhub-private}
|
S3_PRIVATE_BUCKET_NAME: ${S3_PRIVATE_BUCKET:-indeedhub-private}
|
||||||
S3_PUBLIC_BUCKET_NAME: ${S3_PUBLIC_BUCKET:-indeedhub-public}
|
S3_PUBLIC_BUCKET_NAME: ${S3_PUBLIC_BUCKET:-indeedhub-public}
|
||||||
S3_PUBLIC_BUCKET_URL: ${S3_PUBLIC_BUCKET_URL}
|
S3_PUBLIC_BUCKET_URL: ${S3_PUBLIC_BUCKET_URL}
|
||||||
|
S3_PRIVATE_BUCKET_URL: ${S3_PRIVATE_BUCKET_URL:-}
|
||||||
|
|
||||||
# ── CloudFront (leave empty for MinIO/self-hosted) ──
|
# ── CloudFront (leave empty for MinIO/self-hosted) ──
|
||||||
CLOUDFRONT_PRIVATE_KEY: ${CLOUDFRONT_PRIVATE_KEY:-}
|
CLOUDFRONT_PRIVATE_KEY: ${CLOUDFRONT_PRIVATE_KEY:-}
|
||||||
@@ -89,6 +90,9 @@ services:
|
|||||||
# ── Nostr Auth / JWT ─────────────────────────────────
|
# ── Nostr Auth / JWT ─────────────────────────────────
|
||||||
NOSTR_JWT_SECRET: ${NOSTR_JWT_SECRET}
|
NOSTR_JWT_SECRET: ${NOSTR_JWT_SECRET}
|
||||||
NOSTR_JWT_EXPIRES_IN: ${NOSTR_JWT_EXPIRES_IN:-7d}
|
NOSTR_JWT_EXPIRES_IN: ${NOSTR_JWT_EXPIRES_IN:-7d}
|
||||||
|
NOSTR_JWT_REFRESH_SECRET: ${NOSTR_JWT_REFRESH_SECRET:-}
|
||||||
|
NOSTR_JWT_TTL: ${NOSTR_JWT_TTL:-}
|
||||||
|
NOSTR_JWT_REFRESH_TTL: ${NOSTR_JWT_REFRESH_TTL:-}
|
||||||
|
|
||||||
# ── AES-128 Content Encryption ──────────────────────
|
# ── AES-128 Content Encryption ──────────────────────
|
||||||
AES_MASTER_SECRET: ${AES_MASTER_SECRET}
|
AES_MASTER_SECRET: ${AES_MASTER_SECRET}
|
||||||
@@ -103,6 +107,7 @@ services:
|
|||||||
# ── SendGrid (optional -- alternative to SMTP) ──────
|
# ── SendGrid (optional -- alternative to SMTP) ──────
|
||||||
SENDGRID_API_KEY: ${SENDGRID_API_KEY:-}
|
SENDGRID_API_KEY: ${SENDGRID_API_KEY:-}
|
||||||
SENDGRID_SENDER: ${SENDGRID_SENDER:-}
|
SENDGRID_SENDER: ${SENDGRID_SENDER:-}
|
||||||
|
SENDGRID_WAITLIST: ${SENDGRID_WAITLIST:-}
|
||||||
|
|
||||||
# ── Cognito (optional -- disabled with Nostr auth) ──
|
# ── Cognito (optional -- disabled with Nostr auth) ──
|
||||||
COGNITO_USER_POOL_ID: ${COGNITO_USER_POOL_ID:-}
|
COGNITO_USER_POOL_ID: ${COGNITO_USER_POOL_ID:-}
|
||||||
@@ -140,6 +145,10 @@ services:
|
|||||||
# ── Partner Content (optional) ──────────────────────
|
# ── Partner Content (optional) ──────────────────────
|
||||||
PARTNER_API_BASE_URL: ${PARTNER_API_BASE_URL:-}
|
PARTNER_API_BASE_URL: ${PARTNER_API_BASE_URL:-}
|
||||||
PARTNER_API_KEY: ${PARTNER_API_KEY:-}
|
PARTNER_API_KEY: ${PARTNER_API_KEY:-}
|
||||||
|
|
||||||
|
# ── Strike (optional -- alternative payment provider) ─
|
||||||
|
STRIKE_API_KEY: ${STRIKE_API_KEY:-}
|
||||||
|
STRIKE_WEBHOOK_KEY: ${STRIKE_WEBHOOK_KEY:-}
|
||||||
depends_on:
|
depends_on:
|
||||||
postgres:
|
postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|||||||
@@ -284,6 +284,14 @@ for i in $(seq 1 60); do
|
|||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Seed database if empty (so catalog and films appear; user uploads require re-upload after DB reset)
|
||||||
|
PROJECT_COUNT=$(curl -s "http://localhost:$BACKEND_PORT/projects" 2>/dev/null | grep -o '"id"' | wc -l | tr -d ' ')
|
||||||
|
if [ "$PROJECT_COUNT" = "0" ] || [ -z "$PROJECT_COUNT" ]; then
|
||||||
|
echo -e "${CYAN} Database has no projects — seeding content...${NC}"
|
||||||
|
(cd "$BACKEND_DIR" && set -a && [ -f .env ] && . ./.env && set +a && npm run seed:content 2>&1 | prefix_output "seed-db" "$CYAN") || true
|
||||||
|
echo -e "${GREEN} Seed done. Reload the app to see the catalog.${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
# ═════════════════════════════════════════════════════════════
|
# ═════════════════════════════════════════════════════════════
|
||||||
# STEP 4 — Frontend dev server
|
# STEP 4 — Frontend dev server
|
||||||
# ═════════════════════════════════════════════════════════════
|
# ═════════════════════════════════════════════════════════════
|
||||||
|
|||||||
Reference in New Issue
Block a user