Skip to content

Commit

Permalink
feat: add arbitrum namespace (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjorge-graphops authored Nov 16, 2023
1 parent 2f88471 commit a4bb621
Show file tree
Hide file tree
Showing 27 changed files with 538 additions and 205 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ As such:
- Install *helmfile*, upstream guidance available here: [*Helmfile* Installation](https://github.com/helmfile/helmfile#installation)
– Install *kustomize*, upstream guidance available here: [*Kustomize* Installation](https://kubectl.docs.kubernetes.io/installation/kustomize/). Although `launchpad–namespaces` doesn't explicitly use *kustomize*, it is a dependency for utilising *helmfile* features.

Next, setup an `helmfile.yaml` file that makes use of the storage *Namespace* by creating it with the following contents:
Next, setup an `helmfile.yaml` file that makes use of the Storage *Namespace* by creating it with the following contents:
```yaml
helmfiles:
- path: git::https://github.com/graphops/launchpad-namespaces.git@storage/helmfile.yaml?ref=storage-latest
Expand Down Expand Up @@ -157,8 +157,8 @@ One way to go about that would be to keep it in a git repository on some support

The following namespaces are supported:

### [:arbitrum](/arbitrum)
This *Namespace* provides a suitable stack to operate Arbitrum mainnet archive nodes.
### [:arbitrum-one](/arbitrum-one)
This *Namespace* provides a suitable stack to operate Arbitrum One mainnet, görli and sepolia archive nodes.

- [arbitrum-classic](https://github.com/OffchainLabs/arbitrum-classic)<br>
The old "classic" Arbitrum tech stack.
Expand Down
23 changes: 13 additions & 10 deletions arbitrum/README.md → arbitrum-one/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@


# Arbitrum Namespace
# Arbitrum One Namespace

This *Namespace* provides a suitable stack to operate Arbitrum mainnet archive nodes.
This *Namespace* provides a suitable stack to operate Arbitrum One mainnet, görli and sepolia archive nodes.

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Expand Down Expand Up @@ -33,15 +33,15 @@ As such:
- Install *helmfile*, upstream guidance available here: [*Helmfile* Installation](https://github.com/helmfile/helmfile#installation)
– Install *kustomize*, upstream guidance available here: [*Kustomize* Installation](https://kubectl.docs.kubernetes.io/installation/kustomize/). Although `launchpad–namespaces` doesn't explicitly use *kustomize*, it is a dependency for utilising *helmfile* features.

Next, setup an `helmfile.yaml` file that makes use of the arbitrum *Namespace* by creating it with the following contents:
Next, setup an `helmfile.yaml` file that makes use of the Arbitrum One *Namespace* by creating it with the following contents:
```yaml
helmfiles:
- path: git::https://github.com/graphops/launchpad-namespaces.git@arbitrum/helmfile.yaml?ref=arbitrum-latest
- path: git::https://github.com/graphops/launchpad-namespaces.git@arbitrum-one/helmfile.yaml?ref=arbitrum-one-latest
selectorsInherited: true
```
> **Note**
> On the path to the helmfile, you can use the query string's ref `(?ref=arbitrum-latest)` to track one of the release streams: `stable` and `canary`, pin to a specific version or just track a particular major or minor semantic version.
> On the path to the helmfile, you can use the query string's ref `(?ref=arbitrum-one-latest)` to track one of the release streams: `stable` and `canary`, pin to a specific version or just track a particular major or minor semantic version.
> For more on this, check the [*Updates*](/README.md#Updates) section

This is a very minimalist helmfile but enough to get it done.
Expand All @@ -63,7 +63,7 @@ Answer 'y' and hopefully the installation will conclude successfully.
To customize the configuration and deployment, you can pass values to override the default helmfile configuration like so:
```yaml
helmfiles:
- path: git::https://github.com/graphops/launchpad-namespaces.git@arbitrum/helmfile.yaml?ref=arbitrum-latest
- path: git::https://github.com/graphops/launchpad-namespaces.git@arbitrum-one/helmfile.yaml?ref=arbitrum-one-latest
selectorsInherited: true
values:
targetNamespace: "i-choose-my-own-namespace"
Expand All @@ -77,7 +77,7 @@ where we add some labels to this *Namespace* releases, and set it to be deployed
You can also easily override values for every release, like so:
```yaml
helmfiles:
- path: git::https://github.com/graphops/launchpad-namespaces.git@arbitrum/helmfile.yaml?ref=arbitrum-latest
- path: git::https://github.com/graphops/launchpad-namespaces.git@arbitrum-one/helmfile.yaml?ref=arbitrum-one-latest
selectorsInherited: true
values:
targetNamespace: "i-choose-my-own-namespace"
Expand All @@ -94,10 +94,10 @@ Check out the *Namespaces* [list](/README.md#namespaces) below for release names
To use multiple namespaces on the same cluster, just add more items to the helmfiles array like so:
```yaml
helmfiles:
- path: git::https://github.com/graphops/launchpad-namespaces.git@arbitrum/helmfile.yaml?ref=arbitrum-latest
- path: git::https://github.com/graphops/launchpad-namespaces.git@arbitrum-one/helmfile.yaml?ref=arbitrum-one-latest
selectorsInherited: true
values:
<arbitrum values>
<arbitrum-one values>
- path: git::https://github.com/graphops/launchpad-namespaces.git@<other namespace>/helmfile.yaml?ref=<other namespace>-latest
selectorsInherited: true
values:
Expand Down Expand Up @@ -125,6 +125,7 @@ arbitrum&#8209;nitro.labels | object | | Adds helmfile labels to this release |
arbitrum&#8209;nitro.mergeValues | boolean | true | Merges passed values with namespace's defaults if true, overrides if false |
arbitrum&#8209;nitro.resourceLabels | object | | Adds labels to resources on this release |
arbitrum&#8209;nitro.values | (object *or* list of objects) | | Pass values to the release helm chart |
features | list of strings | [proxyd, arbitrum_classic, arbitrum_nitro] | *enum of:&nbsp;&nbsp;(proxyd \| arbitrum_classic \| arbitrum_nitro)* |
flavor | string | | |
kubeVersion | string | | Specifies the kubernetes API version, useful in helm templating environment |
labels | object | | Adds helmfile labels to releases on this namespace |
Expand All @@ -137,7 +138,9 @@ proxyd.mergeValues | boolean | true | Merges passed values with namespace's defa
proxyd.resourceLabels | object | | Adds labels to resources on this release |
proxyd.values | (object *or* list of objects) | | Pass values to the release helm chart |
resourceLabels | object | | Adds labels to release resources on this namespace |
targetNamespace | string | arbitrum-mainnet | the default is arbitrum-(flavor) |
scaling | object | | arbitrum-one scaling interface |
scaling.deployments | integer | 1 | number of independent stateful sets to deploy |
targetNamespace | string | arbitrum-one-mainnet | the default is arbitrum-one-<flavor> |
helmDefaults | object | | |
helmDefaults.args | list of strings | | |
helmDefaults.cleanupOnFail | boolean | | |
Expand Down
2 changes: 1 addition & 1 deletion arbitrum/README.md.tera → arbitrum-one/README.md.tera
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% import "sections.tera" as sections %}
{% import "section.QuickStart.tera" as quickstart %}
{% import "renderIndex.tera" as render %}
{% set name = "arbitrum" %}
{% set name = "arbitrum-one" %}

{{ sections::graphopsTitle(namespace=name) }}

Expand Down
42 changes: 33 additions & 9 deletions arbitrum/helmfile.yaml → arbitrum-one/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#namespace defaults
{{ $_ := set .Values "_defaults" ( `{"flavor":"mainnet","common":{},"mainnet":{"targetNamespace":"arbitrum-mainnet"}}` | fromJson ) }}
{{ $_ := set .Values "_defaults" ( `{"flavor":"mainnet","mainnet":{"targetNamespace":"arbitrum-one-mainnet","scaling":{"deployments":1},"features":["proxyd","arbitrum_classic","arbitrum_nitro"]},"goerli":{"targetNamespace":"arbitrum-one-goerli","scaling":{"deployments":1},"features":["proxyd","arbitrum_nitro"]},"common":{"scaling":{"deployments":1}},"sepolia":{"targetNamespace":"arbitrum-one-sepolia","scaling":{"deployments":1},"features":["proxyd","arbitrum_nitro"]}}` | fromJson ) }}
#set default flavor when missing
{{ if not ( hasKey .Values "flavor" ) }}
{{ $_ := set .Values "flavor" "mainnet" }}
Expand All @@ -12,11 +12,25 @@ environments:
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}

---
# Define default features when undefined
{{ if not (hasKey .Values "features") }}
{{ $_ := set .Values "features" ( .Values._defaults | get .Values.flavor | get "features" ) }}
{{ end }}

#set default number of deployments when missing
{{ if not ( hasKey .Values "scaling" ) }}
{{ $_ := set .Values "scaling" dict }}
{{ end }}
{{ if not ( hasKey ( .Values | get "scaling" dict ) "deployments" ) }}
{{ $_ := set .Values.scaling "deployments" ( .Values._defaults | get .Values.flavor | get "scaling" | get "deployments" ) }}
{{ end }}

environments:
{{ .Environment.Name }}:
values: []
values:
- features: {{ .Values.features | toYaml | nindent 10 }}
- scaling:
deployments: {{ .Values.scaling.deployments }}

---
{{- $_tplTransforms := (print `
Expand Down Expand Up @@ -98,7 +112,7 @@ kubeVersion: {{ .Values.kubeVersion }}


{{- $_commonLabels := dict
`launchpad.graphops.xyz/namespace` `arbitrum`
`launchpad.graphops.xyz/namespace` `arbitrum-one`
}}

{{- $_commonResourceLabels := dict
Expand Down Expand Up @@ -141,7 +155,7 @@ templates:
version: {{ .Values | get "arbitrum-nitro" | get "chartVersion" }}
{{- end }}
{{- if (not (or ( .Values | get "arbitrum-nitro" dict | get "chartVersion" false ) ( .Values | get "arbitrum-nitro" dict | get "chartUrl" false ) )) }}
version: "0.1.5-canary.5"
version: "0.2.0"
{{- end }}
arbitrum-classic:
{{- if ( .Values | get "arbitrum-classic" dict | get "chartUrl" false ) }}
Expand All @@ -155,7 +169,7 @@ templates:
version: {{ .Values | get "arbitrum-classic" | get "chartVersion" }}
{{- end }}
{{- if (not (or ( .Values | get "arbitrum-classic" dict | get "chartVersion" false ) ( .Values | get "arbitrum-classic" dict | get "chartUrl" false ) )) }}
version: "0.1.4"
version: "0.2.0"
{{- end }}
proxyd:
{{- if ( .Values | get "proxyd" dict | get "chartUrl" false ) }}
Expand All @@ -172,8 +186,11 @@ templates:
version: "0.4.0"
{{- end }}
releases:
{{ if has "arbitrum_nitro" ( .Values | get "features" list ) }}
{{- $canonicalRelease := "arbitrum-nitro" }}
{{- $release := "arbitrum-nitro" }}
{{- range $index := until .Values.scaling.deployments }}
{{- $deploymentIndex := (add . 1) }}
{{- $release := (printf "%s%v" "arbitrum-nitro-" $deploymentIndex) }}
{{- $_releaseResourceLabels := deepCopy $_commonResourceLabels }}
- name: "{{ $release }}"
inherit:
Expand All @@ -200,9 +217,13 @@ releases:
{{- tpl $_tplTransforms (dict "Values" $.Values "release" $release "canonicalRelease" $canonicalRelease "resourceLabels" $_releaseResourceLabels ) | indent 4 -}}
values:
{{- tpl $_tplReleaseValues (dict "Values" $.Values "canonicalRelease" $canonicalRelease "release" $release) | indent 4 -}}

{{- end -}}
{{- end -}}
{{ if has "arbitrum_classic" ( .Values | get "features" list ) }}
{{- $canonicalRelease := "arbitrum-classic" }}
{{- $release := "arbitrum-classic" }}
{{- range $index := until .Values.scaling.deployments }}
{{- $deploymentIndex := (add . 1) }}
{{- $release := (printf "%s%v" "arbitrum-classic-" $deploymentIndex) }}
{{- $_releaseResourceLabels := deepCopy $_commonResourceLabels }}
- name: "{{ $release }}"
inherit:
Expand All @@ -229,7 +250,9 @@ releases:
{{- tpl $_tplTransforms (dict "Values" $.Values "release" $release "canonicalRelease" $canonicalRelease "resourceLabels" $_releaseResourceLabels ) | indent 4 -}}
values:
{{- tpl $_tplReleaseValues (dict "Values" $.Values "canonicalRelease" $canonicalRelease "release" $release) | indent 4 -}}

{{- end -}}
{{- end -}}
{{ if has "proxyd" ( .Values | get "features" list ) }}
{{- $canonicalRelease := "proxyd" }}
{{- $release := "proxyd" }}
{{- $_releaseResourceLabels := deepCopy $_commonResourceLabels }}
Expand Down Expand Up @@ -259,3 +282,4 @@ releases:
values:
{{- tpl $_tplReleaseValues (dict "Values" $.Values "canonicalRelease" $canonicalRelease "release" $release) | indent 4 -}}

{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
nitro:
extraArgs:
- --init.url="https://snapshot.arbitrum.io/mainnet/nitro.tar"
- --l1.url=http://your-eth-mainnet-url:8545 ## changeme
- --l2.chain-id=42161 # determines Arbitrum network - 42161 mainnet
- --node.rpc.classic-redirect=http://arbitrum-classic-archive-trace-mainnet:8547/

resources:
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
Expand All @@ -19,14 +13,10 @@ nitro:
volumeClaimSpec:
# -- The storage class to use when provisioning a persistent volume for Erigon
storageClassName: openebs-rawfile-localpv # change me if desired
resources:
requests:
# -- The amount of disk space to provision for Erigon
storage: 3Ti

extraLabels:
app.kubernetes.io/workload-type: blockchain-stateful
app.kubernetes.io/blockchain: arbitrum-nitro-mainnet
app.kubernetes.io/blockchain: arbitrum-one-nitro

affinityPresets:
antiAffinityByHostname: false
Expand Down
23 changes: 23 additions & 0 deletions arbitrum-one/values/_common/proxyd.yaml.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
backends:
{{ range $elem := until .Values.scaling.deployments }}
{{ $scalingIndex := (add $elem 1) }}
arbitrum-nitro-{{ $scalingIndex }}:
enabled: true
# -- Define the RPC URL for the backend
rpcUrl: http://arbitrum-nitro-{{ $scalingIndex }}:8547
# -- Define additional configuration keys for the backend (see [proxyd config](https://github.com/ethereum-optimism/optimism/blob/5d309e6a6d5e1ef6a88c1ce827b7e6d47f033bbb/proxyd/example.config.toml#L47))
extraConfig:
consensus_skip_peer_count: true
# -- Define which backend groups the backend is part of
groups:
- pruned
- archive
- archive-trace
{{ end }}

prometheus:
serviceMonitors:
enabled: true

grafana:
dashboards: true
19 changes: 19 additions & 0 deletions arbitrum-one/values/goerli/arbitrum-nitro.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
nitro:
config:
parentChainUrl: http://your-eth-goerli-url:8545 ## changeme
chain: 421613 # determines Arbitrum network - 421613 Goerli

# -- [PersistentVolumeClaimSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#persistentvolumeclaimspec-v1-core) for Erigon storage
volumeClaimSpec:
resources:
requests:
# -- The amount of disk space to provision for Erigon
storage: 3Ti

extraLabels:
app.kubernetes.io/workload-type: blockchain-stateful
app.kubernetes.io/blockchain: arbitrum-goerli-nitro

restoreSnapshot:
enabled: true
snapshotUrl: "https://snapshot.arbitrum.foundation/goerli/nitro-archive.tar"
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
arbitrum:
extraArgs:
- --node.chain-id=42161 # determines Arbitrum network - 42161 mainnet
- --l1.url=http://your-eth-mainnet-url:8545 # change me
config:
parentChainUrl: http://your-eth-mainnet-url:8545 # change me

resources:
# We usually recommend not to specify default resources and to leave this as a conscious
Expand All @@ -16,20 +15,16 @@ arbitrum:
volumeClaimSpec:
# -- The storage class to use when provisioning a persistent volume for Erigon
storageClassName: openebs-rawfile-localpv # change me if desired
resources:
requests:
# -- The amount of disk space to provision for Erigon
storage: 3Ti

restoreSnapshot:
# -- Enable initialising arbitrum state from a remote snapshot
enabled: true
# -- URL for snapshot to download and extract to restore state
snapshotUrl: https://snapshot.arbitrum.io/mainnet/db.tar
snapshotUrl: https://snapshot.arbitrum.foundation/arb1/classic-archive.tar

extraLabels:
app.kubernetes.io/workload-type: blockchain-stateful
app.kubernetes.io/blockchain: arbitrum-classic-mainnet
app.kubernetes.io/blockchain: arbitrum-one-classic

prometheus:
serviceMonitors:
Expand Down
10 changes: 10 additions & 0 deletions arbitrum-one/values/mainnet/arbitrum-nitro.yaml.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{ $scalingIndex := splitList "-" .Release.Name | last }}
nitro:
config:
parentChainUrl: http://your-eth-mainnet-url:8545 ## changeme
classicUrl: http://arbitrum-classic-{{ $scalingIndex }}-0:8547
chain: 42161

restoreSnapshot:
enabled: true
snapshotUrl: "https://snapshot.arbitrum.foundation/arb1/nitro-archive.tar"
18 changes: 18 additions & 0 deletions arbitrum-one/values/sepolia/arbitrum-nitro.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
nitro:
config:
chain: 421614 # determines Arbitrum network - 421614 Sepolia
parentChainUrl: http://your-eth-sepolia-url:8545 ## changeme

# -- [PersistentVolumeClaimSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#persistentvolumeclaimspec-v1-core) for Erigon storage
volumeClaimSpec:
resources:
requests:
# -- The amount of disk space to provision for Erigon
storage: 1Ti

extraLabels:
app.kubernetes.io/workload-type: blockchain-stateful
app.kubernetes.io/blockchain: arbitrum-sepolia-nitro

restoreSnapshot:
enabled: false
31 changes: 0 additions & 31 deletions arbitrum/values/_common/proxyd.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion celo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ As such:
- Install *helmfile*, upstream guidance available here: [*Helmfile* Installation](https://github.com/helmfile/helmfile#installation)
– Install *kustomize*, upstream guidance available here: [*Kustomize* Installation](https://kubectl.docs.kubernetes.io/installation/kustomize/). Although `launchpad–namespaces` doesn't explicitly use *kustomize*, it is a dependency for utilising *helmfile* features.

Next, setup an `helmfile.yaml` file that makes use of the celo *Namespace* by creating it with the following contents:
Next, setup an `helmfile.yaml` file that makes use of the Celo *Namespace* by creating it with the following contents:
```yaml
helmfiles:
- path: git::https://github.com/graphops/launchpad-namespaces.git@celo/helmfile.yaml?ref=celo-latest
Expand Down
2 changes: 1 addition & 1 deletion ethereum/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ As such:
- Install *helmfile*, upstream guidance available here: [*Helmfile* Installation](https://github.com/helmfile/helmfile#installation)
– Install *kustomize*, upstream guidance available here: [*Kustomize* Installation](https://kubectl.docs.kubernetes.io/installation/kustomize/). Although `launchpad–namespaces` doesn't explicitly use *kustomize*, it is a dependency for utilising *helmfile* features.

Next, setup an `helmfile.yaml` file that makes use of the ethereum *Namespace* by creating it with the following contents:
Next, setup an `helmfile.yaml` file that makes use of the Ethereum *Namespace* by creating it with the following contents:
```yaml
helmfiles:
- path: git::https://github.com/graphops/launchpad-namespaces.git@ethereum/helmfile.yaml?ref=ethereum-latest
Expand Down
Loading

0 comments on commit a4bb621

Please sign in to comment.