-
Notifications
You must be signed in to change notification settings - Fork 101
/
.gitlab-ci.yml
122 lines (113 loc) · 6 KB
/
.gitlab-ci.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
stages:
- build
- deploy
variables:
#GLOBAL
IMAGE_NAME: ssv-node
DOCKER_BUILDKIT: 1
#PRODUCTION
ACCOUNT_ID_INFRA_PROD: 764289642555
AWS_REGION_INFRA_PROD: "us-west-2"
DOCKER_REPO_INFRA_PROD: $ACCOUNT_ID_INFRA_PROD.dkr.ecr.$AWS_REGION_INFRA_PROD.amazonaws.com/$IMAGE_NAME
APP_REPLICAS_INFRA_PROD: "1"
ECRLOGIN_INFRA_PROD: "aws ecr get-login --registry-ids $ACCOUNT_ID_INFRA_PROD --region $AWS_REGION_INFRA_PROD --no-include-email"
PROD_HEALTH_CHECK_IMAGE: 764289642555.dkr.ecr.us-west-2.amazonaws.com/infra-prod-repo:ubuntu20
# +---------------+
# | Prod |
# +---------------+
Build prod Docker image:
image: docker:20.10.23
stage: build
tags:
- blox-infra-prod
script:
- apk add --no-cache py-pip
- pip install pyyaml==5.3.1
- pip install awscli
- docker build -t $IMAGE_NAME:$CI_COMMIT_SHA -f Dockerfile .
- DOCKER_LOGIN_TO_INFRA_PROD_REPO=`$ECRLOGIN_INFRA_PROD`
- docker tag $IMAGE_NAME:$CI_COMMIT_SHA $DOCKER_REPO_INFRA_PROD:$CI_COMMIT_SHA
- $DOCKER_LOGIN_TO_INFRA_PROD_REPO && docker push $DOCKER_REPO_INFRA_PROD:$CI_COMMIT_SHA
only:
- unstable
Deploy nodes to prod:
stage: deploy
tags:
- blox-infra-prod
script:
- apk add bash curl
- export K8S_API_VERSION=$INFRA_PROD_K8_API_VERSION
- export SSV_EXPORTER_CPU_LIMIT=$PROD_SSV_EXPORTER_CPU_LIMIT
- export SSV_EXPORTER_MEM_LIMIT=$PROD_SSV_EXPORTER_MEM_LIMIT
- export SSV_NODES_CPU_LIMIT_V3=$PROD_SSV_NODES_CPU_LIMIT_V3
- export SSV_NODES_MEM_LIMIT_V3=$PROD_SSV_NODES_MEM_LIMIT_V3
- curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl
- chmod +x ./kubectl
- mv ./kubectl /usr/bin/kubectl
- mkdir ~/.kube/
- echo $PROD_KUBECONFIG | base64 -d > kubeconfig
- mv kubeconfig ~/.kube/
- export KUBECONFIG=~/.kube/kubeconfig
- kubectl config get-contexts
# +-------------------------------+
# | 🟠 Deploy SSV Holesky nodes |
# +-------------------------------+
- .k8/production/holesky/scripts/deploy-cluster-1--4.sh $DOCKER_REPO_INFRA_PROD $CI_COMMIT_SHA ssv $APP_REPLICAS_INFRA_PROD blox-infra-prod kubernetes-admin@blox-infra-prod ssv.network $K8S_API_VERSION $PROD_HEALTH_CHECK_IMAGE $SSV_NODES_CPU_LIMIT_V3 $SSV_NODES_MEM_LIMIT_V3
#
# +-------------------------------+
# │ 🟠 Deploy Holesky Bootnode |
# +-------------------------------+
# █▓▒░ Keep commented unless you're testing the bootnode ░▒▓█
# - .k8/production/holesky/scripts/deploy-boot-nodes.sh $DOCKER_REPO_INFRA_PROD $CI_COMMIT_SHA ssv $APP_REPLICAS_INFRA_PROD blox-infra-prod kubernetes-admin@blox-infra-prod ssv.network $K8S_API_VERSION $PROD_HEALTH_CHECK_IMAGE $SSV_NODES_CPU_LIMIT_V3 $SSV_NODES_MEM_LIMIT_V3
#
# +----------------------------+
# | 🔴 Deploy SSV Mainnet nodes |
# +----------------------------+
# - .k8/production/mainnet/scripts/deploy-cluster-1-4.sh $DOCKER_REPO_INFRA_PROD $CI_COMMIT_SHA ssv $APP_REPLICAS_INFRA_PROD blox-infra-prod kubernetes-admin@blox-infra-prod ssv.network $K8S_API_VERSION $PROD_HEALTH_CHECK_IMAGE $SSV_NODES_CPU_LIMIT_V3 $SSV_NODES_MEM_LIMIT_V3
#
# +------------------------------+
# │ 🔴 Deploy Mainnet Bootnode |
# +------------------------------+
# █▓▒░ Keep commented unless you're testing the bootnode ░▒▓█
# - .k8/production/mainnet/scripts/deploy-boot-nodes.sh $DOCKER_REPO_INFRA_PROD $CI_COMMIT_SHA ssv $APP_REPLICAS_INFRA_PROD blox-infra-prod kubernetes-admin@blox-infra-prod ssv.network $K8S_API_VERSION $PROD_HEALTH_CHECK_IMAGE $SSV_NODES_CPU_LIMIT_V3 $SSV_NODES_MEM_LIMIT_V3
only:
- unstable
Deploy exporter to prod:
stage: deploy
tags:
- blox-infra-prod
script:
- apk add bash
- export K8S_API_VERSION=$INFRA_PROD_K8_API_VERSION
- export SSV_EXPORTER_CPU_LIMIT=$PROD_SSV_EXPORTER_CPU_LIMIT
- export SSV_EXPORTER_MEM_LIMIT=$PROD_SSV_EXPORTER_MEM_LIMIT
- export SSV_EXPORTER_MAINNET_CPU_LIMIT=$PROD_SSV_EXPORTER_MAINNET_CPU_LIMIT
- export SSV_EXPORTER_MAINNET_MEM_LIMIT=$PROD_SSV_EXPORTER_MAINNET_MEM_LIMIT
- export SSV_EXPORTER_2_MAINNET_CPU_LIMIT=$PROD_SSV_EXPORTER_2_MAINNET_CPU_LIMIT
- export SSV_EXPORTER_2_MAINNET_MEM_LIMIT=$PROD_SSV_EXPORTER_2_MAINNET_MEM_LIMIT
- export SSV_NODES_CPU_LIMIT_V3=$PROD_SSV_NODES_CPU_LIMIT_V3
- export SSV_NODES_MEM_LIMIT_V3=$PROD_SSV_NODES_MEM_LIMIT_V3
- curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl
- chmod +x ./kubectl
- mv ./kubectl /usr/bin/kubectl
#
# +-------------------------------+
# | 🟠 Deploy Holesky exporter |
# +-------------------------------+
- .k8/production/holesky/scripts/deploy-exporters.sh $DOCKER_REPO_INFRA_PROD $CI_COMMIT_SHA ssv $APP_REPLICAS_INFRA_PROD blox-infra-prod kubernetes-admin@blox-infra-prod ssv.network $K8S_API_VERSION $SSV_EXPORTER_CPU_LIMIT $SSV_EXPORTER_MEM_LIMIT
#
# +------------------------------+
# │ 🔴 Deploy Mainnet exporter |
# +------------------------------+
# - .k8/production/mainnet/scripts/deploy-exporters.sh $DOCKER_REPO_INFRA_PROD $CI_COMMIT_SHA ssv $APP_REPLICAS_INFRA_PROD blox-infra-prod kubernetes-admin@blox-infra-prod ssv.network $K8S_API_VERSION $SSV_EXPORTER_MAINNET_CPU_LIMIT $SSV_EXPORTER_MAINNET_MEM_LIMIT
#
# +------------------------------+
# │ 🔴 Deploy Mainnet exporter 2|
# +------------------------------+
- .k8/production/mainnet/scripts/deploy-exporters-2.sh $DOCKER_REPO_INFRA_PROD $CI_COMMIT_SHA ssv $APP_REPLICAS_INFRA_PROD blox-infra-prod kubernetes-admin@blox-infra-prod ssv.network $K8S_API_VERSION $SSV_EXPORTER_2_MAINNET_CPU_LIMIT $SSV_EXPORTER_2_MAINNET_MEM_LIMIT
# +------------------------------+
# │ 🔴 Deploy Mainnet exporter 3|
# +------------------------------+
- .k8/production/mainnet/scripts/deploy-exporters-3.sh $DOCKER_REPO_INFRA_PROD $CI_COMMIT_SHA ssv $APP_REPLICAS_INFRA_PROD blox-infra-prod kubernetes-admin@blox-infra-prod ssv.network $K8S_API_VERSION
only:
- main