-
Notifications
You must be signed in to change notification settings - Fork 5
/
devspace.yaml
679 lines (622 loc) · 19.4 KB
/
devspace.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
version: v2beta1
name: dinsro
vars:
BASE_HOST:
default: localtest.me
BASE_PUBLIC_DOMAIN:
default: localtest.me
REPO:
default: duck1123
PROJECT:
default: dinsro
DEVCARDS_PROJECT:
default: devcards
DEVIMAGE_PROJECT:
default: devimage
DINSRO_LOG_LEVEL:
default: debug
DINSRO_QUERY_LOG_LEVEL:
default: debug
NOSTREAM_PROJECT:
default: nostream
POSTGRESQL_ROOT_PASSWORD:
default: "bbyKm52sL6"
REGISTRY:
question: Where is the registry used by you local cluster
default: "k3d-myregistry.${BASE_HOST}:12345"
USE_PERSISTENCE:
default: false
USE_NODES:
default: true
pipelines:
build-cert-downloader: |-
set -ex
REGISTRY=k3d-myregistry.localtest.me:12345
REPO=duck1123
PROJECT=cert-downloader
TAG=dev
IMAGE=${REPO?}/${PROJECT?}
earthly +cert-downloader --tag ${TAG}
docker image tag ${IMAGE?}:${TAG?} ${REGISTRY}/${IMAGE?}:${TAG?}
docker push ${REGISTRY}/${IMAGE}:${TAG}
docker image rm ${IMAGE}:${TAG}
docker image rm ${REGISTRY}/${IMAGE}:${TAG}
build-devimage: |-
build_images devimage
create-chart-directories: |-
mkdir -p target/charts
create-namespace: |-
NAME=dinsro
kubectl create namespace ${NAME} || true
deploy: |-
run_dependencies --all
run_pipelines deploy-dinsro
deploy-all: |-
run_dependencies --all
run_pipelines deploy-all-bitcoin
run_pipelines deploy-dinsro
deploy-all-bitcoin: |-
NAME=alice run_pipelines deploy-bitcoin
NAME=bob run_pipelines deploy-bitcoin
deploy-bitcoin: |-
echo ""
echo "=== Deploying Bitcoin Stack: ${NAME?Name not set} ==="
run_pipelines deploy-bitcoind
run_pipelines deploy-lnd
run_pipelines deploy-fileserver
run_pipelines deploy-rtl
deploy-bitcoind: |-
echo ""
echo "--- Deployng Bitcoind for ${NAME?Name not set} ---"
echo ""
run_pipelines create-namespace
run_pipelines create-chart-directories
YAML_PATH=target/charts/${NAME}_bitcoind.yaml
bb helm-bitcoin ${NAME} > ${YAML_PATH}
kubectl apply -f ${YAML_PATH}
deploy-database: |-
run_pipelines deploy-postgresql
deploy-dinsro: |-
echo ""
echo "--- Deploying Dinsro ---"
echo ""
bb generate-dinsro-values
build_images dinsro
create_deployments dinsro
deploy-fileserver: |-
echo ""
echo "--- Deploying Fileserver for ${NAME?Name not set} ---"
echo ""
run_pipelines create-namespace
run_pipelines create-chart-directories
YAML_PATH=target/charts/${NAME}_fileserver.yaml
bb helm-fileserver ${NAME} > ${YAML_PATH}
kubectl apply -f ${YAML_PATH}
deploy-lnd: |-
echo ""
echo "--- Deploying LND for ${NAME?Name not set} ---"
echo ""
run_pipelines create-namespace
run_pipelines create-chart-directories
YAML_PATH=target/charts/${NAME}_lnd.yaml
bb helm-lnd ${NAME} > ${YAML_PATH}
kubectl apply -f ${YAML_PATH}
deploy-nostr-rs-relay: |-
echo ""
echo "--- Deploying nostr-rs-relay ---"
echo ""
run_pipelines create-chart-directories
YAML_PATH=target/charts/nostr-rs-relay.yaml
bb helm-nostr-rs-relay ${NAME} > ${YAML_PATH}
kubectl apply -f ${YAML_PATH}
deploy-nostream: |-
echo ""
echo "--- Deploying Nostream ---"
echo ""
build_images nostream
run_pipelines deploy-redis
create_deployments nostream
deploy-postgresql: |-
echo ""
echo "--- Deploying Postgresql ---"
echo ""
create_deployments postgresql
deploy-sqlpad: |-
echo ""
echo "--- Deploying SQLpad ---"
echo ""
create_deployments sqlpad
deploy-redis: |-
echo ""
echo "--- Deploying Redis ---"
echo ""
create_deployments redis
deploy-rtl: |-
echo ""
echo "--- Deploying RTL for ${NAME?Name not set} ---"
echo ""
run_pipelines create-namespace
run_pipelines create-chart-directories
run_pipelines build-cert-downloader
YAML_PATH=target/charts/${NAME}_rtl.yaml
RTL_VERSION=dev bb generate-rtl-values ${NAME}
bb helm-rtl ${NAME} > ${YAML_PATH}
kubectl apply -f ${YAML_PATH}
dev: |-
echo "Starting dev"
bb generate-dinsro-values
run_dependencies --all
create_deployments dinsro
start_dev app
dev-all: |-
run_pipelines deploy-all-bitcoin
run_pipelines dev
purge: |-
echo "-- Purging Dinsro --"
purge_deployments dinsro
purge-all: |-
run_pipelines purge
run_pipelines purge-devimage
run_pipelines purge-all-bitcoin
purge-all-bitcoin: |-
NAME=alice run_pipelines purge-bitcoin
NAME=bob run_pipelines purge-bitcoin
purge-all-data: |-
run_pipelines purge-all
run_pipelines purge-data
purge-all-relays: |-
run_pipelines purge-nostream purge-nostr-rs-relay
run_pipelines purge-redis
purge-bitcoin: |-
echo ""
echo "=== Purging Bitcoin stack for ${NAME?name not set} ==="
run_pipelines purge-fileserver
run_pipelines purge-rtl
run_pipelines purge-lnd
run_pipelines purge-bitcoind
purge-bitcoind: |-
echo ""
echo "--- Purging Bitcoind for ${NAME?Name not set} ---"
echo ""
YAML_PATH=target/charts/${NAME?}_bitcoind.yaml
kubectl delete -f ${YAML_PATH} || true
purge-data: |-
echo "Purging Data:"
run_pipelines purge-redis-data
purge-database: |-
echo ""
echo "=== Purging Database ==="
run_pipelines purge-postgresql
purge-devimage: |-
echo "=== Purging Devimage ==="
kubectl delete deployments dinsro-devspace || true
purge-dinsro: |-
echo ""
echo "Purge Dinsro"
purge_deployments dinsro
purge-fileserver: |-
echo ""
echo "--- Purging fileserver for ${NAME?Name not set} ---"
echo ""
YAML_PATH=target/charts/${NAME?}_fileserver.yaml
kubectl delete -f ${YAML_PATH} || true
purge-lnd: |-
echo ""
echo "--- Purging LND for ${NAME?} ---"
echo ""
YAML_PATH=target/charts/${NAME}_lnd.yaml
kubectl delete -f ${YAML_PATH} || true
purge-nostr-rs-relay: |-
echo ""
echo "--- Purging nostr-rs-relay ---"
echo ""
YAML_PATH=target/charts/nostr-rs-relay.yaml
kubectl delete -f ${YAML_PATH} || true
purge-nostream: |-
echo ""
echo "--- Purging Nostream ---"
echo ""
purge_deployments nostream
purge-postgresql: |-
purge_deployments postgresql
purge-postgresql-all: |-
run_pipelines purge-postgresql
run_pipelines purge-postgresql-data
purge-postgresql-data: |-
kubectl delete persistentvolumeclaims data-postgresql-0 || echo "claim does not exist"
purge-redis: |-
echo ""
echo "Purge Redis"
purge_deployments redis
purge-redis-all: |-
run_pipelines purge-redis
run_pipelines purge-redis-data
purge-redis-data: |-
kubectl delete persistentvolumeclaims redis-data-redis-master-0 || echo "claim does not exist"
kubectl delete persistentvolumeclaims redis-data-redis-replicas-0 || echo "claim does not exist"
kubectl delete persistentvolumeclaims redis-data-redis-replicas-1 || echo "claim does not exist"
kubectl delete persistentvolumeclaims redis-data-redis-replicas-2 || echo "claim does not exist"
purge-relays: |-
run_pipelines purge-nostream purge-nostr-rs-relay
purge-rtl: |-
echo ""
echo "--- Purging RTL for ${NAME} ---"
echo ""
YAML_PATH=target/charts/${NAME}_rtl.yaml
kubectl delete -f ${YAML_PATH} || true
purge-sqlpad: |-
purge_deployments sqlpad
images:
devcards:
image: ${REPO}/dinsro-devcards:devcards-latest
custom:
command: |-
set -ex
export TAG=${runtime.images.devcards.tag}
export IMAGE=${REPO}/${DEVCARDS_PROJECT}
echo "Building devcards"
earthly +devcards-image --repo ${REPO} --project ${DEVCARDS_PROJECT} --tag ${TAG}
docker tag ${IMAGE}:${TAG} ${REGISTRY}/${IMAGE}:${TAG}
docker push ${REGISTRY}/${IMAGE}:${TAG}
docker image rm ${IMAGE}:${TAG}
docker image rm ${REGISTRY}/${IMAGE}:${TAG}
dinsro:
image: ${REGISTRY}/${REPO}/${PROJECT}
custom:
command: |-
set -ex
export TAG=${runtime.images.dinsro.tag}
export IMAGE=${REPO}/${PROJECT}
earthly +image --repo ${REPO} --project ${PROJECT} --tag ${TAG}
docker tag ${IMAGE}:${TAG} ${REGISTRY}/${IMAGE}:${TAG}
docker push ${REGISTRY}/${IMAGE}:${TAG}
docker image rm ${IMAGE}:${TAG}
docker image rm ${REGISTRY}/${IMAGE}:${TAG}
nostream:
image: ${REGISTRY}/${REPO}/${NOSTREAM_PROJECT}
custom:
command: |-
set -ex
export TAG=${runtime.images.nostream.tag}
export IMAGE=${REPO}/${NOSTREAM_PROJECT}
earthly +nostream-image --repo ${REPO} --project ${NOSTREAM_PROJECT} --tag ${TAG}
docker tag ${IMAGE}:${TAG} ${REGISTRY}/${IMAGE}:${TAG}
docker push ${REGISTRY}/${IMAGE}:${TAG}
docker image rm ${IMAGE}:${TAG}
docker image rm ${REGISTRY}/${IMAGE}:${TAG}
sources:
image: ${REGISTRY}/${REPO}/${PROJECT}-sources
custom:
command: |-
set -ex
export TAG=${runtime.images.sources.tag}
export IMAGE=${REPO}/${PROJECT}-sources
earthly +dev-sources-image --REPO ${REPO} --PROJECT ${PROJECT}-sources --TAG ${TAG}
docker tag ${IMAGE}:${TAG} ${REGISTRY}/${IMAGE}:${TAG}
docker push ${REGISTRY}/${IMAGE}:${TAG}
docker image rm ${IMAGE}:${TAG}
docker image rm ${REGISTRY}/${IMAGE}:${TAG}
# devimage:
# image: ${REPO}/${DEVIMAGE_PROJECT}
# custom:
# command: |-
# set -ex
# echo "building devimage"
# export TAG=${runtime.images.devimage.tag}
# export IMAGE=${REPO}/${DEVIMAGE_PROJECT}
# earthly +devspace-base --repo ${REPO} --project ${DEVIMAGE_PROJECT} --tag ${TAG}
# docker tag ${IMAGE}:${TAG} ${REGISTRY}/${IMAGE}:${TAG}
# docker push ${REGISTRY}/${IMAGE}:${TAG}
# docker image rm ${IMAGE}:${TAG}
# docker image rm ${REGISTRY}/${IMAGE}:${TAG}
# This is a list of `deployments` that DevSpace can create for this project
deployments:
dinsro:
helm:
chart:
name: dinsro
repo: https://chart.kronkltd.net/
version: 0.1.7
# name: ./resources/helm/dinsro/
valuesFiles:
- "target/dinsro_values.yaml"
values:
logLevel: ":${DINSRO_LOG_LEVEL}"
queryLogLevel: ":${DINSRO_QUERY_LOG_LEVEL}"
notebooks:
# enabled: true
service:
port: 7777
ingress:
hosts:
- host: notebooks.${BASE_PUBLIC_DOMAIN}
paths:
- path: /
tls:
- hosts:
- notebooks.${BASE_PUBLIC_DOMAIN}
secretName: dinsro-notebooks-tls
devcards:
enabled: false
ingress:
enabled: true
hosts:
- host: cards.${BASE_PUBLIC_DOMAIN}
paths:
- path: /
service: dinsro
tls:
- hosts:
- cards.${BASE_PUBLIC_DOMAIN}
secretName: cards-tls
devtools:
enabled: false
ingress:
enabled: false
hosts:
- host: devtools.cards.${BASE_PUBLIC_DOMAIN}
devtools:
enabled: true
webtoolsUrl: devtools.${BASE_PUBLIC_DOMAIN}
ingress:
enabled: true
hosts:
- host: devtools.${BASE_PUBLIC_DOMAIN}
service: dinsro
paths:
- path: /
tls:
- hosts:
- devtools.${BASE_PUBLIC_DOMAIN}
secretName: devtools-tls
workspaces:
ingress:
enabled: true
hosts:
- host: workspace.${BASE_PUBLIC_DOMAIN}
paths:
- path: /
service: dinsro
tls:
- hosts:
- workspace.${BASE_PUBLIC_DOMAIN}
paths:
- path: /
secretName: workspace-tls
image:
repository: ${runtime.images.dinsro.image}
tag: ${runtime.images.dinsro.tag}
persistence:
enabled: ${USE_PERSISTENCE}
ingress:
hosts:
- host: ${BASE_PUBLIC_DOMAIN}
paths:
- path: /
tls:
- hosts:
- ${BASE_PUBLIC_DOMAIN}
paths:
- path: /
secretName: dinsro-tls
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
ingress.kubernetes.io/force-ssl-redirect: "true"
traefik.ingress.kubernetes.io/router.middlewares: "dinsro-redirect@kubernetescrd"
nostr-rs-relay:
helm:
chart:
name: ./resources/helm/nostr-rs-relay
nostream:
helm:
chart:
name: ./resources/helm/nostream
values:
relay:
url: wss://nostream.${BASE_PUBLIC_DOMAIN}
name: nostream.${BASE_PUBLIC_DOMAIN}
description: A nostr relay written in Typescript.
pubkey: 6fe701bde348f57e1068101830ad2015f32d3d51d0d685ff0f2812ee8635efec
contact: duck@kronkltd.net
image:
repository: ${runtime.images.nostream.image}
tag: ${runtime.images.nostream.tag}
db:
host: postgresql
password: "bbyKm52sL6"
passwordSecret: "postgresql"
name: nostream
persistence:
seed: false
ingress:
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
debug: true
hosts:
- host: nostream.${BASE_PUBLIC_DOMAIN}
paths:
- path: /
tls:
- hosts:
- nostream.${BASE_PUBLIC_DOMAIN}
secretName: nostream-tls
postgresql:
helm:
chart:
name: postgresql
repo: https://charts.bitnami.com/bitnami
version: 12.1.6
values:
global:
postgresql:
auth:
database: nostream
postgresPassword: ${POSTGRESQL_ROOT_PASSWORD}
redis:
helm:
chart:
name: redis
repo: https://charts.bitnami.com/bitnami
version: 17.7.1
sqlpad:
helm:
chart:
# name: ../chart.kronkltd.net/stable/sqlpad
name: sqlpad
repo: https://chart.kronkltd.net/
version: 0.1.0
values:
environment:
- name: SQLPAD_CONNECTIONS__nostream__name
value: nostream
- name: SQLPAD_CONNECTIONS__nostream__driver
value: postgres
- name: SQLPAD_CONNECTIONS__nostream__host
value: postgresql
- name: SQLPAD_CONNECTIONS__nostream__port
value: "5432"
- name: SQLPAD_CONNECTIONS__nostream__username
value: postgres
- name: SQLPAD_CONNECTIONS__nostream__password
value: ${POSTGRESQL_ROOT_PASSWORD}
- name: SQLPAD_CONNECTIONS__nostream__database
value: nostream
- name: SQLPAD_CONNECTIONS__dinsro__name
value: "dinsro"
- name: SQLPAD_CONNECTIONS__dinsro__driver
value: "postgres"
- name: SQLPAD_CONNECTIONS__dinsro__host
value: "db.dinsro"
- name: SQLPAD_CONNECTIONS__dinsro__port
value: "5432"
- name: SQLPAD_CONNECTIONS__dinsro__username
value: "postgresql"
- name: SQLPAD_CONNECTIONS__dinsro__password
value: "mysecretpassword"
- name: SQLPAD_CONNECTIONS__dinsro__database
value: "dinsro"
- name: SQLPAD_DEFAULT_CONNECTION_ID
value: nostream
# This is a list of `dev` containers that are based on the containers created by your deployments
dev:
app:
imageSelector: ${REGISTRY}/${REPO}/${PROJECT}
# devImage: ${REGISTRY}/${REPO}/${DEVIMAGE_PROJECT}:${runtime.images.devimage.tag}
# devImage: ${REGISTRY}/${REPO}/${DEVIMAGE_PROJECT}
devImage: ${REPO}/${DEVIMAGE_PROJECT}:latest
# labelSelector:
# app.kubernetes.io/name: dinsro
# app.kubernetes.io/instance: dinsro
sync:
- path: ./
excludePaths:
- node_modules/
terminal:
command: ./devspace_start.sh
ssh:
enabled: true
proxyCommands:
- command: devspace
- command: earthly
- command: kubectl
- command: helm
# - command: git
ports:
# Dinsro Main interface
- port: "3000"
- port: "3691"
- port: "3692"
# Workspaces
- port: "3693"
- port: "7000"
- port: "7777"
# CLJ nRepl
- port: "7778"
- port: "8000"
# Shadow Dashboard
- port: "9630"
# Tilt
- port: "10350"
- port: "1818"
open:
- url: http://localhost:10350
# Use the `commands` section to define repeatable dev workflows for this project
commands:
alice-deploy:
command: NAME=alice devspace run-pipeline deploy-bitcoin || true
alice-purge:
command: NAME=alice devspace run-pipeline purge-bitcoin || true
bitcoin-deploy:
command: devspace run-pipeline deploy-all-bitcoin || true
bitcoin-purge:
command: devspace run-pipeline purge-all-bitcoin
bob-deploy:
command: NAME=bob devspace run-pipeline deploy-bitcoin || true
bob-purge:
command: NAME=bob devspace run-pipeline purge-bitcoin || true
devimage-build:
command: earthly --push +devspace-base
database-purge:
command: devspace run-pipeline purge-database || true
deploy:
command: devspace run-pipeline deploy || true
deploy-all:
command: devspace run-pipeline deploy-all || true
deploy-database:
command: devspace run-pipeline deploy-database
dev:
command: devspace enter -- bash -c 'byobu'
dev-all:
command: devspace run-pipeline dev-all
devimage-purge:
command: devspace run-pipeline purge-devimage || true
dinsro-deploy:
command: devspace run-pipeline deploy-dinsro
dinsro-purge:
command: devspace run-pipeline purge-dinsro
test:
command: bb test
lint:
command: bb lint
nostream-deploy:
command: devspace run-pipeline deploy-nostream
nostream-purge:
command: devspace run-pipeline purge-nostream || true
nostr-rs-relay-deploy:
command: devspace run-pipeline deploy-nostr-rs-relay
nostr-rs-relay-purge:
command: devspace run-pipeline purge-nostr-rs-relay || true
postgresql-deploy:
command: devspace run-pipeline deploy-postgresql || true
postgresql-purge:
command: devspace run-pipeline purge-postgresql || true
postgresql-purge-all:
command: devspace run-pipeline purge-postgresql-all || true
postgresql-purge-data:
command: devspace run-pipeline purge-postgresql-data || true
purge:
command: devspace run-pipeline purge
purge-all:
command: devspace run-pipeline purge-all
purge-all-data:
command: devspace run-pipeline purge-all-data
purge-data:
command: devspace run-pipeline purge-data
redis-deploy:
command: devspace run-pipeline deploy-redis
redis-purge:
command: devspace run-pipeline purge-redis
redis-purge-all:
command: devspace run-pipeline purge-redis-all
redis-purge-data:
command: devspace run-pipeline purge-redis-data
rtl-deploy-alice:
command: NAME=alice devspace run-pipeline deploy-rtl
rtl-purge-alice:
command: NAME=alice devspace run-pipeline purge-rtl
sqlpad-deploy:
command: devspace run-pipeline deploy-sqlpad
sqlpad-purge:
command: devspace run-pipeline purge-sqlpad
start:
command: devspace enter -- bash -c 'bb clean && bb run'