-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·72 lines (60 loc) · 3.09 KB
/
setup.sh
File metadata and controls
executable file
·72 lines (60 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env bash
set -euo pipefail
# ─── setup.sh ────────────────────────────────────────────────────────────────
# One-time setup: generates a .env file with random secrets.
# Run once, then: docker compose up
# ─────────────────────────────────────────────────────────────────────────────
if [ -f .env ]; then
echo ""
echo "⚠️ .env already exists."
echo " Delete it first if you want to regenerate secrets:"
echo " rm .env && ./setup.sh"
echo ""
exit 1
fi
if ! command -v openssl &> /dev/null; then
echo "❌ openssl is required but not found. Install it and try again."
exit 1
fi
AUTH_SECRET=$(openssl rand -base64 32)
DB_PASS=$(openssl rand -hex 16)
STORAGE_PASS=$(openssl rand -hex 16)
cat > .env <<EOF
# ─── Reqcore — generated by setup.sh ───────────────────────────────────────
# Generated: $(date -u +"%Y-%m-%dT%H:%M:%SZ")
# ❗ Do NOT commit this file. See .env.example for production variable reference.
# ─── Database ────────────────────────────────────────────────────────────────
DB_USER=reqcore
DB_PASSWORD=${DB_PASS}
DB_NAME=reqcore
# Used by host tools (drizzle-kit, drizzle studio). docker-compose overrides
# this with the internal Docker hostname for the app container.
DATABASE_URL=postgresql://reqcore:${DB_PASS}@localhost:5432/reqcore
# ─── Authentication ──────────────────────────────────────────────────────────
BETTER_AUTH_SECRET=${AUTH_SECRET}
BETTER_AUTH_URL=http://localhost:3000
# ─── Object Storage ──────────────────────────────────────────────────────────
STORAGE_USER=reqcore
STORAGE_PASSWORD=${STORAGE_PASS}
# Used by host tools. docker-compose overrides this for the app container.
S3_ENDPOINT=http://localhost:9000
S3_ACCESS_KEY=reqcore
S3_SECRET_KEY=${STORAGE_PASS}
S3_BUCKET=reqcore
S3_REGION=us-east-1
S3_FORCE_PATH_STYLE=true
# ─── SEO ─────────────────────────────────────────────────────────────────────
NUXT_PUBLIC_SITE_URL=http://localhost:3000
EOF
echo ""
echo "✅ .env generated with random secrets."
echo ""
echo "Start the stack:"
echo " docker compose up"
echo ""
echo "App → http://localhost:3000"
echo ""
echo "Optional — seed demo account (after the app is running):"
echo " docker compose exec app npm run db:seed"
echo " Login: demo@reqcore.com / demo1234"
echo ""