Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[blockscout-stack] Adding support for NFT storage #48

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/pre-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Pre Release Charts

on:
workflow_dispatch:

jobs:
release:
permissions:
contents: write # to push chart release and create a release (helm/chart-releaser-action)

runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Fetch history
run: git fetch --prune --unshallow

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.11.2

- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_SKIP_EXISTING: false
CR_MAKE_RELEASE_LATEST: false
7 changes: 7 additions & 0 deletions charts/blockscout-stack/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# ChangeLog

## 1.9.0

### Feature

- Adding support for NFT storage
- Adding security context for migration jobs

## 1.8.0

### Feature
Expand Down
4 changes: 2 additions & 2 deletions charts/blockscout-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.8.0
version: 1.9.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "6.9.0"
appVersion: "6.10.0"
173 changes: 173 additions & 0 deletions charts/blockscout-stack/templates/blockscout-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ spec:
{{- if and .Values.blockscout.init.enabled (not .Values.blockscout.separateApi.enabled) }}
initContainers:
- name: init-migrations
securityContext:
{{- toYaml .Values.blockscout.securityContext | nindent 12 }}
image: "{{ .Values.blockscout.image.repository }}:{{ .Values.blockscout.image.tag }}"
resources:
{{- toYaml .Values.blockscout.resources | nindent 12 }}
Expand Down Expand Up @@ -116,6 +118,17 @@ spec:
- name: http
containerPort: 4000
protocol: TCP
{{- if and .Values.blockscout.nftStorage.enabled (not .Values.blockscout.separateApi.enabled) }}
- name: epmd
containerPort: 4369
protocol: TCP
- name: epmd-dyn-1
containerPort: 9138
protocol: TCP
- name: epmd-dyn-2
containerPort: 9139
protocol: TCP
{{- end }}
env:
{{- if .Values.blockscout.separateApi.enabled }}
- name: APPLICATION_MODE
Expand All @@ -126,6 +139,20 @@ spec:
{{- end }}
- name: PORT
value: "4000"
{{- if and .Values.blockscout.nftStorage.enabled (not .Values.blockscout.separateApi.enabled) }}
- name: NFT_MEDIA_HANDLER_ENABLED
value: 'true'
- name: NFT_MEDIA_HANDLER_REMOTE_DISPATCHER_NODE_MODE_ENABLED
value: 'true'
- name: RELEASE_NODE
value: 'indexer@{{ .Release.Name }}-blockscout-svc.{{ .Release.Namespace }}.svc.cluster.local'
- name: RELEASE_DISTRIBUTION
value: 'name'
- name: NFT_MEDIA_HANDLER_BACKFILL_ENABLED
value: 'true'
- name: ERL_AFLAGS
value: "-kernel inet_dist_listen_min 9138 inet_dist_listen_max 9139"
{{- end }}
- name: CHAIN_ID
value: {{ .Values.config.network.id | quote }}
{{- if and .Values.config.network.currency.symbol (not .Values.config.network.currency.dualToken) }}
Expand Down Expand Up @@ -278,6 +305,17 @@ spec:
- name: http
containerPort: 4000
protocol: TCP
{{- if .Values.blockscout.nftStorage.enabled }}
- name: epmd
containerPort: 4369
protocol: TCP
- name: epmd-dyn-1
containerPort: 9138
protocol: TCP
- name: epmd-dyn-2
containerPort: 9139
protocol: TCP
{{- end }}
env:
- name: APPLICATION_MODE
value: "indexer"
Expand All @@ -291,6 +329,20 @@ spec:
value: "true"
- name: API_V1_WRITE_METHODS_DISABLED
value: "true"
{{- if .Values.blockscout.nftStorage.enabled }}
- name: NFT_MEDIA_HANDLER_ENABLED
value: 'true'
- name: NFT_MEDIA_HANDLER_REMOTE_DISPATCHER_NODE_MODE_ENABLED
value: 'true'
- name: RELEASE_NODE
value: 'indexer@{{ .Release.Name }}-blockscout-indexer-svc.{{ .Release.Namespace }}.svc.cluster.local'
- name: RELEASE_DISTRIBUTION
value: 'name'
- name: NFT_MEDIA_HANDLER_BACKFILL_ENABLED
value: 'true'
- name: ERL_AFLAGS
value: "-kernel inet_dist_listen_min 9138 inet_dist_listen_max 9139"
{{- end }}
{{- if and .Values.config.network.currency.symbol (not .Values.config.network.currency.dualToken) }}
- name: COIN
value: {{ .Values.config.network.currency.symbol | quote }}
Expand Down Expand Up @@ -356,4 +408,125 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
---
{{- if .Values.blockscout.nftStorage.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "blockscout-stack.fullname" . }}-blockscout-resizer
labels:
app: {{ .Release.Name }}-blockscout-resizer
{{- include "blockscout-stack.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.blockscout.replicaCount }}
selector:
matchLabels:
app: {{ .Release.Name }}-blockscout-resizer
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/blockscout-secret.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app: {{ .Release.Name }}-blockscout-resizer
{{- include "blockscout-stack.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "blockscout-stack.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.blockscout.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}-blockscout
securityContext:
{{- toYaml .Values.blockscout.securityContext | nindent 12 }}
image: "{{ .Values.blockscout.image.repository }}:{{ .Values.blockscout.image.tag }}"
resources:
{{- toYaml .Values.blockscout.nftStorage.resources | nindent 12 }}
imagePullPolicy: {{ .Values.blockscout.image.pullPolicy }}
{{- with .Values.blockscout.command }}
command: {{ . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.blockscout.args }}
args: {{ . | toYaml | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 4000
protocol: TCP
- name: epmd
containerPort: 4369
protocol: TCP
- name: epmd-dyn-1
containerPort: 9140
protocol: TCP
- name: epmd-dyn-2
containerPort: 9141
protocol: TCP
env:
- name: PORT
value: "4000"
- name: NFT_MEDIA_TMP_DIR
value: './images'
- name: NFT_MEDIA_HANDLER_ENABLED
value: 'true'
- name: NFT_MEDIA_HANDLER_REMOTE_DISPATCHER_NODE_MODE_ENABLED
value: 'true'
- name: NFT_MEDIA_HANDLER_IS_WORKER
value: 'true'
- name: NFT_MEDIA_HANDLER_NODES_MAP
{{- if .Values.blockscout.separateApi.enabled }}
value: '{"indexer@{{ .Release.Name }}-blockscout-indexer-svc.{{ .Release.Namespace }}.svc.cluster.local": "/{{ .Release.Name }}"}'
{{- else }}
value: '{"indexer@{{ .Release.Name }}-blockscout-svc.{{ .Release.Namespace }}.svc.cluster.local": "/{{ .Release.Name }}"}'
{{- end }}
- name: RELEASE_NODE
value: 'worker@{{ .Release.Name }}-blockscout-resizer-svc.{{ .Release.Namespace }}.svc.cluster.local'
- name: RELEASE_DISTRIBUTION
value: 'name'
- name: ERL_AFLAGS
value: "-kernel inet_dist_listen_min 9140 inet_dist_listen_max 9141"
envFrom:
- secretRef:
name: {{ include "blockscout-stack.fullname" . }}-blockscout-resizer
{{- if .Values.blockscout.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: {{ .Values.blockscout.readinessProbe.path }}
port: http
scheme: HTTP
{{- with .Values.blockscout.readinessProbe.params }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.blockscout.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: {{ .Values.blockscout.livenessProbe.path }}
port: http
scheme: HTTP
{{- with .Values.blockscout.livenessProbe.params }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.blockscout.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ . | toYaml | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ metadata:
spec:
template:
spec:
securityContext:
{{- toYaml .Values.blockscout.podSecurityContext | nindent 8 }}
containers:
- name: blockscout-migrations
image: "{{ .Values.blockscout.image.repository }}:{{ .Values.blockscout.image.tag }}"
imagePullPolicy: {{ .Values.blockscout.image.pullPolicy }}
securityContext:
{{- toYaml .Values.blockscout.securityContext | nindent 12 }}
{{- with .Values.blockscout.init.command }}
command: {{ . | toYaml | nindent 12 }}
{{- end }}
Expand Down
21 changes: 21 additions & 0 deletions charts/blockscout-stack/templates/blockscout-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,28 @@ metadata:
{{- include "blockscout-stack.labels" . | nindent 4 }}
type: Opaque
data:
{{- if .Values.blockscout.nftStorage.enabled }}
RELEASE_COOKIE: {{ .Values.blockscout.nftStorage.cookie | b64enc }}
NFT_MEDIA_HANDLER_AWS_PUBLIC_BUCKET_URL: {{ .Values.blockscout.nftStorage.bucketUrl | b64enc }}
{{- end }}
{{- range $key, $value := .Values.blockscout.envFromSecret }}
{{ $key }}: {{ $value | b64enc }}
{{- end }}
---
{{- if .Values.blockscout.nftStorage.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "blockscout-stack.fullname" . }}-blockscout-resizer
labels:
{{- include "blockscout-stack.labels" . | nindent 4 }}
type: Opaque
data:
RELEASE_COOKIE: {{ .Values.blockscout.nftStorage.cookie | b64enc }}
NFT_MEDIA_HANDLER_AWS_BUCKET_HOST: {{ .Values.blockscout.nftStorage.bucketHost | b64enc }}
NFT_MEDIA_HANDLER_AWS_ACCESS_KEY_ID: {{ .Values.blockscout.nftStorage.accessKey | b64enc }}
NFT_MEDIA_HANDLER_AWS_SECRET_ACCESS_KEY: {{ .Values.blockscout.nftStorage.secretKey | b64enc }}
NFT_MEDIA_HANDLER_AWS_BUCKET_NAME: {{ .Values.blockscout.nftStorage.bucketName | b64enc }}
NFT_MEDIA_HANDLER_AWS_PUBLIC_BUCKET_URL: {{ .Values.blockscout.nftStorage.bucketUrl | b64enc }}
{{- end }}
{{- end }}
Loading