mal-sh commited on
Commit
d17fed3
·
verified ·
1 Parent(s): 4c0cf88

Added store examples

Browse files
Files changed (1) hide show
  1. app.py +395 -0
app.py CHANGED
@@ -85,6 +85,401 @@ SYSTEM_PROMPT = """أنت مساعد متخصص في تحويل أوامر Docke
85
  }
86
  }
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  أرجع JSON صالح فقط بدون أي نص إضافي."""
89
 
90
  def analyze_docker_command(command: str) -> str:
 
85
  }
86
  }
87
 
88
+
89
+ Examples
90
+
91
+ {
92
+ "category": "automation",
93
+ "description": "n8n workflow automation",
94
+ "icon": "Zap",
95
+ "id": "n8n",
96
+ "name": "n8n",
97
+ "resources": [
98
+ {
99
+ "type": "volume",
100
+ "values": {
101
+ "name": "n8n-data",
102
+ "size": "{{volumeSize}}",
103
+ "userId": "{{userId}}"
104
+ }
105
+ },
106
+ {
107
+ "type": "app",
108
+ "values": {
109
+ "container": {
110
+ "image": "docker.n8n.io/n8nio/n8n"
111
+ },
112
+ "env": {
113
+ "EXECUTIONS_DATA_MAX_AGE": "336",
114
+ "EXECUTIONS_DATA_PRUNE": "true",
115
+ "N8N_EDITOR_BASE_URL": "https://{{resources[1].uniqueName}}.hosted.ghaymah.systems",
116
+ "N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS": false,
117
+ "N8N_HIRING_BANNER_ENABLED": false,
118
+ "N8N_HOST": "{{resources[1].uniqueName}}.hosted.ghaymah.systems",
119
+ "N8N_PORT": "5678",
120
+ "N8N_PROTOCOL": "https",
121
+ "N8N_PROXY_HOPS": 1,
122
+ "N8N_TEMPLATES_ENABLED": true,
123
+ "WEBHOOK_URL": "https://{{resources[1].uniqueName}}.hosted.ghaymah.systems"
124
+ },
125
+ "fsGroup": 1000,
126
+ "name": "n8n",
127
+ "ports": [
128
+ {
129
+ "expose": true,
130
+ "number": 5678
131
+ }
132
+ ],
133
+ "projectId": "{{projectId}}",
134
+ "publicAccess": {
135
+ "baseDomain": "hosted.ghaymah.systems",
136
+ "domain": "auto",
137
+ "enabled": true
138
+ },
139
+ "resourceTier": "{{resourceTier}}",
140
+ "storage": {
141
+ "volumes": [
142
+ {
143
+ "mountPath": "/home/node",
144
+ "name": "{{resources[0].uniqueName}}"
145
+ }
146
+ ]
147
+ }
148
+ }
149
+ }
150
+ ],
151
+ "variables": {
152
+ "resourceTier": {
153
+ "default": "t4",
154
+ "description": "Instance size",
155
+ "options": [
156
+ "t1",
157
+ "t2",
158
+ "t3",
159
+ "t4",
160
+ "t5",
161
+ "t6",
162
+ "t7"
163
+ ],
164
+ "type": "dropdown"
165
+ },
166
+ "volumeSize": {
167
+ "default": "1Gi",
168
+ "description": "Volume size",
169
+ "options": [
170
+ "512Mi",
171
+ "1Gi",
172
+ "2Gi",
173
+ "5Gi",
174
+ "10Gi"
175
+ ],
176
+ "type": "dropdown"
177
+ }
178
+ }
179
+ }
180
+
181
+
182
+ Example 2
183
+
184
+
185
+ {
186
+ "category": "development",
187
+ "description": "DocuSeal is an open-source document signing platform",
188
+ "icon": "Box",
189
+ "id": "docuseal",
190
+ "name": "DocuSeal",
191
+ "resources": [
192
+ {
193
+ "type": "volume",
194
+ "values": {
195
+ "name": "docuseal-data",
196
+ "size": "{{volumeSize}}",
197
+ "userId": "{{userId}}"
198
+ }
199
+ },
200
+ {
201
+ "type": "volume",
202
+ "values": {
203
+ "name": "postgres-data",
204
+ "size": "{{pgVolumeSize}}",
205
+ "userId": "{{userId}}"
206
+ }
207
+ },
208
+ {
209
+ "type": "app",
210
+ "values": {
211
+ "container": {
212
+ "image": "docuseal/docuseal:latest"
213
+ },
214
+ "env": {
215
+ "DATABASE_URL": "postgresql://postgres:postgres@{{resources[1].uniqueName}}:5432/docuseal",
216
+ "FORCE_SSL": "{{host}}"
217
+ },
218
+ "name": "docuseal",
219
+ "ports": [
220
+ {
221
+ "expose": true,
222
+ "number": 3000
223
+ }
224
+ ],
225
+ "projectId": "{{projectId}}",
226
+ "publicAccess": {
227
+ "baseDomain": "hosted.ghaymah.systems",
228
+ "domain": "auto",
229
+ "enabled": true
230
+ },
231
+ "resourceTier": "{{resourceTier}}",
232
+ "storage": {
233
+ "volumes": [
234
+ {
235
+ "mountPath": "/data/docuseal",
236
+ "name": "{{resources[0].uniqueName}}"
237
+ }
238
+ ]
239
+ }
240
+ }
241
+ },
242
+ {
243
+ "type": "app",
244
+ "values": {
245
+ "container": {
246
+ "image": "postgres:16"
247
+ },
248
+ "env": {
249
+ "PGDATA": "/var/lib/postgresql/data/pgdata",
250
+ "POSTGRES_DB": "docuseal",
251
+ "POSTGRES_PASSWORD": "postgres",
252
+ "POSTGRES_USER": "postgres"
253
+ },
254
+ "healthCheck": {
255
+ "command": [
256
+ "CMD-SHELL",
257
+ "pg_isready -U postgres"
258
+ ],
259
+ "interval": 5,
260
+ "retries": 5,
261
+ "timeout": 5
262
+ },
263
+ "name": "postgres",
264
+ "ports": [
265
+ {
266
+ "expose": false,
267
+ "number": 5432
268
+ }
269
+ ],
270
+ "projectId": "{{projectId}}",
271
+ "publicAccess": {
272
+ "enabled": false
273
+ },
274
+ "resourceTier": "{{resourceTier}}",
275
+ "storage": {
276
+ "volumes": [
277
+ {
278
+ "mountPath": "/var/lib/postgresql/data",
279
+ "name": "{{resources[1].uniqueName}}"
280
+ }
281
+ ]
282
+ }
283
+ }
284
+ }
285
+ ],
286
+ "variables": {
287
+ "host": {
288
+ "default": "",
289
+ "description": "Host domain for SSL (leave empty if not using SSL)",
290
+ "type": "text"
291
+ },
292
+ "pgVolumeSize": {
293
+ "default": "1Gi",
294
+ "description": "PostgreSQL data volume size",
295
+ "options": [
296
+ "512Mi",
297
+ "1Gi",
298
+ "2Gi",
299
+ "5Gi",
300
+ "10Gi"
301
+ ],
302
+ "type": "dropdown"
303
+ },
304
+ "resourceTier": {
305
+ "default": "t3",
306
+ "description": "Instance size",
307
+ "options": [
308
+ "t1",
309
+ "t2",
310
+ "t3",
311
+ "t4",
312
+ "t5",
313
+ "t6",
314
+ "t7"
315
+ ],
316
+ "type": "dropdown"
317
+ },
318
+ "volumeSize": {
319
+ "default": "2Gi",
320
+ "description": "DocuSeal data volume size",
321
+ "options": [
322
+ "512Mi",
323
+ "1Gi",
324
+ "2Gi",
325
+ "5Gi",
326
+ "10Gi"
327
+ ],
328
+ "type": "dropdown"
329
+ }
330
+ }
331
+ }
332
+
333
+
334
+ Example 3
335
+
336
+
337
+ {
338
+ "category": "database",
339
+ "description": "PostgreSQL database server with Hasura GraphQL Engine",
340
+ "icon": "Database",
341
+ "id": "postgres-hasura",
342
+ "name": "Hasura GraphQL",
343
+ "resources": [
344
+ {
345
+ "type": "volume",
346
+ "values": {
347
+ "name": "postgres-data",
348
+ "size": "{{volumeSize}}",
349
+ "userId": "{{userId}}"
350
+ }
351
+ },
352
+ {
353
+ "type": "app",
354
+ "values": {
355
+ "container": {
356
+ "image": "postgres:{{version}}"
357
+ },
358
+ "env": {
359
+ "PGDATA": "/var/lib/postgresql/data/pgdata",
360
+ "POSTGRES_DB": "graphql",
361
+ "POSTGRES_HOST_AUTH_METHOD": "scram-sha-256",
362
+ "POSTGRES_INITDB_ARGS": "--auth-host=scram-sha-256 --auth-local=scram-sha-256",
363
+ "POSTGRES_PASSWORD": "postgres",
364
+ "POSTGRES_USER": "postgres"
365
+ },
366
+ "fsGroup": 999,
367
+ "name": "postgres",
368
+ "ports": [
369
+ {
370
+ "expose": false,
371
+ "number": 5432
372
+ }
373
+ ],
374
+ "projectId": "{{projectId}}",
375
+ "publicAccess": {
376
+ "enabled": false
377
+ },
378
+ "resourceTier": "{{resourceTier}}",
379
+ "storage": {
380
+ "volumes": [
381
+ {
382
+ "mountPath": "/var/lib/postgresql/data",
383
+ "name": "{{resources[0].uniqueName}}"
384
+ }
385
+ ]
386
+ }
387
+ }
388
+ },
389
+ {
390
+ "type": "app",
391
+ "values": {
392
+ "container": {
393
+ "image": "hasura/graphql-engine:latest"
394
+ },
395
+ "env": {
396
+ "HASURA_GRAPHQL_ADMIN_SECRET": "{{adminSecret}}",
397
+ "HASURA_GRAPHQL_DATABASE_URL": "postgres://postgres:postgres@{{resources[1].uniqueName}}:5432/graphql",
398
+ "HASURA_GRAPHQL_DEV_MODE": "true",
399
+ "HASURA_GRAPHQL_ENABLED_LOG_TYPES": "startup, http-log, webhook-log, websocket-log, query-log",
400
+ "HASURA_GRAPHQL_ENABLE_CONSOLE": "true"
401
+ },
402
+ "name": "hasura",
403
+ "ports": [
404
+ {
405
+ "expose": true,
406
+ "number": 8080
407
+ }
408
+ ],
409
+ "projectId": "{{projectId}}",
410
+ "publicAccess": {
411
+ "baseDomain": "hosted.ghaymah.systems",
412
+ "domain": "auto",
413
+ "enabled": true
414
+ },
415
+ "resourceTier": "{{hasuraResourceTier}}"
416
+ }
417
+ }
418
+ ],
419
+ "variables": {
420
+ "adminSecret": {
421
+ "default": "test-secret",
422
+ "description": "Hasura admin secret",
423
+ "type": "password"
424
+ },
425
+ "hasuraResourceTier": {
426
+ "default": "t3",
427
+ "description": "Hasura instance size",
428
+ "options": [
429
+ "t1",
430
+ "t2",
431
+ "t3",
432
+ "t4",
433
+ "t5",
434
+ "t6",
435
+ "t7"
436
+ ],
437
+ "type": "dropdown"
438
+ },
439
+ "resourceTier": {
440
+ "default": "t3",
441
+ "description": "PostgreSQL instance size",
442
+ "options": [
443
+ "t1",
444
+ "t2",
445
+ "t3",
446
+ "t4",
447
+ "t5",
448
+ "t6",
449
+ "t7"
450
+ ],
451
+ "type": "dropdown"
452
+ },
453
+ "version": {
454
+ "default": "15",
455
+ "description": "PostgreSQL version (compatible with Hasura)",
456
+ "options": [
457
+ "12",
458
+ "13",
459
+ "14",
460
+ "15",
461
+ "16"
462
+ ],
463
+ "type": "dropdown"
464
+ },
465
+ "volumeSize": {
466
+ "default": "200Mi",
467
+ "description": "Volume size for database storage",
468
+ "options": [
469
+ "200Mi",
470
+ "500Mi",
471
+ "1Gi",
472
+ "2Gi",
473
+ "5Gi",
474
+ "10Gi"
475
+ ],
476
+ "type": "dropdown"
477
+ }
478
+ }
479
+ }
480
+
481
+
482
+
483
  أرجع JSON صالح فقط بدون أي نص إضافي."""
484
 
485
  def analyze_docker_command(command: str) -> str: