Skip to content

Commit df820bd

Browse files
ismoilovdevmlclaude
andcommitted
Fix deployment issues
- Use Docker Hub image instead of building locally - Add automated env generation script - Make environment variables configurable via .env - Fix admin user auto-creation workflow 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent c55c3e4 commit df820bd

File tree

2 files changed

+92
-5
lines changed

2 files changed

+92
-5
lines changed

docker-compose.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ services:
5050

5151
# Next.js Application
5252
app:
53-
build:
54-
context: .
55-
dockerfile: Dockerfile
53+
image: ismoilovdevml/gitlab-ci-dashboard:latest
5654
container_name: gitlab-dashboard-app
5755
restart: unless-stopped
5856
depends_on:
@@ -68,8 +66,8 @@ services:
6866
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379
6967

7068
# App Config
71-
NODE_ENV: production
72-
NEXT_PUBLIC_APP_URL: http://localhost:3000
69+
NODE_ENV: ${NODE_ENV:-production}
70+
NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL:-http://localhost:3000}
7371
NEXT_PUBLIC_GITLAB_URL: ${NEXT_PUBLIC_GITLAB_URL:-https://gitlab.com}
7472

7573
# Admin User (Auto-created on first run)

scripts/generate-env.sh

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/bin/bash
2+
3+
# GitLab CI/CD Dashboard - Environment Generator
4+
# Auto-generates secure .env file with random passwords
5+
6+
set -e
7+
8+
ENV=${1:-development}
9+
SHOW_PASSWORDS=${SHOW_PASSWORDS:-false}
10+
11+
echo "🔐 Generating secure passwords for $ENV"
12+
13+
# Generate secure random passwords
14+
PG_PASS=$(openssl rand -base64 24 | tr -d '/+=' | head -c 32)
15+
REDIS_PASS=$(openssl rand -base64 24 | tr -d '/+=' | head -c 32)
16+
ADMIN_PASS=$(openssl rand -base64 24 | tr -d '/+=' | head -c 24)
17+
SESSION_SECRET=$(openssl rand -base64 48 | tr -d '/+=' | head -c 64)
18+
19+
# Create .env file
20+
cat > .env << EOF
21+
# ==========================================
22+
# GitLab CI/CD Dashboard - Environment Configuration
23+
# ==========================================
24+
# 🔐 AUTO-GENERATED: $(date)
25+
# ⚠️ KEEP THIS FILE SECURE - Contains sensitive passwords!
26+
27+
# ==========================================
28+
# Database Configuration
29+
# ==========================================
30+
POSTGRES_USER=gitlab_dashboard
31+
POSTGRES_PASSWORD=$PG_PASS
32+
POSTGRES_DB=gitlab_dashboard
33+
34+
# ==========================================
35+
# Redis Configuration
36+
# ==========================================
37+
REDIS_PASSWORD=$REDIS_PASS
38+
39+
# ==========================================
40+
# App Configuration
41+
# ==========================================
42+
NODE_ENV=$ENV
43+
NEXT_PUBLIC_APP_URL=http://localhost:3000
44+
NEXT_PUBLIC_GITLAB_URL=https://gitlab.com
45+
46+
# ==========================================
47+
# Admin User (Auto-created on first run)
48+
# ==========================================
49+
ADMIN_USERNAME=admin
50+
ADMIN_PASSWORD=$ADMIN_PASS
51+
52+
53+
# ==========================================
54+
# Security
55+
# ==========================================
56+
SESSION_SECRET=$SESSION_SECRET
57+
EOF
58+
59+
# Set secure permissions
60+
chmod 600 .env
61+
62+
echo "✅ Successfully generated .env"
63+
echo ""
64+
65+
if [ "$SHOW_PASSWORDS" = "true" ]; then
66+
echo "📋 YOUR ADMIN CREDENTIALS:"
67+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
68+
echo "Username: admin"
69+
echo "Password: $ADMIN_PASS"
70+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
71+
echo ""
72+
echo "⚠️ IMPORTANT:"
73+
echo "1. Save these credentials NOW - you won't see them again!"
74+
echo "2. File permissions set to 600 (owner read/write only)"
75+
echo "3. Never commit .env to git (.gitignore should block it)"
76+
echo "4. To view passwords later: cat .env"
77+
echo ""
78+
else
79+
echo "📋 YOUR ADMIN CREDENTIALS:"
80+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
81+
echo "Username: admin"
82+
echo "Password: $ADMIN_PASS"
83+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
84+
echo ""
85+
fi
86+
87+
echo "🚀 Next steps:"
88+
echo " docker-compose up -d"
89+
echo " docker-compose logs -f app"

0 commit comments

Comments
 (0)