kubiy-paas-cli 0.1.8 → 0.1.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/.kubiyignore +73 -0
- package/docs/deploy-static.html +376 -0
- package/docs/kubiyignore.md +106 -0
- package/index.js +19 -3
- package/package.json +1 -1
- package/src/api.js +12 -6
- package/src/commands/deploy.js +449 -143
- package/src/commands/logs.js +71 -68
- package/src/commands/rollback.js +79 -0
- package/src/commands/service-link.js +126 -0
package/.kubiyignore
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Kubiy Deploy Ignore File
|
|
2
|
+
# Archivos y carpetas que se excluirán del deploy
|
|
3
|
+
# Formato: un patrón por línea (similar a .gitignore)
|
|
4
|
+
|
|
5
|
+
# Dependencias
|
|
6
|
+
node_modules/
|
|
7
|
+
vendor/
|
|
8
|
+
__pycache__/
|
|
9
|
+
*.pyc
|
|
10
|
+
*.pyo
|
|
11
|
+
*.pyd
|
|
12
|
+
.Python
|
|
13
|
+
|
|
14
|
+
# Build outputs
|
|
15
|
+
bin/
|
|
16
|
+
obj/
|
|
17
|
+
dist/
|
|
18
|
+
build/
|
|
19
|
+
out/
|
|
20
|
+
.next/
|
|
21
|
+
.nuxt/
|
|
22
|
+
.output/
|
|
23
|
+
|
|
24
|
+
# Archivos de entorno y configuración local
|
|
25
|
+
.env
|
|
26
|
+
.env.local
|
|
27
|
+
.env.*.local
|
|
28
|
+
*.log
|
|
29
|
+
|
|
30
|
+
# Sistema operativo
|
|
31
|
+
.DS_Store
|
|
32
|
+
Thumbs.db
|
|
33
|
+
desktop.ini
|
|
34
|
+
|
|
35
|
+
# IDEs y editores
|
|
36
|
+
.vscode/
|
|
37
|
+
.idea/
|
|
38
|
+
*.swp
|
|
39
|
+
*.swo
|
|
40
|
+
*~
|
|
41
|
+
.project
|
|
42
|
+
.classpath
|
|
43
|
+
.settings/
|
|
44
|
+
|
|
45
|
+
# Git
|
|
46
|
+
.git/
|
|
47
|
+
.gitignore
|
|
48
|
+
|
|
49
|
+
# Archivos temporales y comprimidos
|
|
50
|
+
*.tar
|
|
51
|
+
*.tar.gz
|
|
52
|
+
*.zip
|
|
53
|
+
*.rar
|
|
54
|
+
*.7z
|
|
55
|
+
|
|
56
|
+
# Archivos de test
|
|
57
|
+
coverage/
|
|
58
|
+
.nyc_output/
|
|
59
|
+
*.test.js
|
|
60
|
+
*.spec.js
|
|
61
|
+
__tests__/
|
|
62
|
+
test/
|
|
63
|
+
|
|
64
|
+
# Documentación
|
|
65
|
+
docs/
|
|
66
|
+
*.md
|
|
67
|
+
!README.md
|
|
68
|
+
|
|
69
|
+
# Archivos de configuración local
|
|
70
|
+
.kubiy.secrets.json
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="es">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Guía: Deploy de Sitios Estáticos con Kubiy</title>
|
|
7
|
+
<style>
|
|
8
|
+
* {
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
body {
|
|
15
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
16
|
+
line-height: 1.6;
|
|
17
|
+
color: #333;
|
|
18
|
+
background: #f5f5f5;
|
|
19
|
+
padding: 20px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.container {
|
|
23
|
+
max-width: 900px;
|
|
24
|
+
margin: 0 auto;
|
|
25
|
+
background: white;
|
|
26
|
+
padding: 40px;
|
|
27
|
+
border-radius: 8px;
|
|
28
|
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
h1 {
|
|
32
|
+
color: #2563eb;
|
|
33
|
+
margin-bottom: 10px;
|
|
34
|
+
font-size: 2.5em;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
h2 {
|
|
38
|
+
color: #1e40af;
|
|
39
|
+
margin-top: 40px;
|
|
40
|
+
margin-bottom: 20px;
|
|
41
|
+
padding-bottom: 10px;
|
|
42
|
+
border-bottom: 2px solid #e5e7eb;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
h3 {
|
|
46
|
+
color: #3b82f6;
|
|
47
|
+
margin-top: 30px;
|
|
48
|
+
margin-bottom: 15px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
p {
|
|
52
|
+
margin-bottom: 15px;
|
|
53
|
+
text-align: justify;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.intro {
|
|
57
|
+
background: #eff6ff;
|
|
58
|
+
padding: 20px;
|
|
59
|
+
border-radius: 6px;
|
|
60
|
+
border-left: 4px solid #2563eb;
|
|
61
|
+
margin-bottom: 30px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.requirements {
|
|
65
|
+
background: #f0fdf4;
|
|
66
|
+
padding: 20px;
|
|
67
|
+
border-radius: 6px;
|
|
68
|
+
border-left: 4px solid #22c55e;
|
|
69
|
+
margin: 20px 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.requirements ul {
|
|
73
|
+
margin-left: 20px;
|
|
74
|
+
margin-top: 10px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.requirements li {
|
|
78
|
+
margin-bottom: 8px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.steps {
|
|
82
|
+
background: #fef3c7;
|
|
83
|
+
padding: 20px;
|
|
84
|
+
border-radius: 6px;
|
|
85
|
+
border-left: 4px solid #f59e0b;
|
|
86
|
+
margin: 20px 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.step {
|
|
90
|
+
margin-bottom: 25px;
|
|
91
|
+
padding: 15px;
|
|
92
|
+
background: white;
|
|
93
|
+
border-radius: 4px;
|
|
94
|
+
border: 1px solid #e5e7eb;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.step-number {
|
|
98
|
+
display: inline-block;
|
|
99
|
+
background: #2563eb;
|
|
100
|
+
color: white;
|
|
101
|
+
width: 30px;
|
|
102
|
+
height: 30px;
|
|
103
|
+
border-radius: 50%;
|
|
104
|
+
text-align: center;
|
|
105
|
+
line-height: 30px;
|
|
106
|
+
font-weight: bold;
|
|
107
|
+
margin-right: 10px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
code {
|
|
111
|
+
background: #f3f4f6;
|
|
112
|
+
padding: 2px 6px;
|
|
113
|
+
border-radius: 3px;
|
|
114
|
+
font-family: 'Courier New', monospace;
|
|
115
|
+
font-size: 0.9em;
|
|
116
|
+
color: #dc2626;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
pre {
|
|
120
|
+
background: #1f2937;
|
|
121
|
+
color: #f9fafb;
|
|
122
|
+
padding: 15px;
|
|
123
|
+
border-radius: 6px;
|
|
124
|
+
overflow-x: auto;
|
|
125
|
+
margin: 15px 0;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
pre code {
|
|
129
|
+
background: none;
|
|
130
|
+
color: inherit;
|
|
131
|
+
padding: 0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.warning {
|
|
135
|
+
background: #fef2f2;
|
|
136
|
+
padding: 15px;
|
|
137
|
+
border-radius: 6px;
|
|
138
|
+
border-left: 4px solid #ef4444;
|
|
139
|
+
margin: 20px 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.success {
|
|
143
|
+
background: #f0fdf4;
|
|
144
|
+
padding: 15px;
|
|
145
|
+
border-radius: 6px;
|
|
146
|
+
border-left: 4px solid #22c55e;
|
|
147
|
+
margin: 20px 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.info {
|
|
151
|
+
background: #eff6ff;
|
|
152
|
+
padding: 15px;
|
|
153
|
+
border-radius: 6px;
|
|
154
|
+
border-left: 4px solid #3b82f6;
|
|
155
|
+
margin: 20px 0;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
ul, ol {
|
|
159
|
+
margin-left: 25px;
|
|
160
|
+
margin-bottom: 15px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
li {
|
|
164
|
+
margin-bottom: 8px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.example {
|
|
168
|
+
background: #f9fafb;
|
|
169
|
+
padding: 15px;
|
|
170
|
+
border-radius: 6px;
|
|
171
|
+
margin: 15px 0;
|
|
172
|
+
border: 1px solid #e5e7eb;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.troubleshooting {
|
|
176
|
+
background: #fef3c7;
|
|
177
|
+
padding: 20px;
|
|
178
|
+
border-radius: 6px;
|
|
179
|
+
margin: 20px 0;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.troubleshooting-item {
|
|
183
|
+
margin-bottom: 20px;
|
|
184
|
+
padding: 15px;
|
|
185
|
+
background: white;
|
|
186
|
+
border-radius: 4px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.troubleshooting-item strong {
|
|
190
|
+
color: #dc2626;
|
|
191
|
+
}
|
|
192
|
+
</style>
|
|
193
|
+
</head>
|
|
194
|
+
<body>
|
|
195
|
+
<div class="container">
|
|
196
|
+
<h1>🚀 Guía: Deploy de Sitios Estáticos con Kubiy</h1>
|
|
197
|
+
|
|
198
|
+
<div class="intro">
|
|
199
|
+
<p><strong>¿Qué es un deploy static?</strong></p>
|
|
200
|
+
<p>Un deploy static te permite subir tu sitio web estático (HTML, CSS, JavaScript) a Kubiy de forma rápida y sencilla. Perfecto para sitios creados con frameworks como React, Vue, Angular, Next.js, o cualquier generador de sitios estáticos.</p>
|
|
201
|
+
</div>
|
|
202
|
+
|
|
203
|
+
<h2>📋 Requisitos Previos</h2>
|
|
204
|
+
|
|
205
|
+
<div class="requirements">
|
|
206
|
+
<p><strong>Antes de comenzar, necesitas:</strong></p>
|
|
207
|
+
<ul>
|
|
208
|
+
<li>✅ Tener tu proyecto vinculado con Kubiy (<code>kubiy link</code>)</li>
|
|
209
|
+
<li>✅ Haber construido tu sitio estático (ejecutado <code>npm run build</code> o similar)</li>
|
|
210
|
+
<li>✅ Tener instalado el CLI de Kubiy</li>
|
|
211
|
+
<li>✅ Tener tu API Key configurada</li>
|
|
212
|
+
</ul>
|
|
213
|
+
</div>
|
|
214
|
+
|
|
215
|
+
<h2>🎯 ¿Qué Necesitas Hacer?</h2>
|
|
216
|
+
|
|
217
|
+
<div class="steps">
|
|
218
|
+
<h3>Paso 1: Construir tu Sitio</h3>
|
|
219
|
+
<div class="step">
|
|
220
|
+
<span class="step-number">1</span>
|
|
221
|
+
<p>Primero, necesitas generar los archivos estáticos de tu proyecto. Esto normalmente se hace con un comando de build:</p>
|
|
222
|
+
<div class="example">
|
|
223
|
+
<p><strong>Ejemplos según tu framework:</strong></p>
|
|
224
|
+
<ul>
|
|
225
|
+
<li><strong>React/Vite:</strong> <code>npm run build</code> → genera carpeta <code>dist/</code></li>
|
|
226
|
+
<li><strong>Next.js:</strong> <code>npm run build</code> → genera carpeta <code>.next/</code> o <code>out/</code></li>
|
|
227
|
+
<li><strong>Vue:</strong> <code>npm run build</code> → genera carpeta <code>dist/</code></li>
|
|
228
|
+
<li><strong>Angular:</strong> <code>ng build</code> → genera carpeta <code>dist/</code></li>
|
|
229
|
+
<li><strong>Nuxt:</strong> <code>npm run generate</code> → genera carpeta <code>.output/public/</code></li>
|
|
230
|
+
</ul>
|
|
231
|
+
</div>
|
|
232
|
+
<div class="warning">
|
|
233
|
+
<strong>⚠️ Importante:</strong> Asegúrate de que tu build haya generado un archivo <code>index.html</code> en la carpeta de salida. Sin este archivo, el deploy fallará.
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
|
|
237
|
+
<h3>Paso 2: Ejecutar el Deploy</h3>
|
|
238
|
+
<div class="step">
|
|
239
|
+
<span class="step-number">2</span>
|
|
240
|
+
<p>Una vez que tu sitio esté construido, ejecuta el comando de deploy:</p>
|
|
241
|
+
<pre><code>kubiy deploy --static</code></pre>
|
|
242
|
+
|
|
243
|
+
<div class="info">
|
|
244
|
+
<p><strong>💡 Kubiy detectará automáticamente tu carpeta de build</strong></p>
|
|
245
|
+
<p>El sistema buscará automáticamente en este orden:</p>
|
|
246
|
+
<ol>
|
|
247
|
+
<li><code>dist/</code></li>
|
|
248
|
+
<li><code>build/</code></li>
|
|
249
|
+
<li><code>out/</code></li>
|
|
250
|
+
<li><code>.output/public/</code></li>
|
|
251
|
+
</ol>
|
|
252
|
+
<p>Si encuentra alguna de estas carpetas, la usará automáticamente.</p>
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
|
|
256
|
+
<h3>Paso 3: Especificar una Carpeta Personalizada (Opcional)</h3>
|
|
257
|
+
<div class="step">
|
|
258
|
+
<span class="step-number">3</span>
|
|
259
|
+
<p>Si tu carpeta de build tiene un nombre diferente, puedes especificarla:</p>
|
|
260
|
+
<pre><code>kubiy deploy --static --dir=public</code></pre>
|
|
261
|
+
<p>O también:</p>
|
|
262
|
+
<pre><code>kubiy deploy --static --dir public</code></pre>
|
|
263
|
+
|
|
264
|
+
<div class="example">
|
|
265
|
+
<p><strong>Ejemplo:</strong> Si tu proyecto genera los archivos en una carpeta llamada <code>public/</code>:</p>
|
|
266
|
+
<pre><code>kubiy deploy --static --dir=public</code></pre>
|
|
267
|
+
</div>
|
|
268
|
+
</div>
|
|
269
|
+
</div>
|
|
270
|
+
|
|
271
|
+
<h2>⚙️ Configuración en .kubiy.json</h2>
|
|
272
|
+
|
|
273
|
+
<div class="info">
|
|
274
|
+
<p>Kubiy guardará automáticamente la carpeta detectada en tu archivo <code>.kubiy.json</code>:</p>
|
|
275
|
+
<pre><code>{
|
|
276
|
+
"appId": "tu-app-id",
|
|
277
|
+
"serviceId": "tu-service-id",
|
|
278
|
+
"static": {
|
|
279
|
+
"outDir": "dist"
|
|
280
|
+
}
|
|
281
|
+
}</code></pre>
|
|
282
|
+
<p>La próxima vez que ejecutes <code>kubiy deploy --static</code>, usará automáticamente esta carpeta sin necesidad de especificarla.</p>
|
|
283
|
+
</div>
|
|
284
|
+
|
|
285
|
+
<h2>📝 Ejemplo Completo</h2>
|
|
286
|
+
|
|
287
|
+
<div class="example">
|
|
288
|
+
<p><strong>Flujo completo para un proyecto React:</strong></p>
|
|
289
|
+
<pre><code># 1. Construir el proyecto
|
|
290
|
+
npm run build
|
|
291
|
+
|
|
292
|
+
# 2. Hacer el deploy
|
|
293
|
+
kubiy deploy --static
|
|
294
|
+
|
|
295
|
+
# ¡Listo! Tu sitio estará en línea</code></pre>
|
|
296
|
+
</div>
|
|
297
|
+
|
|
298
|
+
<div class="example">
|
|
299
|
+
<p><strong>Flujo completo para un proyecto Next.js con carpeta personalizada:</strong></p>
|
|
300
|
+
<pre><code># 1. Construir el proyecto
|
|
301
|
+
npm run build
|
|
302
|
+
|
|
303
|
+
# 2. Hacer el deploy especificando la carpeta
|
|
304
|
+
kubiy deploy --static --dir=.next
|
|
305
|
+
|
|
306
|
+
# ¡Listo! Tu sitio estará en línea</code></pre>
|
|
307
|
+
</div>
|
|
308
|
+
|
|
309
|
+
<h2>🔧 Solución de Problemas Comunes</h2>
|
|
310
|
+
|
|
311
|
+
<div class="troubleshooting">
|
|
312
|
+
<div class="troubleshooting-item">
|
|
313
|
+
<strong>❌ Error: "No static output folder found"</strong>
|
|
314
|
+
<p><strong>Solución:</strong> Asegúrate de haber ejecutado el comando de build de tu proyecto. Si tu carpeta tiene un nombre diferente, especifícala con <code>--dir</code>:</p>
|
|
315
|
+
<pre><code>kubiy deploy --static --dir=tu-carpeta</code></pre>
|
|
316
|
+
</div>
|
|
317
|
+
|
|
318
|
+
<div class="troubleshooting-item">
|
|
319
|
+
<strong>❌ Error: "index.html not found"</strong>
|
|
320
|
+
<p><strong>Solución:</strong> Tu carpeta de build debe contener un archivo <code>index.html</code>. Verifica que el build se haya completado correctamente y que el archivo exista en la carpeta de salida.</p>
|
|
321
|
+
</div>
|
|
322
|
+
|
|
323
|
+
<div class="troubleshooting-item">
|
|
324
|
+
<strong>❌ Error: "Output dir not found"</strong>
|
|
325
|
+
<p><strong>Solución:</strong> La carpeta que especificaste con <code>--dir</code> no existe. Verifica la ruta y asegúrate de que el build se haya ejecutado correctamente.</p>
|
|
326
|
+
</div>
|
|
327
|
+
|
|
328
|
+
<div class="troubleshooting-item">
|
|
329
|
+
<strong>❌ Error: "El proyecto está configurado como 'static'"</strong>
|
|
330
|
+
<p><strong>Solución:</strong> Si tu proyecto está configurado como static en <code>.kubiy.json</code>, siempre debes usar <code>--static</code>. Si quieres hacer un deploy normal, primero cambia el <code>deployType</code> en tu configuración.</p>
|
|
331
|
+
</div>
|
|
332
|
+
</div>
|
|
333
|
+
|
|
334
|
+
<h2>✅ Verificación del Deploy</h2>
|
|
335
|
+
|
|
336
|
+
<div class="success">
|
|
337
|
+
<p>Después de ejecutar <code>kubiy deploy --static</code>, verás mensajes como:</p>
|
|
338
|
+
<pre><code>✓ Usando directorio static: /ruta/a/dist
|
|
339
|
+
✓ Artefacto static generado en temp
|
|
340
|
+
✓ Presign OK. deployId=xxx releaseId=yyy
|
|
341
|
+
✓ Artefacto subido correctamente a S3
|
|
342
|
+
✓ Marker subido correctamente
|
|
343
|
+
🚀 Deploy iniciado correctamente en Kubiy</code></pre>
|
|
344
|
+
<p>Si ves estos mensajes, ¡tu deploy se está procesando correctamente!</p>
|
|
345
|
+
</div>
|
|
346
|
+
|
|
347
|
+
<h2>💡 Consejos Útiles</h2>
|
|
348
|
+
|
|
349
|
+
<div class="info">
|
|
350
|
+
<ul>
|
|
351
|
+
<li><strong>Automatiza tus deploys:</strong> Puedes agregar el comando a tu script de CI/CD para que se despliegue automáticamente después de cada build.</li>
|
|
352
|
+
<li><strong>Verifica antes de deployar:</strong> Siempre prueba tu sitio localmente después del build antes de hacer el deploy.</li>
|
|
353
|
+
<li><strong>Revisa los logs:</strong> Si algo sale mal, puedes revisar los logs con <code>kubiy logs <serviceId></code></li>
|
|
354
|
+
<li><strong>Configuración persistente:</strong> Una vez que Kubiy detecta tu carpeta, la guarda en <code>.kubiy.json</code>, así que no necesitarás especificarla cada vez.</li>
|
|
355
|
+
</ul>
|
|
356
|
+
</div>
|
|
357
|
+
|
|
358
|
+
<h2>📚 Comandos Relacionados</h2>
|
|
359
|
+
|
|
360
|
+
<div class="example">
|
|
361
|
+
<ul>
|
|
362
|
+
<li><code>kubiy link <appId></code> - Vincular tu proyecto con Kubiy</li>
|
|
363
|
+
<li><code>kubiy deploy --static</code> - Deploy de sitio estático</li>
|
|
364
|
+
<li><code>kubiy deploy --static --dir=<carpeta></code> - Deploy especificando carpeta</li>
|
|
365
|
+
<li><code>kubiy logs <serviceId></code> - Ver logs del servicio</li>
|
|
366
|
+
<li><code>kubiy service:get <serviceId></code> - Ver información del servicio</li>
|
|
367
|
+
</ul>
|
|
368
|
+
</div>
|
|
369
|
+
|
|
370
|
+
<div style="margin-top: 40px; padding-top: 20px; border-top: 2px solid #e5e7eb; text-align: center; color: #6b7280;">
|
|
371
|
+
<p>© 2024 Kubiy - Documentación de Deploy Static</p>
|
|
372
|
+
</div>
|
|
373
|
+
</div>
|
|
374
|
+
</body>
|
|
375
|
+
</html>
|
|
376
|
+
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Archivo .kubiyignore
|
|
2
|
+
|
|
3
|
+
El archivo `.kubiyignore` te permite especificar qué archivos y carpetas deben ser excluidos cuando haces un deploy con `kubiy deploy`.
|
|
4
|
+
|
|
5
|
+
## Ubicación
|
|
6
|
+
|
|
7
|
+
Crea el archivo `.kubiyignore` en la raíz de tu proyecto, junto a tu `package.json` o `.kubiy.json`.
|
|
8
|
+
|
|
9
|
+
## Formato
|
|
10
|
+
|
|
11
|
+
El formato es similar a `.gitignore`: un patrón por línea. Puedes usar comentarios con `#`.
|
|
12
|
+
|
|
13
|
+
## Ejemplos
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
# Dependencias
|
|
17
|
+
node_modules/
|
|
18
|
+
vendor/
|
|
19
|
+
|
|
20
|
+
# Build outputs
|
|
21
|
+
bin/
|
|
22
|
+
obj/
|
|
23
|
+
dist/
|
|
24
|
+
|
|
25
|
+
# Archivos de entorno
|
|
26
|
+
.env
|
|
27
|
+
*.log
|
|
28
|
+
|
|
29
|
+
# Python
|
|
30
|
+
__pycache__/
|
|
31
|
+
*.pyc
|
|
32
|
+
|
|
33
|
+
# .NET
|
|
34
|
+
bin/
|
|
35
|
+
obj/
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Exclusiones por Defecto
|
|
39
|
+
|
|
40
|
+
Si no creas un archivo `.kubiyignore`, Kubiy usará estas exclusiones por defecto:
|
|
41
|
+
|
|
42
|
+
- `node_modules/`
|
|
43
|
+
- `.git/`
|
|
44
|
+
- `.env`
|
|
45
|
+
- `.DS_Store`
|
|
46
|
+
- `*.tar`
|
|
47
|
+
- `*.tar.gz`
|
|
48
|
+
- `bin/`
|
|
49
|
+
- `obj/`
|
|
50
|
+
- `__pycache__/`
|
|
51
|
+
- `*.pyc`
|
|
52
|
+
- `vendor/`
|
|
53
|
+
|
|
54
|
+
## Patrones Soportados
|
|
55
|
+
|
|
56
|
+
- **Carpetas**: `node_modules/` o `node_modules` (ambos funcionan)
|
|
57
|
+
- **Archivos**: `.env`, `*.log`
|
|
58
|
+
- **Wildcards**: `*.pyc`, `*.log`
|
|
59
|
+
- **Comentarios**: Líneas que empiezan con `#`
|
|
60
|
+
|
|
61
|
+
## Ejemplos por Lenguaje
|
|
62
|
+
|
|
63
|
+
### Node.js
|
|
64
|
+
```
|
|
65
|
+
node_modules/
|
|
66
|
+
npm-debug.log
|
|
67
|
+
.env
|
|
68
|
+
.DS_Store
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Python
|
|
72
|
+
```
|
|
73
|
+
__pycache__/
|
|
74
|
+
*.pyc
|
|
75
|
+
*.pyo
|
|
76
|
+
venv/
|
|
77
|
+
env/
|
|
78
|
+
.venv
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### .NET
|
|
82
|
+
```
|
|
83
|
+
bin/
|
|
84
|
+
obj/
|
|
85
|
+
*.user
|
|
86
|
+
*.suo
|
|
87
|
+
.vs/
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Java
|
|
91
|
+
```
|
|
92
|
+
target/
|
|
93
|
+
.classpath
|
|
94
|
+
.project
|
|
95
|
+
.settings/
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Notas
|
|
99
|
+
|
|
100
|
+
- Los patrones se combinan con las exclusiones por defecto
|
|
101
|
+
- Si especificas un patrón en `.kubiyignore`, se agregará a las exclusiones por defecto
|
|
102
|
+
- Los comentarios (líneas que empiezan con `#`) se ignoran
|
|
103
|
+
- Las líneas vacías se ignoran
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
package/index.js
CHANGED
|
@@ -21,12 +21,18 @@ async function main() {
|
|
|
21
21
|
case "git:connect":
|
|
22
22
|
await require("./src/commands/git-connect").run(args.slice(1));
|
|
23
23
|
break;
|
|
24
|
+
case "link":
|
|
25
|
+
await require("./src/commands/service-link").run(args.slice(1));
|
|
26
|
+
break;
|
|
24
27
|
case "deploy":
|
|
25
|
-
await require("./src/commands/deploy").run();
|
|
28
|
+
await require("./src/commands/deploy").run(args.slice(1));
|
|
26
29
|
break;
|
|
27
30
|
case "logs":
|
|
28
31
|
await require("./src/commands/logs").run(args.slice(1));
|
|
29
32
|
break;
|
|
33
|
+
case "rollback":
|
|
34
|
+
await require("./src/commands/rollback").run(args.slice(1));
|
|
35
|
+
break;
|
|
30
36
|
case "version":
|
|
31
37
|
case "--version":
|
|
32
38
|
case "-v":
|
|
@@ -48,12 +54,22 @@ function printHelp() {
|
|
|
48
54
|
console.log("Uso:");
|
|
49
55
|
console.log(" kubiy login <cliToken>");
|
|
50
56
|
console.log(" kubiy whoami");
|
|
57
|
+
console.log(" kubiy link <appId> [--env=prod|stg|dev] [--apikey=...] [--save-secrets]");
|
|
58
|
+
console.log(" kubiy deploy --message \"<texto>\" [--static] [--dir=<carpeta>]");
|
|
51
59
|
console.log(" kubiy service:get <serviceId>");
|
|
52
60
|
console.log(" kubiy git:connect <serviceId>");
|
|
53
|
-
console.log(" kubiy deploy");
|
|
54
|
-
console.log(" kubiy
|
|
61
|
+
console.log(" kubiy logs [<serviceId>] [--kind=deploy|app] [--lines=200]");
|
|
62
|
+
console.log(" kubiy rollback <deployId>");
|
|
63
|
+
console.log(" kubiy rollback <appId> <serviceId> <deployId>");
|
|
55
64
|
console.log(" kubiy version");
|
|
56
65
|
console.log("");
|
|
66
|
+
console.log("Ejemplos:");
|
|
67
|
+
console.log(" kubiy link my-app-id --apikey=xxx");
|
|
68
|
+
console.log(" kubiy deploy --message \"Release v1.0\"");
|
|
69
|
+
console.log(" kubiy deploy -m \"Fix login\" --static");
|
|
70
|
+
console.log(" kubiy deploy --message=\"Deploy prod\" --static --dir=dist");
|
|
71
|
+
console.log(" kubiy logs --kind=deploy --lines=100");
|
|
72
|
+
console.log("");
|
|
57
73
|
}
|
|
58
74
|
|
|
59
75
|
main();
|
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
const https = require("https");
|
|
2
2
|
const { getCliToken } = require("./config");
|
|
3
|
-
const { logError } = require("./logger");
|
|
3
|
+
const { logError, logInfo } = require("./logger");
|
|
4
4
|
|
|
5
|
-
//
|
|
6
|
-
const API_BASE = process.env.KUBIY_API_BASE || "https://
|
|
5
|
+
// URL base de la API de Kubiy
|
|
6
|
+
const API_BASE = process.env.KUBIY_API_BASE || "https://cli.kubiy.cloud/v1";
|
|
7
7
|
|
|
8
8
|
function request(method, path, body, opts = {}) {
|
|
9
9
|
return new Promise((resolve, reject) => {
|
|
10
10
|
const token = opts.token || getCliToken();
|
|
11
|
-
const url = new URL(path, API_BASE);
|
|
11
|
+
const url = API_BASE + path; //new URL(path, API_BASE);
|
|
12
12
|
|
|
13
13
|
const headers = {
|
|
14
14
|
"Accept": "application/json"
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
// Combinar headers personalizados de opts.headers
|
|
18
|
+
if (opts.headers) {
|
|
19
|
+
Object.assign(headers, opts.headers);
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
let payload = null;
|
|
18
23
|
if (body) {
|
|
19
24
|
payload = JSON.stringify(body);
|
|
@@ -21,7 +26,8 @@ function request(method, path, body, opts = {}) {
|
|
|
21
26
|
headers["Content-Length"] = Buffer.byteLength(payload);
|
|
22
27
|
}
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
// Si se usa X-Kubiy-Token no añadimos Authorization
|
|
30
|
+
if (token && !opts.headers?.["X-Kubiy-Token"]) {
|
|
25
31
|
headers["Authorization"] = `Bearer ${token}`;
|
|
26
32
|
}
|
|
27
33
|
|
|
@@ -29,7 +35,7 @@ function request(method, path, body, opts = {}) {
|
|
|
29
35
|
method,
|
|
30
36
|
headers
|
|
31
37
|
};
|
|
32
|
-
|
|
38
|
+
|
|
33
39
|
const req = https.request(url, options, (res) => {
|
|
34
40
|
let data = "";
|
|
35
41
|
|