-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Blockscout API deployment (#5710)
Adds a new deployment for the Blockscout read-only API component. It is connected to the DB read replica and forwards traffic to both RPC and graphql endpoints to the new component. Co-authored-by: Javier Cortejoso <javier.cortejoso@gmail.com>
- Loading branch information
1 parent
9456881
commit 5f4a62b
Showing
11 changed files
with
192 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/helm-charts/blockscout/templates/blockscout-api.autoscale.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: autoscaling/v2beta1 | ||
kind: HorizontalPodAutoscaler | ||
metadata: | ||
name: {{ .Release.Name }}-api | ||
labels: | ||
app: blockscout | ||
chart: blockscout | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
component: blockscout-api-autoscaler | ||
spec: | ||
minReplicas: {{ .Values.blockscout.api.autoscaling.minReplicas }} | ||
maxReplicas: {{ .Values.blockscout.api.autoscaling.maxReplicas }} | ||
scaleTargetRef: | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
name: {{ .Release.Name }}-api | ||
metrics: | ||
- type: Resource | ||
resource: | ||
name: cpu | ||
targetAverageUtilization: {{ .Values.blockscout.api.autoscaling.target.cpu }} |
57 changes: 57 additions & 0 deletions
57
packages/helm-charts/blockscout/templates/blockscout-api.deployment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ .Release.Name }}-api | ||
labels: | ||
app: blockscout | ||
chart: blockscout | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
component: blockscout-api | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: blockscout | ||
release: {{ .Release.Name }} | ||
component: blockscout-api | ||
template: | ||
metadata: | ||
labels: | ||
app: blockscout | ||
release: {{ .Release.Name }} | ||
component: blockscout-api | ||
spec: | ||
containers: | ||
- name: blockscout-api | ||
image: {{ .Values.blockscout.image.repository }}:api-{{ .Values.blockscout.image.tag }} | ||
imagePullPolicy: {{ .Values.imagePullPolicy }} | ||
command: | ||
- /bin/sh | ||
- -c | ||
args: | ||
- | | ||
exec mix cmd --app block_scout_web mix phx.server | sed 's/^iex(1)> //' | ||
ports: | ||
- name: http | ||
containerPort: 4000 | ||
resources: | ||
requests: | ||
memory: 500Mi | ||
cpu: 500m | ||
env: | ||
- name: DISABLE_WEBAPP | ||
value: "true" | ||
- name: DISABLE_WRITE_API | ||
value: "true" | ||
- name: DISABLE_INDEXER | ||
value: "true" | ||
- name: POOL_SIZE | ||
value: {{ .Values.blockscout.api.pool_size | quote }} | ||
{{ include "celo.blockscout-env-vars" . | indent 8 }} | ||
{{$data := dict "Values" .Values "DbSuffix" "-replica"}} | ||
{{ include "celo.blockscout-db-sidecar" $data | indent 6 }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{ toYaml . | indent 8 }} | ||
{{- end }} |
34 changes: 34 additions & 0 deletions
34
packages/helm-charts/blockscout/templates/blockscout-api.ingress.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }} | ||
apiVersion: networking.k8s.io/v1beta1 | ||
{{ else }} | ||
apiVersion: extensions/v1beta1 | ||
{{ end -}} | ||
kind: Ingress | ||
metadata: | ||
name: {{ .Release.Name }}-api-ingress | ||
labels: | ||
app: blockscout | ||
chart: blockscout | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
component: blockscout-api-ingress | ||
annotations: | ||
kubernetes.io/tls-acme: "true" | ||
kubernetes.io/ingress.class: nginx | ||
nginx.ingress.kubernetes.io/configuration-snippet: | | ||
location ~ /admin/.* { | ||
deny all; | ||
} | ||
spec: | ||
tls: | ||
- hosts: | ||
- {{ .Release.Name }}-api.{{ .Values.domain.name }}.org | ||
secretName: {{ .Release.Name }}-api-tls | ||
rules: | ||
- host: {{ .Release.Name }}-api.{{ .Values.domain.name }}.org | ||
http: | ||
paths: | ||
- path: / | ||
backend: | ||
serviceName: {{ .Release.Name }}-api | ||
servicePort: 4000 |
19 changes: 19 additions & 0 deletions
19
packages/helm-charts/blockscout/templates/blockscout-api.service.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ .Release.Name }}-api | ||
labels: | ||
app: blockscout | ||
chart: blockscout | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
component: blockscout-api | ||
spec: | ||
selector: | ||
app: blockscout | ||
release: {{ .Release.Name }} | ||
component: blockscout-api | ||
clusterIP: None | ||
ports: | ||
- name: http | ||
port: 4000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/helm-charts/blockscout/templates/blockscout-web.autoscale.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: autoscaling/v2beta1 | ||
kind: HorizontalPodAutoscaler | ||
metadata: | ||
name: {{ .Release.Name }}-web | ||
labels: | ||
app: blockscout | ||
chart: blockscout | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
component: blockscout-web-autoscaler | ||
spec: | ||
minReplicas: {{ .Values.blockscout.web.autoscaling.minReplicas }} | ||
maxReplicas: {{ .Values.blockscout.web.autoscaling.maxReplicas }} | ||
scaleTargetRef: | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
name: {{ .Release.Name }}-web | ||
metrics: | ||
- type: Resource | ||
resource: | ||
name: cpu | ||
targetAverageUtilization: {{ .Values.blockscout.web.autoscaling.target.cpu }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters