magicserve 1.2.7 → 2.0.2
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/README.es.md +24 -17
- package/README.md +25 -17
- package/package.json +2 -2
- package/run.sh +19 -95
package/README.es.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
*[Read in English](README.md)*
|
|
4
4
|
|
|
5
|
-
Magicserve es una herramienta CLI para gestionar entornos de desarrollo web locales.
|
|
5
|
+
Magicserve es una herramienta CLI para gestionar entornos de desarrollo web locales. Levanta automáticamente un Reverse Proxy (Nginx) con HTTPS para múltiples servicios locales a la vez, genera certificados SSL vía `mkcert` y le asigna a cada uno un dominio dinámico (ej. `tu-proyecto.test`), además de URLs públicas opcionales vía `localtunnel`.
|
|
6
|
+
|
|
7
|
+
> **Tú levantas tus propios servidores.** Magicserve **no** inicia ni detiene tus apps. Tú levantas lo que quieras (Node, PHP, Python, Go, …) en los puertos que listes en `magicserve.json`, y Magicserve enlaza el dominio HTTPS, el certificado y el túnel a ese puerto.
|
|
6
8
|
|
|
7
9
|
## Requisitos
|
|
8
10
|
|
|
@@ -45,20 +47,16 @@ Este comando creará automáticamente un archivo base llamado **`magicserve.json
|
|
|
45
47
|
|
|
46
48
|
### Archivo de configuración: `magicserve.json`
|
|
47
49
|
|
|
48
|
-
Tu directorio central
|
|
50
|
+
Tu directorio central mapea dominios a los puertos locales de las apps que tú mismo levantas. Su estructura es así de sencilla:
|
|
49
51
|
|
|
50
52
|
```json
|
|
51
53
|
[
|
|
52
54
|
{
|
|
53
|
-
"path": "../tu-proyecto-frontal",
|
|
54
55
|
"domain": "tu-proyecto.test",
|
|
55
|
-
"type": "node",
|
|
56
56
|
"port": 3000
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
|
-
"path": "../tu-api-backend",
|
|
60
59
|
"domain": "api.tu-proyecto.test",
|
|
61
|
-
"type": "php",
|
|
62
60
|
"port": 3001,
|
|
63
61
|
"tunnel": "mi-super-api-dev"
|
|
64
62
|
}
|
|
@@ -66,13 +64,11 @@ Tu directorio central gestiona y levanta las aplicaciones referenciadas dentro d
|
|
|
66
64
|
```
|
|
67
65
|
|
|
68
66
|
**Propiedades:**
|
|
69
|
-
- **`path`**: Ruta relativa o absoluta hacia el directorio del proyecto donde se deberá correr el servidor.
|
|
70
67
|
- **`domain`**: El dominio de desarrollo local que se enlazará automáticamente (eg. `*.test`).
|
|
71
|
-
- **`
|
|
72
|
-
- **`
|
|
73
|
-
- **`tunnel`**: *(Opcional)* Subdominio para enlazar puerto interno y exponerlo a internet público a través de `localtunnel` (Ej. webhooks de Mercado Libre o pruebas móviles).
|
|
68
|
+
- **`port`**: El puerto local donde está escuchando **tu** servidor. Magicserve hace proxy del dominio a `localhost:<port>`; tú eres responsable de levantar ese servidor.
|
|
69
|
+
- **`tunnel`**: *(Opcional)* Subdominio para exponer tu puerto a internet público a través de `localtunnel` (Ej. webhooks de Mercado Libre o pruebas móviles). Usa `true` para un subdominio aleatorio.
|
|
74
70
|
|
|
75
|
-
Una vez configurado
|
|
71
|
+
Una vez configurado a tu gusto, levanta tus propios servidores en esos puertos y utiliza los comandos de control.
|
|
76
72
|
|
|
77
73
|
## Comandos disponibles
|
|
78
74
|
|
|
@@ -88,8 +84,8 @@ flowchart TD
|
|
|
88
84
|
subgraph Tu Computadora Local
|
|
89
85
|
Nginx(Nginx Proxy Inverso SSL)
|
|
90
86
|
LT(LocalTunnel Túnel Reverso)
|
|
91
|
-
Node((Servidor
|
|
92
|
-
PHP((Servidor
|
|
87
|
+
Node((Tu Servidor\nEj. 3000))
|
|
88
|
+
PHP((Tu Servidor\nEj. 3001))
|
|
93
89
|
end
|
|
94
90
|
|
|
95
91
|
Dev -- "https://tu-proyecto.test" --> Nginx
|
|
@@ -100,16 +96,27 @@ flowchart TD
|
|
|
100
96
|
LT -- "Túnel" --> PHP
|
|
101
97
|
```
|
|
102
98
|
|
|
99
|
+
> Magicserve gestiona las partes de infraestructura (proxy Nginx, SSL, hosts, túnel). Los servidores detrás de los puertos los inicias y detienes tú.
|
|
103
100
|
|
|
104
101
|
Dentro del directorio donde está tu `magicserve.json`, dispones de los siguientes comandos mágicos:
|
|
105
102
|
|
|
106
|
-
- **`magicserve start`**:
|
|
107
|
-
- **`magicserve stop`**:
|
|
108
|
-
- **`magicserve status`**: Te muestra en
|
|
109
|
-
- **`magicserve stopall`**: Comando de emergencia.
|
|
103
|
+
- **`magicserve start`**: Para cada dominio genera el certificado SSL si hace falta, agrega la entrada en `/etc/hosts`, escribe el proxy HTTPS de Nginx hacia `localhost:<port>` y abre los túneles configurados. (Levanta tus servidores antes o después — Magicserve no los inicia.)
|
|
104
|
+
- **`magicserve stop`**: Quita los proxys de Nginx y las entradas de `/etc/hosts` y cierra los túneles de los dominios de tu `magicserve.json`. Tus servidores siguen corriendo.
|
|
105
|
+
- **`magicserve status`**: Te muestra si hay un servidor escuchando en el puerto de cada dominio, más el estado y la URL pública de los túneles.
|
|
106
|
+
- **`magicserve stopall`**: Comando de emergencia. Destruye TODAS las configuraciones de proxy de Nginx, túneles, certificados SSL y entradas custom de `localhost` en todo el sistema, restaurando tu computadora. (Ya no mata tus servidores de apps — esos los gestionas tú.)
|
|
110
107
|
|
|
111
108
|
---
|
|
112
109
|
|
|
110
|
+
### Novedades en v2.0.0 🔌 (Breaking)
|
|
111
|
+
|
|
112
|
+
- **Tú levantas tus propios servidores.** Magicserve ya no inicia procesos `node`/`php` — solo configura el proxy HTTPS de Nginx, el certificado SSL, la entrada en `/etc/hosts` y el túnel opcional apuntando al puerto que tú levantas (funciona con **cualquier** stack: Node, PHP, Python, Go, …).
|
|
113
|
+
- **Config más simple.** `magicserve.json` ahora solo lleva `domain` + `port` (+ `tunnel` opcional). Se eliminaron las propiedades `path` y `type`.
|
|
114
|
+
- **`stop` no afecta a tus apps.** Solo retira el proxy y los túneles; tus servidores siguen corriendo.
|
|
115
|
+
- **`status` revisa el puerto.** Ahora reporta si hay algo escuchando en cada puerto (vía `lsof`) en lugar de rastrear el PID de un servidor.
|
|
116
|
+
- **`stopall` ya no mata tus servidores de apps** (esos los gestionas tú); sigue purgando todos los proxys, túneles, certificados y entradas custom de `hosts`.
|
|
117
|
+
|
|
118
|
+
> **Migrar desde v1.x:** elimina `path` y `type` de cada entrada de tu `magicserve.json`, y levanta tus servidores tú mismo antes/después de ejecutar `magicserve start`.
|
|
119
|
+
|
|
113
120
|
### Novedades en v1.2.0 🚇
|
|
114
121
|
|
|
115
122
|
- **Localtunnel Integrado**: Expón de forma permanente y automática puertos de tu API al internet vía la nueva propiedad `tunnel` en el config json para recibir **Webhooks** de terceros (Mercado Libre, Stripe, etc).
|
package/README.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
*[Leer en Español](README.es.md)*
|
|
4
4
|
|
|
5
|
-
Magicserve is a CLI tool for managing local web development environments.
|
|
5
|
+
Magicserve is a CLI tool for managing local web development environments. It automatically sets up a Reverse Proxy (Nginx) with HTTPS for multiple local services at once, generates SSL certificates via `mkcert`, and assigns each a dynamic local domain (e.g. `your-project.test`) — plus optional public `localtunnel` URLs.
|
|
6
|
+
|
|
7
|
+
> **You run your own servers.** Magicserve does **not** start or stop your apps. Launch whatever you want (Node, PHP, Python, Go, …) on the ports listed in `magicserve.json`, and Magicserve wires the HTTPS domain, certificate, and tunnel to that port.
|
|
6
8
|
|
|
7
9
|
## Requirements
|
|
8
10
|
|
|
@@ -45,20 +47,16 @@ This command will automatically create a base **`magicserve.json`** file in the
|
|
|
45
47
|
|
|
46
48
|
### Configuration File: `magicserve.json`
|
|
47
49
|
|
|
48
|
-
Your central directory
|
|
50
|
+
Your central directory maps domains to the local ports of the apps you run yourself. Its structure is this simple:
|
|
49
51
|
|
|
50
52
|
```json
|
|
51
53
|
[
|
|
52
54
|
{
|
|
53
|
-
"path": "../your-frontend-project",
|
|
54
55
|
"domain": "your-project.test",
|
|
55
|
-
"type": "node",
|
|
56
56
|
"port": 3000
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
|
-
"path": "../your-backend-api",
|
|
60
59
|
"domain": "api.your-project.test",
|
|
61
|
-
"type": "php",
|
|
62
60
|
"port": 3001,
|
|
63
61
|
"tunnel": "my-cool-api-dev"
|
|
64
62
|
}
|
|
@@ -66,13 +64,11 @@ Your central directory manages and starts the applications referenced within the
|
|
|
66
64
|
```
|
|
67
65
|
|
|
68
66
|
**Properties:**
|
|
69
|
-
- **`path`**: Relative or absolute path to the project's directory where the server should run.
|
|
70
67
|
- **`domain`**: The local development domain that will be automatically mapped (e.g. `*.test`).
|
|
71
|
-
- **`
|
|
72
|
-
- **`
|
|
73
|
-
- **`tunnel`**: *(Optional)* Subdomain to securely expose your internal port to the public internet via `localtunnel` (Great for testing third-party Webhooks like Mercado Libre or local mobile testing).
|
|
68
|
+
- **`port`**: The local port where **your** server is listening. Magicserve proxies the domain to `localhost:<port>`; you are responsible for starting that server.
|
|
69
|
+
- **`tunnel`**: *(Optional)* Subdomain to securely expose your port to the public internet via `localtunnel` (Great for testing third-party Webhooks like Mercado Libre or local mobile testing). Use `true` for a random subdomain.
|
|
74
70
|
|
|
75
|
-
Once configured
|
|
71
|
+
Once configured to your liking, start your own servers on those ports, then use the control commands below.
|
|
76
72
|
|
|
77
73
|
## Available Commands
|
|
78
74
|
|
|
@@ -88,8 +84,8 @@ flowchart TD
|
|
|
88
84
|
subgraph Your Local Machine
|
|
89
85
|
Nginx(Nginx Reverse Proxy with HTTPS)
|
|
90
86
|
LT(LocalTunnel Reverse Tunnel)
|
|
91
|
-
Node((
|
|
92
|
-
PHP((
|
|
87
|
+
Node((Your Server\ne.g. 3000))
|
|
88
|
+
PHP((Your Server\ne.g. 3001))
|
|
93
89
|
end
|
|
94
90
|
|
|
95
91
|
Dev -- "https://your-project.test" --> Nginx
|
|
@@ -100,15 +96,27 @@ flowchart TD
|
|
|
100
96
|
LT -- "Tunnel" --> PHP
|
|
101
97
|
```
|
|
102
98
|
|
|
99
|
+
> Magicserve manages the dashed parts (Nginx proxy, SSL, hosts, tunnel). The servers behind the ports are started and stopped by you.
|
|
100
|
+
|
|
103
101
|
Within the directory where your `magicserve.json` is located, you have the following magic commands available:
|
|
104
102
|
|
|
105
|
-
- **`magicserve start`**:
|
|
106
|
-
- **`magicserve stop`**:
|
|
107
|
-
- **`magicserve status`**: Shows a
|
|
108
|
-
- **`magicserve stopall`**: Emergency command.
|
|
103
|
+
- **`magicserve start`**: For every domain, generates an SSL certificate if needed, adds the `/etc/hosts` entry, writes the Nginx HTTPS proxy to `localhost:<port>`, and opens any configured tunnels. (Start your own servers first or afterward — Magicserve does not launch them.)
|
|
104
|
+
- **`magicserve stop`**: Removes the Nginx proxies and `/etc/hosts` entries and closes the tunnels for the domains in your `magicserve.json`. Your servers keep running.
|
|
105
|
+
- **`magicserve status`**: Shows whether a server is currently listening on each domain's port, plus the status and public URL of any tunnels.
|
|
106
|
+
- **`magicserve stopall`**: Emergency command. Destroys ALL Nginx proxy configs, tunnels, SSL certificates and custom `localhost` entries system-wide, restoring your machine's clean state. (It no longer kills your app servers — those are yours to manage.)
|
|
109
107
|
|
|
110
108
|
---
|
|
111
109
|
|
|
110
|
+
### Features in v2.0.0 🔌 (Breaking)
|
|
111
|
+
|
|
112
|
+
- **You run your own servers.** Magicserve no longer launches `node`/`php` processes — it only sets up the Nginx HTTPS proxy, SSL certificate, `/etc/hosts` entry and optional tunnel pointing at the port you bring up yourself (works with **any** stack: Node, PHP, Python, Go, …).
|
|
113
|
+
- **Simpler config.** `magicserve.json` now takes only `domain` + `port` (+ optional `tunnel`). The `path` and `type` properties have been removed.
|
|
114
|
+
- **`stop` is non-destructive to your apps.** It tears down the proxy and tunnels only; your servers keep running.
|
|
115
|
+
- **`status` probes the port.** It now reports whether something is listening on each port (via `lsof`) instead of tracking a server PID.
|
|
116
|
+
- **`stopall` no longer kills app servers** (those are yours to manage); it still purges all proxies, tunnels, certificates and custom `hosts` entries.
|
|
117
|
+
|
|
118
|
+
> **Migrating from v1.x:** remove `path` and `type` from each entry in your `magicserve.json`, and start your servers yourself before/after running `magicserve start`.
|
|
119
|
+
|
|
112
120
|
### Features in v1.2.0 🚇
|
|
113
121
|
|
|
114
122
|
- **Integrated Localtunnel**: Permanently and automatically expose any of your API ports to the internet via the new `tunnel` property in config JSON to seamlessly receive third-party **Webhooks** (Mercado Libre, Stripe, etc).
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magicserve",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.2",
|
|
4
|
+
"description": "CLI to wire local HTTPS domains, SSL and tunnels to ports you run yourself",
|
|
5
5
|
"files": [
|
|
6
6
|
"run.sh",
|
|
7
7
|
"package.json"
|
package/run.sh
CHANGED
|
@@ -45,45 +45,13 @@ usage() {
|
|
|
45
45
|
echo " magicserve [start|stop|stopall|status|init]"
|
|
46
46
|
echo ""
|
|
47
47
|
echo " init - Crea un archivo magicserve.json de plantilla en la carpeta actual"
|
|
48
|
-
echo " start -
|
|
49
|
-
echo " stop - Detiene los
|
|
50
|
-
echo " stopall -
|
|
51
|
-
echo " status - Muestra el estado de los
|
|
48
|
+
echo " start - Configura proxy Nginx (HTTPS) y túneles para los dominios del magicserve.json"
|
|
49
|
+
echo " stop - Detiene los proxys y túneles del magicserve.json (no toca tus servidores)"
|
|
50
|
+
echo " stopall - Borra TODOS los proxys, túneles, certificados y entradas de hosts (sin depender de magicserve.json)"
|
|
51
|
+
echo " status - Muestra si hay un servidor escuchando en cada puerto y el estado de los túneles"
|
|
52
52
|
exit 1
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
start_server() {
|
|
56
|
-
local PATH_DIR=$1
|
|
57
|
-
local DOMAIN=$2
|
|
58
|
-
local TYPE=$3
|
|
59
|
-
local PORT=$4
|
|
60
|
-
|
|
61
|
-
local PID_FILE="$PIDS_DIR/${DOMAIN}.pid"
|
|
62
|
-
|
|
63
|
-
echo "🚀 Iniciando $DOMAIN ($TYPE) en puerto $PORT..."
|
|
64
|
-
|
|
65
|
-
# Navegar al directorio del proyecto relativo al script
|
|
66
|
-
cd "$SCRIPT_DIR/$PATH_DIR" || {
|
|
67
|
-
echo "❌ Error: Directorio $PATH_DIR no encontrado para $DOMAIN"
|
|
68
|
-
return
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if [ "$TYPE" == "node" ]; then
|
|
72
|
-
nohup npm run dev -- --port $PORT > "$LOGS_DIR/${DOMAIN}.log" 2>&1 &
|
|
73
|
-
local PID=$!
|
|
74
|
-
echo $PID > "$PID_FILE"
|
|
75
|
-
echo "✅ Node corriendo (PID: $PID)"
|
|
76
|
-
elif [ "$TYPE" == "php" ]; then
|
|
77
|
-
# El docroot por defecto para php es el directorio actual
|
|
78
|
-
nohup php -d upload_max_filesize=100M -d post_max_size=100M -S "localhost:$PORT" -t . > "$LOGS_DIR/${DOMAIN}.log" 2>&1 &
|
|
79
|
-
local PID=$!
|
|
80
|
-
echo $PID > "$PID_FILE"
|
|
81
|
-
echo "✅ PHP corriendo (PID: $PID)"
|
|
82
|
-
else
|
|
83
|
-
echo "❌ Tipo $TYPE no soportado (usa 'node' o 'php')"
|
|
84
|
-
fi
|
|
85
|
-
}
|
|
86
|
-
|
|
87
55
|
start_proxy() {
|
|
88
56
|
local DOMAIN=$1
|
|
89
57
|
local PORT=$2
|
|
@@ -200,17 +168,16 @@ start_tunnel() {
|
|
|
200
168
|
}
|
|
201
169
|
|
|
202
170
|
start_all() {
|
|
203
|
-
echo "🌟
|
|
171
|
+
echo "🌟 Configurando proxys y túneles desde magicserve.json..."
|
|
172
|
+
echo "💡 Recuerda: tú debes levantar tus servidores (node/php/python/etc) en los puertos indicados."
|
|
173
|
+
echo ""
|
|
204
174
|
|
|
205
175
|
local LENGTH=$(jq '. | length' "$CONFIG_FILE")
|
|
206
176
|
for (( i=0; i<$LENGTH; i++ )); do
|
|
207
|
-
local PATH_DIR=$(jq -r ".[$i].path" "$CONFIG_FILE")
|
|
208
177
|
local DOMAIN=$(jq -r ".[$i].domain" "$CONFIG_FILE")
|
|
209
|
-
local TYPE=$(jq -r ".[$i].type" "$CONFIG_FILE")
|
|
210
178
|
local PORT=$(jq -r ".[$i].port" "$CONFIG_FILE")
|
|
211
179
|
local TUNNEL=$(jq -r ".[$i].tunnel // empty" "$CONFIG_FILE")
|
|
212
180
|
|
|
213
|
-
start_server "$PATH_DIR" "$DOMAIN" "$TYPE" "$PORT"
|
|
214
181
|
start_proxy "$DOMAIN" "$PORT"
|
|
215
182
|
|
|
216
183
|
if [ -n "$TUNNEL" ]; then
|
|
@@ -229,7 +196,7 @@ start_all() {
|
|
|
229
196
|
}
|
|
230
197
|
|
|
231
198
|
stop_all() {
|
|
232
|
-
echo "🛑 Deteniendo
|
|
199
|
+
echo "🛑 Deteniendo proxys y túneles..."
|
|
233
200
|
|
|
234
201
|
local HOSTS_FILE="/etc/hosts"
|
|
235
202
|
local NGINX_SERVER_DIR="/opt/homebrew/etc/nginx/servers"
|
|
@@ -237,18 +204,6 @@ stop_all() {
|
|
|
237
204
|
local LENGTH=$(jq '. | length' "$CONFIG_FILE")
|
|
238
205
|
for (( i=0; i<$LENGTH; i++ )); do
|
|
239
206
|
local DOMAIN=$(jq -r ".[$i].domain" "$CONFIG_FILE")
|
|
240
|
-
local PID_FILE="$PIDS_DIR/${DOMAIN}.pid"
|
|
241
|
-
|
|
242
|
-
if [ -f "$PID_FILE" ]; then
|
|
243
|
-
local PID=$(cat "$PID_FILE")
|
|
244
|
-
if ps -p $PID > /dev/null; then
|
|
245
|
-
kill $PID
|
|
246
|
-
echo "🛑 Servidor para $DOMAIN detenido (PID: $PID)."
|
|
247
|
-
else
|
|
248
|
-
echo "⚠️ Proceso para $DOMAIN no encontrado (el archivo PID será limpiado)."
|
|
249
|
-
fi
|
|
250
|
-
rm "$PID_FILE"
|
|
251
|
-
fi
|
|
252
207
|
|
|
253
208
|
local TUNNEL_PID_FILE="$PIDS_DIR/${DOMAIN}_tunnel.pid"
|
|
254
209
|
local TUNNEL_URL_FILE="$PIDS_DIR/${DOMAIN}_tunnel.url"
|
|
@@ -279,7 +234,7 @@ stop_all() {
|
|
|
279
234
|
sudo nginx -s reload > /dev/null 2>&1
|
|
280
235
|
fi
|
|
281
236
|
|
|
282
|
-
echo "✅
|
|
237
|
+
echo "✅ Proxys y túneles detenidos. (Tus servidores siguen corriendo, deténlos tú mismo)."
|
|
283
238
|
}
|
|
284
239
|
|
|
285
240
|
status() {
|
|
@@ -287,17 +242,14 @@ status() {
|
|
|
287
242
|
local LENGTH=$(jq '. | length' "$CONFIG_FILE")
|
|
288
243
|
for (( i=0; i<$LENGTH; i++ )); do
|
|
289
244
|
local DOMAIN=$(jq -r ".[$i].domain" "$CONFIG_FILE")
|
|
290
|
-
local
|
|
245
|
+
local PORT=$(jq -r ".[$i].port" "$CONFIG_FILE")
|
|
291
246
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
else
|
|
297
|
-
echo "🔴 $DOMAIN: Archivo PID existe pero el proceso no está corriendo"
|
|
298
|
-
fi
|
|
247
|
+
# No gestionamos el proceso del servidor: comprobamos si algo escucha en el puerto
|
|
248
|
+
local LISTENER=$(lsof -nP -iTCP:$PORT -sTCP:LISTEN -t 2>/dev/null | head -1)
|
|
249
|
+
if [ -n "$LISTENER" ]; then
|
|
250
|
+
echo "🟢 $DOMAIN → localhost:$PORT (servidor escuchando, PID: $LISTENER)"
|
|
299
251
|
else
|
|
300
|
-
echo "⚪️ $DOMAIN
|
|
252
|
+
echo "⚪️ $DOMAIN → localhost:$PORT (nada escuchando — levanta tu servidor)"
|
|
301
253
|
fi
|
|
302
254
|
|
|
303
255
|
local TUNNEL_PID_FILE="$PIDS_DIR/${DOMAIN}_tunnel.pid"
|
|
@@ -350,35 +302,11 @@ stop_all_global() {
|
|
|
350
302
|
echo " ✅ No se encontraron archivos .pid"
|
|
351
303
|
fi
|
|
352
304
|
|
|
353
|
-
#
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
local PHP_PIDS=$(pgrep -f "php -S" 2>/dev/null)
|
|
357
|
-
if [ -n "$PHP_PIDS" ]; then
|
|
358
|
-
echo "$PHP_PIDS" | while read PID; do
|
|
359
|
-
local CMD=$(ps -p $PID -o args= 2>/dev/null)
|
|
360
|
-
kill $PID 2>/dev/null
|
|
361
|
-
echo " 🛑 PHP detenido (PID: $PID) → $CMD"
|
|
362
|
-
done
|
|
363
|
-
else
|
|
364
|
-
echo " ✅ No se encontraron servidores PHP"
|
|
365
|
-
fi
|
|
366
|
-
|
|
367
|
-
# ─── 3. Matar TODOS los servidores Node de desarrollo ───
|
|
368
|
-
echo ""
|
|
369
|
-
echo "🔍 Buscando servidores Node de desarrollo (vite, next, nuxt, webpack)..."
|
|
370
|
-
local NODE_PIDS=$(pgrep -f "(vite|next dev|nuxt|webpack-dev-server|node.*dev)" 2>/dev/null)
|
|
371
|
-
if [ -n "$NODE_PIDS" ]; then
|
|
372
|
-
echo "$NODE_PIDS" | while read PID; do
|
|
373
|
-
local CMD=$(ps -p $PID -o args= 2>/dev/null | head -c 120)
|
|
374
|
-
kill $PID 2>/dev/null
|
|
375
|
-
echo " 🛑 Node detenido (PID: $PID) → $CMD"
|
|
376
|
-
done
|
|
377
|
-
else
|
|
378
|
-
echo " ✅ No se encontraron servidores Node de desarrollo"
|
|
379
|
-
fi
|
|
305
|
+
# NOTA: Magicserve ya no lanza servidores (node/php/python), así que tampoco
|
|
306
|
+
# los mata aquí. Tus servidores los gestionas tú. Solo limpiamos lo que
|
|
307
|
+
# Magicserve crea: túneles, configs de nginx, /etc/hosts, certificados y logs.
|
|
380
308
|
|
|
381
|
-
# ───
|
|
309
|
+
# ─── 2. Matar procesos de localtunnel ───
|
|
382
310
|
echo ""
|
|
383
311
|
echo "🔍 Buscando procesos de localtunnel..."
|
|
384
312
|
local LT_PIDS=$(pgrep -f "localtunnel" 2>/dev/null)
|
|
@@ -466,15 +394,11 @@ init_config() {
|
|
|
466
394
|
cat <<EOF > "$CONFIG_FILE"
|
|
467
395
|
[
|
|
468
396
|
{
|
|
469
|
-
"path": "../tu-proyecto-frontal",
|
|
470
397
|
"domain": "tu-proyecto.test",
|
|
471
|
-
"type": "node",
|
|
472
398
|
"port": 3000
|
|
473
399
|
},
|
|
474
400
|
{
|
|
475
|
-
"path": "../tu-api-backend",
|
|
476
401
|
"domain": "api.tu-proyecto.test",
|
|
477
|
-
"type": "php",
|
|
478
402
|
"port": 3001,
|
|
479
403
|
"tunnel": "mi-super-api-dev"
|
|
480
404
|
}
|