-
Notifications
You must be signed in to change notification settings - Fork 2
816 lines (766 loc) · 25 KB
/
k8s.yml
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
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
name: k8s
on: [ push ]
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: actions/checkout@v3
- name: setting up
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
sudo apt-get install -y golang-goprotobuf-dev
go install github.com/swaggo/swag/cmd/swag@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install github.com/favadi/protoc-go-inject-tag@latest
go install github.com/vektra/mockery/v2@latest
go get github.com/mailru/easyjson
go install github.com/mailru/easyjson/...@latest
- uses: actions/checkout@v3
- name: generate gRPC and docs
run: cd bash && chmod +x generateAll.sh && ./generateAll.sh
- name: generate easyjson
run: cd bash && chmod +x easyjsonGenerate.sh && ./easyjsonGenerate.sh
- name: build
run: go build -v ./...
golangci-lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: actions/checkout@v3
- name: setting up
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
sudo apt-get install -y golang-goprotobuf-dev
go install github.com/swaggo/swag/cmd/swag@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install github.com/favadi/protoc-go-inject-tag@latest
go install github.com/vektra/mockery/v2@latest
go get github.com/mailru/easyjson
go install github.com/mailru/easyjson/...@latest
- name: generate gRPC and docs
run: cd bash && chmod +x generateAll.sh && ./generateAll.sh
- name: generate easyjson
run: cd bash && chmod +x easyjsonGenerate.sh && ./easyjsonGenerate.sh
- name: generate test mocks
run: cd internal/test && chmod +x mocks.sh && ./mocks.sh
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
skip-pkg-cache: true
skip-build-cache:
true
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: actions/checkout@v3
- name: setting up
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
sudo apt-get install -y golang-goprotobuf-dev
go install github.com/swaggo/swag/cmd/swag@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install github.com/favadi/protoc-go-inject-tag@latest
go install github.com/vektra/mockery/v2@latest
go get github.com/mailru/easyjson
go install github.com/mailru/easyjson/...@latest
- name: generate gRPC and docs
run: cd bash && chmod +x generateAll.sh && ./generateAll.sh
- name: generate easyjson
run: cd bash && chmod +x easyjsonGenerate.sh && ./easyjsonGenerate.sh
- name: go tests
run: cd bash && chmod +x test.sh && ./test.sh
buildWaiter:
runs-on: ubuntu-latest
name: checks-waiter
needs:
- build
- golangci-lint
- test
steps:
- run: echo "go to build images"
#########################################
dockerAlbum_build:
runs-on: ubuntu-latest
name: build album image
needs:
- buildWaiter
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./env/prod/k8/album/Dockerfile
tags: mausved/wave_album:latest
outputs: type=docker,dest=/tmp/album.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v2
with:
name: album
path: /tmp/album.tar
dockerAlertmanager_build:
runs-on: ubuntu-latest
name: build alertmanager image
needs:
- buildWaiter
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./env/prod/k8/alertmanager/Dockerfile
tags: mausved/wave_alertmanager:latest
outputs: type=docker,dest=/tmp/alertmanager.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v2
with:
name: alertmanager
path: /tmp/alertmanager.tar
dockerApi_build:
runs-on: ubuntu-latest
name: build api image
needs:
- buildWaiter
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./env/prod/k8/api/Dockerfile
tags: mausved/wave_api:latest
outputs: type=docker,dest=/tmp/api.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v2
with:
name: api
path: /tmp/api.tar
dockerArtist_build:
runs-on: ubuntu-latest
name: build artist image
needs:
- buildWaiter
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./env/prod/k8/artist/Dockerfile
tags: mausved/wave_artist:latest
outputs: type=docker,dest=/tmp/artist.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v2
with:
name: artist
path: /tmp/artist.tar
dockerAuth_build:
runs-on: ubuntu-latest
name: build auth image
needs:
- buildWaiter
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./env/prod/k8/auth/Dockerfile
tags: mausved/wave_auth:latest
outputs: type=docker,dest=/tmp/auth.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v2
with:
name: auth
path: /tmp/auth.tar
dockerCaddy_build:
runs-on: ubuntu-latest
name: build caddy image
needs:
- buildWaiter
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./env/prod/k8/caddy/Dockerfile
tags: mausved/wave_caddy:latest
outputs: type=docker,dest=/tmp/caddy.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v2
with:
name: caddy
path: /tmp/caddy.tar
dockerGrafana_build:
runs-on: ubuntu-latest
name: build grafana image
needs:
- buildWaiter
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./env/prod/k8/grafana/Dockerfile
tags: mausved/wave_grafana:latest
outputs: type=docker,dest=/tmp/grafana.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v2
with:
name: grafana
path: /tmp/grafana.tar
dockerPlaylist_build:
runs-on: ubuntu-latest
name: build playlist image
needs:
- buildWaiter
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./env/prod/k8/playlist/Dockerfile
tags: mausved/wave_playlist:latest
outputs: type=docker,dest=/tmp/playlist.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v2
with:
name: playlist
path: /tmp/playlist.tar
dockerPrometheus_build:
runs-on: ubuntu-latest
name: build prometheus image
needs:
- buildWaiter
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./env/prod/k8/prometheus/Dockerfile
tags: mausved/wave_prometheus:latest
outputs: type=docker,dest=/tmp/prometheus.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v2
with:
name: prometheus
path: /tmp/prometheus.tar
dockerTrack_build:
runs-on: ubuntu-latest
name: build track image
needs:
- buildWaiter
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./env/prod/k8/track/Dockerfile
tags: mausved/wave_track:latest
outputs: type=docker,dest=/tmp/track.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v2
with:
name: track
path: /tmp/track.tar
dockerUser_build:
runs-on: ubuntu-latest
name: build user image
needs:
- buildWaiter
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./env/prod/k8/user/Dockerfile
tags: mausved/wave_user:latest
outputs: type=docker,dest=/tmp/user.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v2
with:
name: user
path: /tmp/user.tar
dockerWeb_build:
runs-on: ubuntu-latest
name: build web image
needs:
- buildWaiter
steps:
- uses: actions/checkout@v3
- name: Set up certs
run: |
mkdir env/prod/certs/xyz/ -p
echo "${{ secrets.FULLCHAIN_ONLINE }}" > env/prod/certs/fullchain.pem
echo "${{ secrets.PRIVKEY_ONLINE }}" > env/prod/certs/privkey.pem
echo "${{ secrets.FULLCHAIN_XYZ }}" > env/prod/certs/xyz/fullchain.pem
echo "${{ secrets.PRIVKEY_XYZ }}" > env/prod/certs/xyz/privkey.pem
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./env/prod/k8/web/Dockerfile
tags: mausved/wave_web:latest
outputs: type=docker,dest=/tmp/web.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v2
with:
name: web
path: /tmp/web.tar
dockerWebsocket_build:
runs-on: ubuntu-latest
name: build websocket image
needs:
- buildWaiter
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./env/prod/k8/websocket/Dockerfile
tags: mausved/wave_websocket:latest
outputs: type=docker,dest=/tmp/websocket.tar
- name: Upload image as artifact
uses: actions/upload-artifact@v2
with:
name: websocket
path: /tmp/websocket.tar
dockerPreBuildWaiter:
runs-on: ubuntu-latest
name: docker-pre-waiter
needs:
- dockerAlbum_build
- dockerAlertmanager_build
- dockerApi_build
- dockerArtist_build
- dockerAuth_build
- dockerCaddy_build
- dockerGrafana_build
- dockerPlaylist_build
- dockerPrometheus_build
- dockerTrack_build
- dockerUser_build
- dockerWeb_build
- dockerWebsocket_build
steps:
- run: echo "go to deploy to docker.hub"
#########################################
dockerAlbum_deploy:
runs-on: ubuntu-latest
name: deploy album image
needs:
- dockerPreBuildWaiter
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artefact
uses: actions/download-artifact@v2
with:
name: album
path: /tmp
- name: Load docker image
run: |
docker load --input /tmp/album.tar
docker image ls -a
- name: Push image
run: cd deploy && chmod +x dockerPush.sh && ./dockerPush.sh album
dockerAlertmanager_deploy:
runs-on: ubuntu-latest
name: deploy alertmanager image
needs:
- dockerPreBuildWaiter
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artefact
uses: actions/download-artifact@v2
with:
name: alertmanager
path: /tmp
- name: Load docker image
run: |
docker load --input /tmp/alertmanager.tar
docker image ls -a
- name: Push image
run: cd deploy && chmod +x dockerPush.sh && ./dockerPush.sh alertmanager
dockerApi_deploy:
runs-on: ubuntu-latest
name: deploy api image
needs:
- dockerPreBuildWaiter
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artefact
uses: actions/download-artifact@v2
with:
name: api
path: /tmp
- name: Load docker image
run: |
docker load --input /tmp/api.tar
docker image ls -a
- name: Push image
run: cd deploy && chmod +x dockerPush.sh && ./dockerPush.sh api
dockerArtist_deploy:
runs-on: ubuntu-latest
name: deploy artist image
needs:
- dockerPreBuildWaiter
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artefact
uses: actions/download-artifact@v2
with:
name: artist
path: /tmp
- name: Load docker image
run: |
docker load --input /tmp/artist.tar
docker image ls -a
- name: Push image
run: cd deploy && chmod +x dockerPush.sh && ./dockerPush.sh artist
dockerAuth_deploy:
runs-on: ubuntu-latest
name: deploy auth image
needs:
- dockerPreBuildWaiter
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artefact
uses: actions/download-artifact@v2
with:
name: auth
path: /tmp
- name: Load docker image
run: |
docker load --input /tmp/auth.tar
docker image ls -a
- name: Push image
run: cd deploy && chmod +x dockerPush.sh && ./dockerPush.sh auth
dockerCaddy_deploy:
runs-on: ubuntu-latest
name: deploy caddy image
needs:
- dockerPreBuildWaiter
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artefact
uses: actions/download-artifact@v2
with:
name: caddy
path: /tmp
- name: Load docker image
run: |
docker load --input /tmp/caddy.tar
docker image ls -a
- name: Push image
run: cd deploy && chmod +x dockerPush.sh && ./dockerPush.sh caddy
dockerGrafana_deploy:
runs-on: ubuntu-latest
name: deploy grafana image
needs:
- dockerPreBuildWaiter
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artefact
uses: actions/download-artifact@v2
with:
name: grafana
path: /tmp
- name: Load docker image
run: |
docker load --input /tmp/grafana.tar
docker image ls -a
- name: Push image
run: cd deploy && chmod +x dockerPush.sh && ./dockerPush.sh grafana
dockerPlaylist_deploy:
runs-on: ubuntu-latest
name: deploy playlist image
needs:
- dockerPreBuildWaiter
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artefact
uses: actions/download-artifact@v2
with:
name: playlist
path: /tmp
- name: Load docker image
run: |
docker load --input /tmp/playlist.tar
docker image ls -a
- name: Push image
run: cd deploy && chmod +x dockerPush.sh && ./dockerPush.sh playlist
dockerPrometheus_deploy:
runs-on: ubuntu-latest
name: deploy prometheus image
needs:
- dockerPreBuildWaiter
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artefact
uses: actions/download-artifact@v2
with:
name: prometheus
path: /tmp
- name: Load docker image
run: |
docker load --input /tmp/prometheus.tar
docker image ls -a
- name: Push image
run: cd deploy && chmod +x dockerPush.sh && ./dockerPush.sh prometheus
dockerTrack_deploy:
runs-on: ubuntu-latest
name: deploy track image
needs:
- dockerPreBuildWaiter
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artefact
uses: actions/download-artifact@v2
with:
name: track
path: /tmp
- name: Load docker image
run: |
docker load --input /tmp/track.tar
docker image ls -a
- name: Push image
run: cd deploy && chmod +x dockerPush.sh && ./dockerPush.sh track
dockerUser_deploy:
runs-on: ubuntu-latest
name: deploy user image
needs:
- dockerPreBuildWaiter
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artefact
uses: actions/download-artifact@v2
with:
name: user
path: /tmp
- name: Load docker image
run: |
docker load --input /tmp/user.tar
docker image ls -a
- name: Push image
run: cd deploy && chmod +x dockerPush.sh && ./dockerPush.sh user
dockerWeb_deploy:
runs-on: ubuntu-latest
name: deploy web image
needs:
- dockerPreBuildWaiter
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artefact
uses: actions/download-artifact@v2
with:
name: web
path: /tmp
- name: Load docker image
run: |
docker load --input /tmp/web.tar
docker image ls -a
- name: Push image
run: cd deploy && chmod +x dockerPush.sh && ./dockerPush.sh web
dockerWebsocket_deploy:
runs-on: ubuntu-latest
name: deploy websocket image
needs:
- dockerPreBuildWaiter
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artefact
uses: actions/download-artifact@v2
with:
name: websocket
path: /tmp
- name: Load docker image
run: |
docker load --input /tmp/websocket.tar
docker image ls -a
- name: Push image
run: cd deploy && chmod +x dockerPush.sh && ./dockerPush.sh websocket
dockerDeployWaiter:
runs-on: ubuntu-latest
name: docker-deploy-waiter
needs:
- dockerAlbum_deploy
- dockerAlertmanager_deploy
- dockerApi_deploy
- dockerArtist_deploy
- dockerAuth_deploy
- dockerCaddy_deploy
- dockerGrafana_deploy
- dockerPlaylist_deploy
- dockerPrometheus_deploy
- dockerTrack_deploy
- dockerUser_deploy
- dockerWeb_deploy
- dockerWebsocket_deploy
steps:
- run: echo "go to deploy to k8s"
#########################################
k8s:
runs-on: ubuntu-latest
name: k8s
needs:
- dockerDeployWaiter
steps:
- uses: actions/checkout@v1
- name: k8s install
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
chmod +x kubectl
mkdir -p ~/.local/bin
mv ./kubectl ~/.local/bin/kubectl
export PATH="~/.local/bin/kubectl:$PATH"
kubectl version --client --output=yaml
- name: apply & rollout restart
run: |
echo "${{ secrets.K8S_CONFIG }}" > k8s.yaml
export KUBECONFIG="$(pwd)/k8s.yaml"
kubectl apply -f ./env/prod/k8/ -R
sleep 10
kubectl rollout restart deployment godeploy
sleep 10
kubectl rollout restart deployment wave
sleep 10
kubectl rollout restart deployment websocket
sleep 10
kubectl rollout restart deployment redis
sleep 10
kubectl rollout restart deployment artist
sleep 10
kubectl rollout restart deployment auth
sleep 10
kubectl rollout restart deployment playlist
sleep 10
kubectl rollout restart deployment track
sleep 10
kubectl rollout restart deployment album
sleep 10
kubectl rollout restart deployment caddy
sleep 10
kubectl rollout restart deployment grafana
sleep 10
kubectl rollout restart deployment alertmanager
sleep 10
kubectl rollout restart deployment prometheus