feat: add bootstrap script for auto-generated credentials on fresh install
This commit is contained in:
7
.env.deploy
Normal file
7
.env.deploy
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Fresh Deployment Credentials
|
||||||
|
# These will be auto-generated on first deployment
|
||||||
|
# After deployment, check the Directus container logs for the actual credentials
|
||||||
|
|
||||||
|
ADMIN_EMAIL=admin@sparkplatform.local
|
||||||
|
DB_USER=sparkuser
|
||||||
|
DB_DATABASE=directus
|
||||||
32
DEPLOY_INSTRUCTIONS.md
Normal file
32
DEPLOY_INSTRUCTIONS.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# Deployment Instructions
|
||||||
|
|
||||||
|
## Fresh Install with Auto-Generated Credentials
|
||||||
|
|
||||||
|
This deployment will automatically:
|
||||||
|
1. Generate secure random passwords for all services
|
||||||
|
2. Create the Directus admin user
|
||||||
|
3. Save all credentials to a file you can retrieve
|
||||||
|
|
||||||
|
### Deploy Steps:
|
||||||
|
|
||||||
|
1. **In Coolify, set ONLY these environment variables:**
|
||||||
|
```
|
||||||
|
ADMIN_EMAIL=admin@sparkplatform.local
|
||||||
|
DB_USER=sparkuser
|
||||||
|
DB_DATABASE=directus
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Deploy the application**
|
||||||
|
|
||||||
|
3. **Retrieve your credentials:**
|
||||||
|
```bash
|
||||||
|
docker exec <directus-container-name> cat /directus/credentials.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Login to Directus:**
|
||||||
|
- URL: https://spark.jumpstartscaling.com
|
||||||
|
- Email: admin@sparkplatform.local
|
||||||
|
- Password: (from credentials.txt)
|
||||||
|
|
||||||
|
### Security Note:
|
||||||
|
All passwords are randomly generated using `openssl rand -base64` and are unique per deployment.
|
||||||
32
directus/scripts/bootstrap.sh
Executable file
32
directus/scripts/bootstrap.sh
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Generate random passwords if not set
|
||||||
|
export ADMIN_PASSWORD=${ADMIN_PASSWORD:-$(openssl rand -base64 32)}
|
||||||
|
export DB_PASSWORD=${DB_PASSWORD:-$(openssl rand -base64 32)}
|
||||||
|
export KEY=${KEY:-$(openssl rand -base64 64)}
|
||||||
|
export SECRET=${SECRET:-$(openssl rand -base64 64)}
|
||||||
|
|
||||||
|
# Save credentials to a file for reference
|
||||||
|
cat > /directus/credentials.txt <<EOF
|
||||||
|
===========================================
|
||||||
|
DIRECTUS ADMIN CREDENTIALS
|
||||||
|
===========================================
|
||||||
|
Admin Email: ${ADMIN_EMAIL}
|
||||||
|
Admin Password: ${ADMIN_PASSWORD}
|
||||||
|
|
||||||
|
Database User: ${DB_USER}
|
||||||
|
Database Password: ${DB_PASSWORD}
|
||||||
|
|
||||||
|
Directus Key: ${KEY}
|
||||||
|
Directus Secret: ${SECRET}
|
||||||
|
===========================================
|
||||||
|
IMPORTANT: Save these credentials securely!
|
||||||
|
===========================================
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "✅ Credentials generated and saved to /directus/credentials.txt"
|
||||||
|
cat /directus/credentials.txt
|
||||||
|
|
||||||
|
# Start Directus
|
||||||
|
exec node cli.js bootstrap && node cli.js start
|
||||||
Reference in New Issue
Block a user