@powerhousedao/ph-cli 0.40.85-dev.1 → 0.40.85-dev.10
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/package.json +1 -1
- package/dist/scripts/manage-environment +158 -0
- package/dist/scripts/setup-environment +123 -63
- package/dist/scripts/setup-environment.ps1 +4 -4
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +0 -2
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/service.d.ts +1 -1
- package/dist/src/commands/service.d.ts.map +1 -1
- package/dist/src/commands/service.js +48 -126
- package/dist/src/commands/service.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.d.ts.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/dist/scripts/service-startup.sh +0 -7
- package/dist/scripts/service-unstartup.sh +0 -6
- package/dist/src/commands/setup-service.d.ts +0 -3
- package/dist/src/commands/setup-service.d.ts.map +0 -1
- package/dist/src/commands/setup-service.js +0 -32
- package/dist/src/commands/setup-service.js.map +0 -1
package/dist/package.json
CHANGED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# Configuration
|
|
5
|
+
# =============================================================================
|
|
6
|
+
PROJECT_NAME=${1:-"global"}
|
|
7
|
+
ACTION=${2:-"status"}
|
|
8
|
+
|
|
9
|
+
# =============================================================================
|
|
10
|
+
# OS Detection and Windows Handling
|
|
11
|
+
# =============================================================================
|
|
12
|
+
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
|
|
13
|
+
if [ -f "$0.ps1" ]; then
|
|
14
|
+
powershell -ExecutionPolicy Bypass -File "$0.ps1" -PROJECT_NAME "$PROJECT_NAME" -ACTION "$ACTION"
|
|
15
|
+
else
|
|
16
|
+
echo "Error: Windows management script (manage-environment.ps1) not found"
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
else
|
|
20
|
+
# =============================================================================
|
|
21
|
+
# Service Management
|
|
22
|
+
# =============================================================================
|
|
23
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
24
|
+
echo " Managing project: $PROJECT_NAME"
|
|
25
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
26
|
+
|
|
27
|
+
# Function to check if service is properly set up
|
|
28
|
+
check_setup() {
|
|
29
|
+
local project_name=$1
|
|
30
|
+
local error=0
|
|
31
|
+
|
|
32
|
+
# Check if .env file exists
|
|
33
|
+
if [ ! -f ".env" ]; then
|
|
34
|
+
echo "Error: .env file not found in project directory"
|
|
35
|
+
error=1
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# Check if Nginx configuration exists
|
|
39
|
+
if [ ! -f "/etc/nginx/sites-available/$project_name" ]; then
|
|
40
|
+
echo "Error: Nginx configuration not found"
|
|
41
|
+
error=1
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
# Check if database is configured
|
|
45
|
+
if ! grep -q "DATABASE_URL" ".env"; then
|
|
46
|
+
echo "Error: Database configuration not found in .env file"
|
|
47
|
+
error=1
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
if [ $error -eq 1 ]; then
|
|
51
|
+
echo "Please run 'ph setup-environment' first to set up the service"
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
# Function to enable/disable Nginx site
|
|
57
|
+
manage_nginx_site() {
|
|
58
|
+
local action=$1
|
|
59
|
+
local site_path="/etc/nginx/sites-available/$PROJECT_NAME"
|
|
60
|
+
local enabled_path="/etc/nginx/sites-enabled/$PROJECT_NAME"
|
|
61
|
+
|
|
62
|
+
if [ ! -f "$site_path" ]; then
|
|
63
|
+
echo "Error: Nginx site configuration for $PROJECT_NAME not found"
|
|
64
|
+
return 1
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
case "$action" in
|
|
68
|
+
"enable")
|
|
69
|
+
if [ ! -L "$enabled_path" ]; then
|
|
70
|
+
sudo ln -sf "$site_path" "$enabled_path"
|
|
71
|
+
sudo nginx -t && sudo nginx -s reload
|
|
72
|
+
fi
|
|
73
|
+
;;
|
|
74
|
+
"disable")
|
|
75
|
+
if [ -L "$enabled_path" ]; then
|
|
76
|
+
sudo rm -f "$enabled_path"
|
|
77
|
+
sudo nginx -t && sudo nginx -s reload
|
|
78
|
+
fi
|
|
79
|
+
;;
|
|
80
|
+
esac
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
case "$ACTION" in
|
|
84
|
+
"start")
|
|
85
|
+
check_setup "$PROJECT_NAME"
|
|
86
|
+
echo "Starting services..."
|
|
87
|
+
# Build Connect
|
|
88
|
+
echo "Building Connect..."
|
|
89
|
+
ph connect build
|
|
90
|
+
|
|
91
|
+
# Enable Nginx site
|
|
92
|
+
manage_nginx_site "enable"
|
|
93
|
+
|
|
94
|
+
# Start Switchboard via PM2
|
|
95
|
+
if ! pm2 list | grep -q "switchboard_${PROJECT_NAME}"; then
|
|
96
|
+
cd $PROJECT_NAME
|
|
97
|
+
pm2 start "pnpm switchboard" --name "switchboard_${PROJECT_NAME}"
|
|
98
|
+
pm2 save
|
|
99
|
+
else
|
|
100
|
+
pm2 start "switchboard_${PROJECT_NAME}"
|
|
101
|
+
fi
|
|
102
|
+
;;
|
|
103
|
+
|
|
104
|
+
"stop")
|
|
105
|
+
check_setup "$PROJECT_NAME"
|
|
106
|
+
echo "Stopping services..."
|
|
107
|
+
# Stop Switchboard via PM2
|
|
108
|
+
if pm2 list | grep -q "switchboard_${PROJECT_NAME}"; then
|
|
109
|
+
pm2 stop "switchboard_${PROJECT_NAME}"
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
# Disable Nginx site
|
|
113
|
+
manage_nginx_site "disable"
|
|
114
|
+
;;
|
|
115
|
+
|
|
116
|
+
"restart")
|
|
117
|
+
check_setup "$PROJECT_NAME"
|
|
118
|
+
echo "Restarting services..."
|
|
119
|
+
# Build Connect
|
|
120
|
+
echo "Building Connect..."
|
|
121
|
+
ph connect build
|
|
122
|
+
|
|
123
|
+
# Restart Nginx site
|
|
124
|
+
manage_nginx_site "disable"
|
|
125
|
+
manage_nginx_site "enable"
|
|
126
|
+
|
|
127
|
+
# Restart Switchboard via PM2
|
|
128
|
+
if pm2 list | grep -q "switchboard_${PROJECT_NAME}"; then
|
|
129
|
+
pm2 restart "switchboard_${PROJECT_NAME}"
|
|
130
|
+
else
|
|
131
|
+
cd $PROJECT_NAME
|
|
132
|
+
pm2 start "pnpm switchboard" --name "switchboard_${PROJECT_NAME}"
|
|
133
|
+
pm2 save
|
|
134
|
+
fi
|
|
135
|
+
;;
|
|
136
|
+
|
|
137
|
+
"status")
|
|
138
|
+
check_setup "$PROJECT_NAME"
|
|
139
|
+
echo "Checking service status..."
|
|
140
|
+
echo "Nginx site status:"
|
|
141
|
+
if [ -L "/etc/nginx/sites-enabled/$PROJECT_NAME" ]; then
|
|
142
|
+
echo "Site is enabled"
|
|
143
|
+
else
|
|
144
|
+
echo "Site is disabled"
|
|
145
|
+
fi
|
|
146
|
+
|
|
147
|
+
echo -e "\nSwitchboard status:"
|
|
148
|
+
pm2 list | grep "switchboard_${PROJECT_NAME}"
|
|
149
|
+
;;
|
|
150
|
+
|
|
151
|
+
*)
|
|
152
|
+
echo "Usage: $0 [project_name] {start|stop|restart|status}"
|
|
153
|
+
echo "Default project_name: global"
|
|
154
|
+
echo "Default action: status"
|
|
155
|
+
exit 1
|
|
156
|
+
;;
|
|
157
|
+
esac
|
|
158
|
+
fi
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
# Configuration
|
|
5
5
|
# =============================================================================
|
|
6
6
|
TARGET_TAG=${1:-"latest"}
|
|
7
|
+
PROJECT_NAME=${2:-"global"}
|
|
7
8
|
|
|
8
9
|
# =============================================================================
|
|
9
10
|
# OS Detection and Windows Handling
|
|
@@ -21,21 +22,6 @@ else
|
|
|
21
22
|
# =============================================================================
|
|
22
23
|
sudo apt install -y postgresql postgresql-contrib nginx
|
|
23
24
|
|
|
24
|
-
# =============================================================================
|
|
25
|
-
# Global Project Setup
|
|
26
|
-
# =============================================================================
|
|
27
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
28
|
-
echo " Setting up global project"
|
|
29
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
30
|
-
|
|
31
|
-
sudo mkdir -p /var/www
|
|
32
|
-
cd /var/www
|
|
33
|
-
|
|
34
|
-
ph init powerhouse
|
|
35
|
-
cd powerhouse
|
|
36
|
-
ph use $TARGET_TAG
|
|
37
|
-
ph connect build
|
|
38
|
-
|
|
39
25
|
# =============================================================================
|
|
40
26
|
# Interactive Package Installation
|
|
41
27
|
# =============================================================================
|
|
@@ -50,6 +36,11 @@ else
|
|
|
50
36
|
ph install "$package_name"
|
|
51
37
|
done
|
|
52
38
|
|
|
39
|
+
# =============================================================================
|
|
40
|
+
# Connect Build
|
|
41
|
+
# =============================================================================
|
|
42
|
+
ph connect build
|
|
43
|
+
|
|
53
44
|
# =============================================================================
|
|
54
45
|
# Database Configuration
|
|
55
46
|
# =============================================================================
|
|
@@ -67,11 +58,30 @@ else
|
|
|
67
58
|
# Generate database credentials
|
|
68
59
|
DB_PASSWORD="powerhouse"
|
|
69
60
|
DB_USER="powerhouse"
|
|
70
|
-
DB_NAME="
|
|
61
|
+
DB_NAME="powerhouse_${PROJECT_NAME}"
|
|
62
|
+
|
|
63
|
+
# Check if database already exists
|
|
64
|
+
if sudo -u postgres psql -lqt | cut -d \| -f 1 | grep -qw $DB_NAME; then
|
|
65
|
+
echo "Database $DB_NAME already exists"
|
|
66
|
+
read -p "Do you want to recreate it? (y/n): " recreate_db
|
|
67
|
+
if [ "$recreate_db" = "y" ]; then
|
|
68
|
+
sudo -u postgres psql -c "DROP DATABASE $DB_NAME;"
|
|
69
|
+
else
|
|
70
|
+
echo "Using existing database"
|
|
71
|
+
fi
|
|
72
|
+
fi
|
|
71
73
|
|
|
72
|
-
# Create database and user
|
|
74
|
+
# Create database and user if they don't exist
|
|
73
75
|
sudo -u postgres psql << EOF
|
|
74
|
-
|
|
76
|
+
DO
|
|
77
|
+
\$do\$
|
|
78
|
+
BEGIN
|
|
79
|
+
IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = '$DB_USER') THEN
|
|
80
|
+
CREATE USER $DB_USER WITH PASSWORD '$DB_PASSWORD';
|
|
81
|
+
END IF;
|
|
82
|
+
END
|
|
83
|
+
\$do\$;
|
|
84
|
+
|
|
75
85
|
CREATE DATABASE $DB_NAME OWNER $DB_USER;
|
|
76
86
|
GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;
|
|
77
87
|
EOF
|
|
@@ -92,7 +102,7 @@ EOF
|
|
|
92
102
|
fi
|
|
93
103
|
|
|
94
104
|
# Save DATABASE_URL to .env file
|
|
95
|
-
echo "DATABASE_URL=$DATABASE_URL" | sudo tee -a
|
|
105
|
+
echo "DATABASE_URL=$DATABASE_URL" | sudo tee -a .env
|
|
96
106
|
|
|
97
107
|
# =============================================================================
|
|
98
108
|
# SSL Configuration
|
|
@@ -115,17 +125,8 @@ EOF
|
|
|
115
125
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
116
126
|
echo " Domain Setup"
|
|
117
127
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
118
|
-
read -p "Enter
|
|
119
|
-
read -p "Enter
|
|
120
|
-
read -p "Enter subdomain for Switchboard service (default: switchboard): " switchboard_subdomain
|
|
121
|
-
|
|
122
|
-
# Set default subdomains
|
|
123
|
-
connect_subdomain=${connect_subdomain:-connect}
|
|
124
|
-
switchboard_subdomain=${switchboard_subdomain:-switchboard}
|
|
125
|
-
|
|
126
|
-
# Construct full domains
|
|
127
|
-
connect_domain="${connect_subdomain}.${base_domain}"
|
|
128
|
-
switchboard_domain="${switchboard_subdomain}.${base_domain}"
|
|
128
|
+
read -p "Enter Connect domain (e.g. connect.google.com): " connect_domain
|
|
129
|
+
read -p "Enter Switchboard domain (e.g. switchboard.google.com): " switchboard_domain
|
|
129
130
|
|
|
130
131
|
echo "Using domains:"
|
|
131
132
|
echo "Connect: $connect_domain"
|
|
@@ -137,12 +138,87 @@ EOF
|
|
|
137
138
|
sudo openssl req -x509 -nodes -days 1 -newkey rsa:2048 \
|
|
138
139
|
-keyout /etc/nginx/ssl/temp.key \
|
|
139
140
|
-out /etc/nginx/ssl/temp.crt \
|
|
140
|
-
-subj "/CN=$
|
|
141
|
+
-subj "/CN=$connect_domain" \
|
|
141
142
|
-addext "subjectAltName = DNS:$connect_domain,DNS:$switchboard_domain"
|
|
142
143
|
|
|
143
|
-
#
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
# Check if Nginx configuration already exists
|
|
145
|
+
if [ -f "/etc/nginx/sites-available/$PROJECT_NAME" ]; then
|
|
146
|
+
echo "Nginx configuration for $PROJECT_NAME already exists"
|
|
147
|
+
read -p "Do you want to overwrite it? (y/n): " overwrite_nginx
|
|
148
|
+
if [ "$overwrite_nginx" != "y" ]; then
|
|
149
|
+
echo "Keeping existing Nginx configuration"
|
|
150
|
+
else
|
|
151
|
+
# Create Nginx configuration for domains
|
|
152
|
+
echo "Creating Nginx configuration..."
|
|
153
|
+
sudo tee /etc/nginx/sites-available/$PROJECT_NAME > /dev/null << EOF
|
|
154
|
+
# Security headers
|
|
155
|
+
add_header Strict-Transport-Security "max-age=63072000" always;
|
|
156
|
+
add_header X-Frame-Options DENY;
|
|
157
|
+
add_header X-Content-Type-Options nosniff;
|
|
158
|
+
add_header X-XSS-Protection "1; mode=block";
|
|
159
|
+
|
|
160
|
+
server {
|
|
161
|
+
listen 80;
|
|
162
|
+
server_name $connect_domain $switchboard_domain;
|
|
163
|
+
return 301 https://\$host\$request_uri;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
server {
|
|
167
|
+
listen 443 ssl http2;
|
|
168
|
+
server_name $connect_domain;
|
|
169
|
+
|
|
170
|
+
ssl_certificate /etc/nginx/ssl/temp.crt;
|
|
171
|
+
ssl_certificate_key /etc/nginx/ssl/temp.key;
|
|
172
|
+
|
|
173
|
+
# SSL configuration
|
|
174
|
+
ssl_protocols TLSv1.2 TLSv1.3;
|
|
175
|
+
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;
|
|
176
|
+
ssl_prefer_server_ciphers off;
|
|
177
|
+
ssl_session_timeout 1d;
|
|
178
|
+
ssl_session_cache shared:SSL:50m;
|
|
179
|
+
ssl_session_tickets off;
|
|
180
|
+
ssl_stapling on;
|
|
181
|
+
ssl_stapling_verify on;
|
|
182
|
+
|
|
183
|
+
if (\$http_x_forwarded_proto = "http") {
|
|
184
|
+
return 301 https://\$server_name\$request_uri;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
location / {
|
|
188
|
+
root $PWD/.ph/connect-build/dist;
|
|
189
|
+
try_files \$uri \$uri/ /index.html;
|
|
190
|
+
add_header Cache-Control "no-cache";
|
|
191
|
+
add_header X-Forwarded-Proto \$scheme;
|
|
192
|
+
add_header X-Forwarded-Host \$host;
|
|
193
|
+
add_header X-Forwarded-Port \$server_port;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
server {
|
|
198
|
+
listen 443 ssl http2;
|
|
199
|
+
server_name $switchboard_domain;
|
|
200
|
+
|
|
201
|
+
ssl_certificate /etc/nginx/ssl/temp.crt;
|
|
202
|
+
ssl_certificate_key /etc/nginx/ssl/temp.key;
|
|
203
|
+
|
|
204
|
+
location / {
|
|
205
|
+
proxy_pass http://localhost:4001;
|
|
206
|
+
proxy_http_version 1.1;
|
|
207
|
+
proxy_set_header Upgrade \$http_upgrade;
|
|
208
|
+
proxy_set_header Connection 'upgrade';
|
|
209
|
+
proxy_set_header Host \$host;
|
|
210
|
+
proxy_cache_bypass \$http_upgrade;
|
|
211
|
+
proxy_set_header X-Real-IP \$remote_addr;
|
|
212
|
+
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
|
213
|
+
proxy_set_header X-Forwarded-Proto \$scheme;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
EOF
|
|
217
|
+
fi
|
|
218
|
+
else
|
|
219
|
+
# Create Nginx configuration for domains
|
|
220
|
+
echo "Creating Nginx configuration..."
|
|
221
|
+
sudo tee /etc/nginx/sites-available/$PROJECT_NAME > /dev/null << EOF
|
|
146
222
|
# Security headers
|
|
147
223
|
add_header Strict-Transport-Security "max-age=63072000" always;
|
|
148
224
|
add_header X-Frame-Options DENY;
|
|
@@ -177,7 +253,7 @@ server {
|
|
|
177
253
|
}
|
|
178
254
|
|
|
179
255
|
location / {
|
|
180
|
-
root
|
|
256
|
+
root $PWD/.ph/connect-build/dist;
|
|
181
257
|
try_files \$uri \$uri/ /index.html;
|
|
182
258
|
add_header Cache-Control "no-cache";
|
|
183
259
|
add_header X-Forwarded-Proto \$scheme;
|
|
@@ -206,18 +282,18 @@ server {
|
|
|
206
282
|
}
|
|
207
283
|
}
|
|
208
284
|
EOF
|
|
285
|
+
fi
|
|
209
286
|
|
|
210
287
|
# Enable the site
|
|
211
|
-
sudo ln -sf /etc/nginx/sites-available
|
|
288
|
+
sudo ln -sf /etc/nginx/sites-available/$PROJECT_NAME /etc/nginx/sites-enabled/
|
|
212
289
|
sudo rm -f /etc/nginx/sites-enabled/default
|
|
213
290
|
|
|
214
|
-
# Test
|
|
291
|
+
# Test Nginx configuration
|
|
215
292
|
sudo nginx -t
|
|
216
|
-
sudo systemctl restart nginx
|
|
217
293
|
|
|
218
294
|
# Obtain SSL certificates
|
|
219
295
|
echo "Obtaining SSL certificates..."
|
|
220
|
-
sudo certbot --nginx -d $connect_domain -d $switchboard_domain --non-interactive --agree-tos --email admin@$
|
|
296
|
+
sudo certbot --nginx -d $connect_domain -d $switchboard_domain --non-interactive --agree-tos --email admin@$connect_domain
|
|
221
297
|
|
|
222
298
|
# Remove temporary certificates
|
|
223
299
|
sudo rm -f /etc/nginx/ssl/temp.*
|
|
@@ -236,7 +312,7 @@ EOF
|
|
|
236
312
|
|
|
237
313
|
# Create Nginx configuration for self-signed
|
|
238
314
|
echo "Creating Nginx configuration..."
|
|
239
|
-
sudo tee /etc/nginx/sites-available
|
|
315
|
+
sudo tee /etc/nginx/sites-available/$PROJECT_NAME > /dev/null << EOF
|
|
240
316
|
# Security headers
|
|
241
317
|
add_header Strict-Transport-Security "max-age=63072000" always;
|
|
242
318
|
add_header X-Frame-Options DENY;
|
|
@@ -283,36 +359,20 @@ server {
|
|
|
283
359
|
EOF
|
|
284
360
|
|
|
285
361
|
# Enable the site
|
|
286
|
-
sudo ln -sf /etc/nginx/sites-available
|
|
362
|
+
sudo ln -sf /etc/nginx/sites-available/$PROJECT_NAME /etc/nginx/sites-enabled/
|
|
287
363
|
sudo rm -f /etc/nginx/sites-enabled/default
|
|
288
364
|
|
|
289
|
-
# Test
|
|
365
|
+
# Test Nginx configuration
|
|
290
366
|
sudo nginx -t
|
|
291
|
-
sudo systemctl restart nginx
|
|
292
367
|
fi
|
|
293
368
|
|
|
294
369
|
# =============================================================================
|
|
295
|
-
#
|
|
370
|
+
# Database Schema Setup
|
|
296
371
|
# =============================================================================
|
|
297
|
-
# Install PM2 globally if not already installed
|
|
298
|
-
if ! command -v pm2 &> /dev/null; then
|
|
299
|
-
pnpm install -g pm2
|
|
300
|
-
fi
|
|
301
|
-
|
|
302
372
|
pnpm prisma db push --schema node_modules/document-drive/dist/prisma/schema.prisma
|
|
303
|
-
pnpm add @powerhousedao/switchboard@dev
|
|
304
373
|
|
|
305
|
-
|
|
306
|
-
echo "
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
pm2 start pnpm switchboard --name "switchboard" -- --base-path /switchboard
|
|
310
|
-
else
|
|
311
|
-
# Let's Encrypt - no base paths needed
|
|
312
|
-
pm2 start "pnpm switchboard" --name "switchboard"
|
|
313
|
-
fi
|
|
314
|
-
|
|
315
|
-
# Save PM2 process list and setup startup script
|
|
316
|
-
pm2 save
|
|
317
|
-
pm2 startup
|
|
374
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
375
|
+
echo " Environment setup complete!"
|
|
376
|
+
echo " Use 'ph service start' to start services"
|
|
377
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
318
378
|
fi
|
|
@@ -33,10 +33,8 @@ if (-not (Test-Path $installPath)) {
|
|
|
33
33
|
Set-Location $installPath
|
|
34
34
|
|
|
35
35
|
# Initialize Powerhouse project
|
|
36
|
-
ph init powerhouse
|
|
36
|
+
ph init powerhouse --$TARGET_TAG
|
|
37
37
|
Set-Location powerhouse
|
|
38
|
-
ph use $TARGET_TAG
|
|
39
|
-
ph connect build
|
|
40
38
|
|
|
41
39
|
# Interactive package installation loop
|
|
42
40
|
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
@@ -50,6 +48,9 @@ while ($true) {
|
|
|
50
48
|
ph install $package_name
|
|
51
49
|
}
|
|
52
50
|
|
|
51
|
+
# Build Connect
|
|
52
|
+
ph connect build
|
|
53
|
+
|
|
53
54
|
# Database Configuration
|
|
54
55
|
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
55
56
|
Write-Host " Database Configuration"
|
|
@@ -296,7 +297,6 @@ if (-not (Get-Command pm2 -ErrorAction SilentlyContinue)) {
|
|
|
296
297
|
|
|
297
298
|
# Run database migrations
|
|
298
299
|
pnpm prisma db push --schema node_modules/document-drive/dist/prisma/schema.prisma
|
|
299
|
-
pnpm add @powerhousedao/switchboard@dev
|
|
300
300
|
|
|
301
301
|
# Start services with PM2
|
|
302
302
|
Write-Host "Starting services with PM2..."
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAY9C,eAAO,MAAM,QAAQ,2BAYpB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,OAAO,EAAE,OAAO,QAExD"}
|
|
@@ -7,7 +7,6 @@ import { installCommand } from "./install.js";
|
|
|
7
7
|
import { listCommand } from "./list.js";
|
|
8
8
|
import { reactorCommand } from "./reactor.js";
|
|
9
9
|
import { serviceCommand } from "./service.js";
|
|
10
|
-
import { setupServiceCommand } from "./setup-service.js";
|
|
11
10
|
import { switchboardCommand } from "./switchboard.js";
|
|
12
11
|
import { uninstallCommand } from "./uninstall.js";
|
|
13
12
|
export const commands = [
|
|
@@ -22,7 +21,6 @@ export const commands = [
|
|
|
22
21
|
listCommand,
|
|
23
22
|
inspectCommand,
|
|
24
23
|
switchboardCommand,
|
|
25
|
-
setupServiceCommand,
|
|
26
24
|
];
|
|
27
25
|
export default function registerCommands(program) {
|
|
28
26
|
commands.forEach((command) => command(program));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,yCAAyC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,yCAAyC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,cAAc;IACd,cAAc;IACd,eAAe;IACf,cAAc;IACd,WAAW;IACX,cAAc;IACd,gBAAgB;IAChB,cAAc;IACd,WAAW;IACX,cAAc;IACd,kBAAkB;CACnB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,OAAgB;IACvD,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Command } from "commander";
|
|
2
2
|
import { type CommandActionType } from "../types.js";
|
|
3
|
-
export declare const manageService: CommandActionType<[string
|
|
3
|
+
export declare const manageService: CommandActionType<[string]>;
|
|
4
4
|
export declare function serviceCommand(program: Command): void;
|
|
5
5
|
//# sourceMappingURL=service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/commands/service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/commands/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAMnD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAWrD,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAqErD,CAAC;AAEF,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,QAQ9C"}
|