-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-passwords.sh
More file actions
184 lines (164 loc) · 6.28 KB
/
generate-passwords.sh
File metadata and controls
184 lines (164 loc) · 6.28 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/bin/bash
# ========================================
# SteerDock Password Generator
# Generates secure passwords for all services
# ========================================
echo ""
echo "SteerDock Password Generator"
echo "================================="
echo ""
# Function to generate secure password
generate_password() {
local length=${1:-32}
# Character set: a-z, A-Z, 0-9 (no special chars to avoid escaping issues)
tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c $length
}
# Generate all passwords
SQL_TYPE="mysql"
POSTGRES_USER="steerdock"
POSTGRES_PASSWORD=$(generate_password 32)
POSTGRES_DB="steerdock"
MYSQL_USER="steerdock"
MYSQL_PASSWORD=$(generate_password 32)
MYSQL_ROOT_PASSWORD=$(generate_password 32)
MYSQL_DATABASE="steerdock"
MONGO_INITDB_ROOT_USERNAME="steerdock"
MONGO_INITDB_ROOT_PASSWORD=$(generate_password 32)
MONGO_INITDB_DATABASE="steerdock"
REDIS_PASSWORD=$(generate_password 32)
JWT_SECRET=$(generate_password 64)
ENCRYPTION_KEY=$(generate_password 64)
ALLOWED_ORIGINS="http://localhost:8383,http://localhost:5151,http://192.168.100.100:8383,http://192.168.100.100:5151,http://172.0.0.0:8383,http://172.0.0.0:5151"
FRONTEND_PORT="5151"
BASE_URL="http://localhost:8383"
echo "Generating secure passwords..."
echo ""
# ========================================
# Create .env file
# ========================================
echo "Creating .env file..."
cat > .env << EOF
# ========================================
# SteerDock Environment Configuration
# Auto-generated by generate-passwords.sh
# ========================================
# Frontend Configuration
# ========================================
FRONTEND_PORT=$FRONTEND_PORT
BASE_URL=$BASE_URL
# Database Configuration
# ========================================
SQL_TYPE=$SQL_TYPE
# For standalone binary (connects to Docker containers)
DATABASE_HOST=localhost
DATABASE_PORT=3306
DATABASE_URL=mysql://steerdock:$MYSQL_PASSWORD@localhost:3306/steerdock
# For Docker Compose (internal network)
# DATABASE_HOST=mysql
# DATABASE_URL=mysql://steerdock:$MYSQL_PASSWORD@mysql:3306/steerdock
# ========================================
# PostgreSQL Database
# ========================================
# For standalone binary (connects to Docker containers)
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USER=$POSTGRES_USER
POSTGRES_PASSWORD=$POSTGRES_PASSWORD
POSTGRES_DB=$POSTGRES_DB
POSTGRES_URL=postgres://steerdock:$POSTGRES_PASSWORD@localhost:5432/steerdock
# For Docker Compose (internal network)
# POSTGRES_HOST=postgres
# POSTGRES_URL=postgres://steerdock:$POSTGRES_PASSWORD@postgres:5432/steerdock
# ========================================
# MySQL Database
# ========================================
# For standalone binary (connects to Docker containers)
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=$MYSQL_USER
MYSQL_PASSWORD=$MYSQL_PASSWORD
MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD
MYSQL_DATABASE=$MYSQL_DATABASE
MYSQL_URL=mysql://steerdock:$MYSQL_PASSWORD@localhost:3306/steerdock
# For Docker Compose (internal network)
# MYSQL_HOST=mysql
# MYSQL_URL=mysql://steerdock:$MYSQL_PASSWORD@mysql:3306/steerdock
# ========================================
# MongoDB Database
# ========================================
MONGO_HOST=localhost
MONGO_PORT=27017
MONGO_INITDB_ROOT_USERNAME=$MONGO_INITDB_ROOT_USERNAME
MONGO_INITDB_ROOT_PASSWORD=$MONGO_INITDB_ROOT_PASSWORD
MONGO_INITDB_DATABASE=$MONGO_INITDB_DATABASE
MONGO_URL=mongodb://steerdock:$MONGO_INITDB_ROOT_PASSWORD@localhost:27017/steerdock
# ========================================
# Redis Cache
# ========================================
# For standalone binary (connects to Docker containers)
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=$REDIS_PASSWORD
REDIS_URL=redis://:$REDIS_PASSWORD@localhost:6379/0
# For Docker Compose (internal network)
# REDIS_HOST=redis
# REDIS_URL=redis://:$REDIS_PASSWORD@redis:6379/0
# ========================================
# Security
# ========================================
JWT_SECRET=$JWT_SECRET
ENCRYPTION_KEY=$ENCRYPTION_KEY
ALLOWED_ORIGINS=$ALLOWED_ORIGINS
# ========================================
# AI Configuration (optional)
# ========================================
# Supported providers: mock, deepseek, zhipu, openai, ollama
AI_PROVIDER=mock
AI_API_KEY=
AI_API_URL=
AI_MODEL=
AI_ENABLED=false
# Example configurations for different AI providers:
# DeepSeek: AI_PROVIDER=deepseek, AI_API_KEY=sk-xxx, AI_API_URL=https://api.deepseek.com/v1/chat/completions, AI_MODEL=deepseek-chat
# OpenAI: AI_PROVIDER=openai, AI_API_KEY=sk-xxx, AI_API_URL=https://api.openai.com/v1/chat/completions, AI_MODEL=gpt-3.5-turbo
# Zhipu: AI_PROVIDER=zhipu, AI_API_KEY=xxx, AI_API_URL=https://open.bigmodel.cn/api/paas/v4/chat/completions, AI_MODEL=glm-4
# Ollama: AI_PROVIDER=ollama, AI_API_URL=http://localhost:11434/api/generate, AI_MODEL=llama2
# ========================================
# OAuth Configuration (optional)
# ========================================
# Google OAuth
GOOGLE_CLIENT_ID=your_google_client_id_here
GOOGLE_CLIENT_SECRET=your_google_client_secret_here
# GitHub OAuth
GITHUB_CLIENT_ID=your_github_client_id_here
GITHUB_CLIENT_SECRET=your_github_client_secret_here
EOF
echo ".env file created successfully!"
echo ""
# ========================================
# Display summary
# ========================================
echo ""
echo "Password generation completed!"
echo ""
echo -e "\033[0;36mGenerated files:\033[0m"
echo " • .env - Environment variables for all services"
echo ""
echo -e "\033[0;36mGenerated passwords:\033[0m"
echo " • PostgreSQL: ${POSTGRES_PASSWORD:0:8}..."
echo " • MySQL: ${MYSQL_PASSWORD:0:8}..."
echo " • MongoDB: ${MONGO_INITDB_ROOT_PASSWORD:0:8}..."
echo " • Redis: ${REDIS_PASSWORD:0:8}..."
echo " • JWT Secret: ${JWT_SECRET:0:16}..."
echo " • Encryption Key: ${ENCRYPTION_KEY:0:16}..."
echo ""
echo -e "\033[0;31mIMPORTANT SECURITY NOTES:\033[0m"
echo -e "\033[0;33m • All passwords use alphanumeric characters (a-z, A-Z, 0-9)\033[0m"
echo -e "\033[0;33m • Change OAuth client IDs and secrets in .env if needed\033[0m"
echo -e "\033[0;33m • Keep .env file secure and never commit to version control\033[0m"
echo ""
echo -e "\033[0;36mNext steps:\033[0m"
echo " 1. Review and update OAuth settings in .env if needed"
echo " 2. Run: docker compose -f docker-compose.prod.yml up -d"
echo " 3. Access: http://localhost:8383"
echo ""