@powerhousedao/ph-cli 4.1.0-dev.59 → 4.1.0-dev.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/cli.js +12 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/connect.d.ts +5 -5
- package/dist/src/commands/connect.d.ts.map +1 -1
- package/dist/src/commands/connect.js +14 -13
- package/dist/src/commands/connect.js.map +1 -1
- package/dist/src/commands/register-commands.d.ts +2 -2
- package/dist/src/commands/register-commands.d.ts.map +1 -1
- package/dist/src/commands/vetra.d.ts.map +1 -1
- package/dist/src/commands/vetra.js +3 -1
- package/dist/src/commands/vetra.js.map +1 -1
- package/dist/src/help.d.ts +1 -1
- package/dist/src/help.d.ts.map +1 -1
- package/dist/src/help.js +5 -0
- package/dist/src/help.js.map +1 -1
- package/dist/src/services/connect.d.ts +1 -2
- package/dist/src/services/connect.d.ts.map +1 -1
- package/dist/src/services/connect.js +2 -14
- package/dist/src/services/connect.js.map +1 -1
- package/dist/src/services/dev.d.ts.map +1 -1
- package/dist/src/services/dev.js +8 -5
- package/dist/src/services/dev.js.map +1 -1
- package/dist/src/services/vetra.d.ts +2 -1
- package/dist/src/services/vetra.d.ts.map +1 -1
- package/dist/src/services/vetra.js +16 -60
- package/dist/src/services/vetra.js.map +1 -1
- package/dist/src/utils.d.ts +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +2 -13
- package/dist/src/utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -10
- package/dist/scripts/generate-commands-md.ts +0 -84
- package/dist/scripts/generate-version.ts +0 -22
- package/dist/scripts/manage-environment +0 -191
- package/dist/scripts/setup-environment +0 -392
- package/dist/scripts/setup-environment.ps1 +0 -313
- package/dist/scripts/setup.sh +0 -24
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# =============================================================================
|
|
4
|
-
# Configuration
|
|
5
|
-
# =============================================================================
|
|
6
|
-
TARGET_TAG=${1:-"latest"}
|
|
7
|
-
PROJECT_NAME=${2:-"global"}
|
|
8
|
-
|
|
9
|
-
# Function to find an available port
|
|
10
|
-
find_available_port() {
|
|
11
|
-
local port=4001
|
|
12
|
-
while netstat -tuln | grep -q ":$port "; do
|
|
13
|
-
port=$((port + 1))
|
|
14
|
-
done
|
|
15
|
-
echo $port
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
# =============================================================================
|
|
19
|
-
# OS Detection and Windows Handling
|
|
20
|
-
# =============================================================================
|
|
21
|
-
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
|
|
22
|
-
if [ -f "$0.ps1" ]; then
|
|
23
|
-
powershell -ExecutionPolicy Bypass -File "$0.ps1" -TARGET_TAG "$TARGET_TAG"
|
|
24
|
-
else
|
|
25
|
-
echo "Error: Windows setup script (setup-environment.ps1) not found"
|
|
26
|
-
exit 1
|
|
27
|
-
fi
|
|
28
|
-
else
|
|
29
|
-
# =============================================================================
|
|
30
|
-
# Package Installation
|
|
31
|
-
# =============================================================================
|
|
32
|
-
sudo apt install -y postgresql postgresql-contrib nginx libnginx-mod-http-brotli-static libnginx-mod-http-brotli-filter
|
|
33
|
-
sudo sed -i 's/# gzip_vary/gzip_vary/; s/# gzip_proxied/gzip_proxied/; s/# gzip_comp_level/gzip_comp_level/; s/# gzip_buffers/gzip_buffers/; s/# gzip_http_version/gzip_http_version/; s/# gzip_types/gzip_types/' /etc/nginx/nginx.conf
|
|
34
|
-
|
|
35
|
-
# =============================================================================
|
|
36
|
-
# Interactive Package Installation
|
|
37
|
-
# =============================================================================
|
|
38
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
39
|
-
echo " Package Installation"
|
|
40
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
41
|
-
while true; do
|
|
42
|
-
read -p "Enter package name to install (or press Enter to skip): " package_name
|
|
43
|
-
if [ -z "$package_name" ]; then
|
|
44
|
-
break
|
|
45
|
-
fi
|
|
46
|
-
ph install "$package_name"
|
|
47
|
-
done
|
|
48
|
-
|
|
49
|
-
# =============================================================================
|
|
50
|
-
# Connect Build
|
|
51
|
-
# =============================================================================
|
|
52
|
-
ph connect build
|
|
53
|
-
cp -r .ph/connect-build/dist /var/www/html/$PROJECT_NAME
|
|
54
|
-
|
|
55
|
-
# =============================================================================
|
|
56
|
-
# Database Configuration
|
|
57
|
-
# =============================================================================
|
|
58
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
59
|
-
echo " Database Configuration"
|
|
60
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
61
|
-
echo "Choose database type:"
|
|
62
|
-
echo "1) Local PostgreSQL database"
|
|
63
|
-
echo "2) Remote PostgreSQL database"
|
|
64
|
-
read -p "Enter your choice (1 or 2): " db_choice
|
|
65
|
-
|
|
66
|
-
if [ "$db_choice" = "1" ]; then
|
|
67
|
-
echo "Setting up local PostgreSQL database..."
|
|
68
|
-
|
|
69
|
-
# Generate database credentials
|
|
70
|
-
DB_PASSWORD="powerhouse"
|
|
71
|
-
DB_USER="powerhouse"
|
|
72
|
-
# Convert to lowercase, replace dots with underscores, replace special chars with underscore, ensure starts with letter
|
|
73
|
-
DB_NAME="powerhouse_$(echo "${PROJECT_NAME}" | tr '[:upper:]' '[:lower:]' | sed 's/\./_/g' | sed 's/[^a-z0-9]/_/g' | sed 's/^[^a-z]/p_/' | cut -c1-63)"
|
|
74
|
-
|
|
75
|
-
# Check if database already exists
|
|
76
|
-
if sudo -u postgres psql -lqt | cut -d \| -f 1 | grep -qw $DB_NAME; then
|
|
77
|
-
echo "Database $DB_NAME already exists"
|
|
78
|
-
read -p "Do you want to recreate it? (y/n): " recreate_db
|
|
79
|
-
if [ "$recreate_db" = "y" ]; then
|
|
80
|
-
sudo -u postgres psql -c "DROP DATABASE $DB_NAME;"
|
|
81
|
-
else
|
|
82
|
-
echo "Using existing database"
|
|
83
|
-
fi
|
|
84
|
-
fi
|
|
85
|
-
|
|
86
|
-
# Create database and user if they don't exist
|
|
87
|
-
sudo -u postgres psql << EOF
|
|
88
|
-
DO
|
|
89
|
-
\$do\$
|
|
90
|
-
BEGIN
|
|
91
|
-
IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = '$DB_USER') THEN
|
|
92
|
-
CREATE USER $DB_USER WITH PASSWORD '$DB_PASSWORD';
|
|
93
|
-
END IF;
|
|
94
|
-
END
|
|
95
|
-
\$do\$;
|
|
96
|
-
|
|
97
|
-
CREATE DATABASE $DB_NAME OWNER $DB_USER;
|
|
98
|
-
GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;
|
|
99
|
-
EOF
|
|
100
|
-
|
|
101
|
-
# Configure PostgreSQL
|
|
102
|
-
sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = 'localhost'/" /etc/postgresql/*/main/postgresql.conf
|
|
103
|
-
|
|
104
|
-
# Set DATABASE_URL for local database
|
|
105
|
-
DATABASE_URL="postgresql://$DB_USER:$DB_PASSWORD@localhost:5432/$DB_NAME"
|
|
106
|
-
|
|
107
|
-
echo "Local database configured successfully!"
|
|
108
|
-
echo "Database URL: $DATABASE_URL"
|
|
109
|
-
echo "Please save these credentials securely!"
|
|
110
|
-
else
|
|
111
|
-
echo "Enter remote PostgreSQL URL (format: postgresql://user:password@host:port/db)"
|
|
112
|
-
echo "Example: postgresql://powerhouse:password@db.example.com:5432/powerhouse"
|
|
113
|
-
read -p "DATABASE_URL: " DATABASE_URL
|
|
114
|
-
fi
|
|
115
|
-
|
|
116
|
-
# Save DATABASE_URL to .env file
|
|
117
|
-
echo "DATABASE_URL=$DATABASE_URL" | sudo tee -a .env
|
|
118
|
-
|
|
119
|
-
# =============================================================================
|
|
120
|
-
# SSL Configuration
|
|
121
|
-
# =============================================================================
|
|
122
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
123
|
-
echo " SSL Configuration"
|
|
124
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
125
|
-
|
|
126
|
-
# Find an available port for Switchboard
|
|
127
|
-
SWITCHBOARD_PORT=$(find_available_port)
|
|
128
|
-
echo "Using port $SWITCHBOARD_PORT for Switchboard"
|
|
129
|
-
|
|
130
|
-
# Save Switchboard port to configuration
|
|
131
|
-
echo "SWITCHBOARD_PORT=$SWITCHBOARD_PORT" | sudo tee -a .env
|
|
132
|
-
|
|
133
|
-
# Add compression settings to nginx.conf if not exists
|
|
134
|
-
if ! grep -q "brotli_comp_level" /etc/nginx/nginx.conf || ! grep -q "gzip_comp_level" /etc/nginx/nginx.conf; then
|
|
135
|
-
echo "Adding compression settings to nginx.conf..."
|
|
136
|
-
# Find the http block in nginx.conf
|
|
137
|
-
if ! grep -q "brotli_comp_level" /etc/nginx/nginx.conf; then
|
|
138
|
-
sudo sed -i '/http {/a \ # Brotli compression\n brotli on;\n brotli_comp_level 6;\n brotli_types text/plain text/css application/javascript application/json image/svg+xml application/xml+rss;\n brotli_static on;' /etc/nginx/nginx.conf
|
|
139
|
-
fi
|
|
140
|
-
if ! grep -q "gzip_comp_level" /etc/nginx/nginx.conf; then
|
|
141
|
-
sudo sed -i '/http {/a \ # Gzip compression\n gzip on;\n gzip_vary on;\n gzip_proxied any;\n gzip_comp_level 6;\n gzip_buffers 16 8k;\n gzip_http_version 1.1;\n gzip_types text/plain text/css application/javascript application/json image/svg+xml application/xml+rss;' /etc/nginx/nginx.conf
|
|
142
|
-
fi
|
|
143
|
-
else
|
|
144
|
-
echo "Compression settings already present in nginx.conf"
|
|
145
|
-
fi
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
echo "Choose SSL configuration:"
|
|
150
|
-
echo "1) Let's Encrypt certificates for domains"
|
|
151
|
-
echo "2) Self-signed certificate for machine hostname"
|
|
152
|
-
read -p "Enter your choice (1 or 2): " ssl_choice
|
|
153
|
-
|
|
154
|
-
if [ "$ssl_choice" = "1" ]; then
|
|
155
|
-
# Install certbot
|
|
156
|
-
sudo apt install -y certbot python3-certbot-nginx
|
|
157
|
-
|
|
158
|
-
# =============================================================================
|
|
159
|
-
# Domain Setup
|
|
160
|
-
# =============================================================================
|
|
161
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
162
|
-
echo " Domain Setup"
|
|
163
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
164
|
-
read -p "Enter Connect domain (e.g. connect.google.com): " connect_domain
|
|
165
|
-
read -p "Enter Switchboard domain (e.g. switchboard.google.com): " switchboard_domain
|
|
166
|
-
read -p "Enter admin email for Let's Encrypt notifications: " admin_email
|
|
167
|
-
|
|
168
|
-
echo "Using domains:"
|
|
169
|
-
echo "Connect: $connect_domain"
|
|
170
|
-
echo "Switchboard: $switchboard_domain"
|
|
171
|
-
|
|
172
|
-
# Create initial Nginx configuration for certbot
|
|
173
|
-
echo "Creating initial Nginx configuration..."
|
|
174
|
-
sudo tee /etc/nginx/sites-available/$PROJECT_NAME > /dev/null << EOF
|
|
175
|
-
server {
|
|
176
|
-
listen 80;
|
|
177
|
-
server_name $connect_domain $switchboard_domain;
|
|
178
|
-
|
|
179
|
-
location / {
|
|
180
|
-
root /var/www/html/$PROJECT_NAME;
|
|
181
|
-
try_files \$uri \$uri/ /index.html;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
location /.well-known/acme-challenge/ {
|
|
185
|
-
root /var/www/html;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
EOF
|
|
189
|
-
|
|
190
|
-
# Enable the site
|
|
191
|
-
sudo ln -sf /etc/nginx/sites-available/$PROJECT_NAME /etc/nginx/sites-enabled/
|
|
192
|
-
sudo rm -f /etc/nginx/sites-enabled/default
|
|
193
|
-
|
|
194
|
-
# Test Nginx configuration
|
|
195
|
-
sudo nginx -t
|
|
196
|
-
|
|
197
|
-
# Restart Nginx to apply changes
|
|
198
|
-
sudo systemctl restart nginx
|
|
199
|
-
|
|
200
|
-
# Obtain SSL certificates
|
|
201
|
-
echo "Obtaining SSL certificates..."
|
|
202
|
-
sudo certbot --nginx -d $connect_domain --non-interactive --agree-tos --email $admin_email --redirect
|
|
203
|
-
sudo certbot --nginx -d $switchboard_domain --non-interactive --agree-tos --email $admin_email --redirect
|
|
204
|
-
|
|
205
|
-
# Wait for certbot to finish and certificates to be installed
|
|
206
|
-
sleep 5
|
|
207
|
-
|
|
208
|
-
# Check if certificates were installed
|
|
209
|
-
if [ ! -f "/etc/letsencrypt/live/$connect_domain/fullchain.pem" ] || [ ! -f "/etc/letsencrypt/live/$switchboard_domain/fullchain.pem" ]; then
|
|
210
|
-
echo "Error: SSL certificates were not installed properly"
|
|
211
|
-
echo "Please check the certbot logs at /var/log/letsencrypt/letsencrypt.log"
|
|
212
|
-
exit 1
|
|
213
|
-
fi
|
|
214
|
-
|
|
215
|
-
# Update Nginx configuration with proper SSL settings
|
|
216
|
-
echo "Updating Nginx configuration with SSL settings..."
|
|
217
|
-
sudo tee /etc/nginx/sites-available/$PROJECT_NAME > /dev/null << EOF
|
|
218
|
-
server {
|
|
219
|
-
listen 80;
|
|
220
|
-
server_name $connect_domain $switchboard_domain;
|
|
221
|
-
return 301 https://\$host\$request_uri;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
server {
|
|
225
|
-
listen 443 ssl;
|
|
226
|
-
http2 on;
|
|
227
|
-
server_name $connect_domain;
|
|
228
|
-
|
|
229
|
-
ssl_certificate /etc/letsencrypt/live/$connect_domain/fullchain.pem;
|
|
230
|
-
ssl_certificate_key /etc/letsencrypt/live/$connect_domain/privkey.pem;
|
|
231
|
-
|
|
232
|
-
# SSL configuration
|
|
233
|
-
ssl_protocols TLSv1.2 TLSv1.3;
|
|
234
|
-
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
|
|
235
|
-
ssl_prefer_server_ciphers off;
|
|
236
|
-
ssl_session_timeout 1d;
|
|
237
|
-
ssl_session_cache shared:SSL:50m;
|
|
238
|
-
ssl_session_tickets off;
|
|
239
|
-
ssl_stapling on;
|
|
240
|
-
ssl_stapling_verify on;
|
|
241
|
-
resolver 8.8.8.8 8.8.4.4 valid=300s;
|
|
242
|
-
resolver_timeout 5s;
|
|
243
|
-
|
|
244
|
-
# Security headers
|
|
245
|
-
add_header Strict-Transport-Security "max-age=63072000" always;
|
|
246
|
-
add_header X-Frame-Options DENY;
|
|
247
|
-
add_header X-Content-Type-Options nosniff;
|
|
248
|
-
add_header X-XSS-Protection "1; mode=block";
|
|
249
|
-
|
|
250
|
-
if (\$http_x_forwarded_proto = "http") {
|
|
251
|
-
return 301 https://\$server_name\$request_uri;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
location / {
|
|
255
|
-
root /var/www/html/$PROJECT_NAME;
|
|
256
|
-
try_files \$uri \$uri/ /index.html;
|
|
257
|
-
add_header Cache-Control "no-cache";
|
|
258
|
-
add_header X-Forwarded-Proto \$scheme;
|
|
259
|
-
add_header X-Forwarded-Host \$host;
|
|
260
|
-
add_header X-Forwarded-Port \$server_port;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
location /.well-known/acme-challenge/ {
|
|
264
|
-
root /var/www/html;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
server {
|
|
269
|
-
listen 443 ssl;
|
|
270
|
-
http2 on;
|
|
271
|
-
server_name $switchboard_domain;
|
|
272
|
-
|
|
273
|
-
ssl_certificate /etc/letsencrypt/live/$switchboard_domain/fullchain.pem;
|
|
274
|
-
ssl_certificate_key /etc/letsencrypt/live/$switchboard_domain/privkey.pem;
|
|
275
|
-
|
|
276
|
-
# SSL configuration
|
|
277
|
-
ssl_protocols TLSv1.2 TLSv1.3;
|
|
278
|
-
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
|
|
279
|
-
ssl_prefer_server_ciphers off;
|
|
280
|
-
ssl_session_timeout 1d;
|
|
281
|
-
ssl_session_cache shared:SSL:50m;
|
|
282
|
-
ssl_session_tickets off;
|
|
283
|
-
ssl_stapling on;
|
|
284
|
-
ssl_stapling_verify on;
|
|
285
|
-
resolver 8.8.8.8 8.8.4.4 valid=300s;
|
|
286
|
-
resolver_timeout 5s;
|
|
287
|
-
|
|
288
|
-
# Security headers
|
|
289
|
-
add_header Strict-Transport-Security "max-age=63072000" always;
|
|
290
|
-
add_header X-Frame-Options DENY;
|
|
291
|
-
add_header X-Content-Type-Options nosniff;
|
|
292
|
-
add_header X-XSS-Protection "1; mode=block";
|
|
293
|
-
|
|
294
|
-
location / {
|
|
295
|
-
proxy_pass http://localhost:$SWITCHBOARD_PORT;
|
|
296
|
-
proxy_http_version 1.1;
|
|
297
|
-
proxy_set_header Upgrade \$http_upgrade;
|
|
298
|
-
proxy_set_header Connection 'upgrade';
|
|
299
|
-
proxy_set_header Host \$host;
|
|
300
|
-
proxy_cache_bypass \$http_upgrade;
|
|
301
|
-
proxy_set_header X-Real-IP \$remote_addr;
|
|
302
|
-
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
|
303
|
-
proxy_set_header X-Forwarded-Proto \$scheme;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
location /.well-known/acme-challenge/ {
|
|
307
|
-
root /var/www/html;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
EOF
|
|
311
|
-
|
|
312
|
-
# Test and reload Nginx configuration
|
|
313
|
-
sudo nginx -t && sudo systemctl reload nginx
|
|
314
|
-
|
|
315
|
-
# Set up automatic renewal
|
|
316
|
-
echo "Setting up automatic certificate renewal..."
|
|
317
|
-
sudo systemctl enable certbot.timer
|
|
318
|
-
sudo systemctl start certbot.timer
|
|
319
|
-
|
|
320
|
-
else
|
|
321
|
-
# Get machine hostname
|
|
322
|
-
hostname=$(hostname)
|
|
323
|
-
|
|
324
|
-
# Generate self-signed certificate
|
|
325
|
-
echo "Generating self-signed certificate for $hostname..."
|
|
326
|
-
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
|
|
327
|
-
-keyout /etc/ssl/private/$hostname.key \
|
|
328
|
-
-out /etc/ssl/certs/$hostname.crt \
|
|
329
|
-
-subj "/CN=$hostname" \
|
|
330
|
-
-addext "subjectAltName = DNS:$hostname"
|
|
331
|
-
|
|
332
|
-
# Create Nginx configuration for self-signed
|
|
333
|
-
echo "Creating Nginx configuration..."
|
|
334
|
-
sudo tee /etc/nginx/sites-available/$PROJECT_NAME > /dev/null << EOF
|
|
335
|
-
server {
|
|
336
|
-
listen 80;
|
|
337
|
-
server_name $hostname;
|
|
338
|
-
return 301 https://\$host\$request_uri;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
server {
|
|
342
|
-
listen 443 ssl;
|
|
343
|
-
http2 on;
|
|
344
|
-
server_name $hostname;
|
|
345
|
-
|
|
346
|
-
ssl_certificate /etc/ssl/certs/$hostname.crt;
|
|
347
|
-
ssl_certificate_key /etc/ssl/private/$hostname.key;
|
|
348
|
-
|
|
349
|
-
location /connect {
|
|
350
|
-
proxy_pass http://localhost:3000;
|
|
351
|
-
proxy_http_version 1.1;
|
|
352
|
-
proxy_set_header Upgrade \$http_upgrade;
|
|
353
|
-
proxy_set_header Connection 'upgrade';
|
|
354
|
-
proxy_set_header Host \$host;
|
|
355
|
-
proxy_cache_bypass \$http_upgrade;
|
|
356
|
-
proxy_set_header X-Real-IP \$remote_addr;
|
|
357
|
-
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
|
358
|
-
proxy_set_header X-Forwarded-Proto \$scheme;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
location /switchboard {
|
|
362
|
-
proxy_pass http://localhost:$SWITCHBOARD_PORT;
|
|
363
|
-
proxy_http_version 1.1;
|
|
364
|
-
proxy_set_header Upgrade \$http_upgrade;
|
|
365
|
-
proxy_set_header Connection 'upgrade';
|
|
366
|
-
proxy_set_header Host \$host;
|
|
367
|
-
proxy_cache_bypass \$http_upgrade;
|
|
368
|
-
proxy_set_header X-Real-IP \$remote_addr;
|
|
369
|
-
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
|
370
|
-
proxy_set_header X-Forwarded-Proto \$scheme;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
EOF
|
|
374
|
-
|
|
375
|
-
# Enable the site
|
|
376
|
-
sudo ln -sf /etc/nginx/sites-available/$PROJECT_NAME /etc/nginx/sites-enabled/
|
|
377
|
-
sudo rm -f /etc/nginx/sites-enabled/default
|
|
378
|
-
|
|
379
|
-
# Test Nginx configuration
|
|
380
|
-
sudo nginx -t
|
|
381
|
-
fi
|
|
382
|
-
|
|
383
|
-
# =============================================================================
|
|
384
|
-
# Database Schema Setup
|
|
385
|
-
# =============================================================================
|
|
386
|
-
pnpm prisma db push --schema node_modules/document-drive/dist/prisma/schema.prisma
|
|
387
|
-
|
|
388
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
389
|
-
echo " Environment setup complete!"
|
|
390
|
-
echo " Use 'ph service start' to start services"
|
|
391
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
392
|
-
fi
|