Skip to content

Commit

Permalink
Devspace non-root/build update (#11510)
Browse files Browse the repository at this point in the history
* move root parts to build inside container

* update README + add more resources to the build node
  • Loading branch information
skudasov authored Dec 7, 2023
1 parent c0a5821 commit c545d2c
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 36 deletions.
12 changes: 4 additions & 8 deletions charts/chainlink-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@ nix develop
## New cluster
We are using [devspace](https://www.devspace.sh/docs/getting-started/installation?x0=3)

Configure the cluster, see `deployments.app.helm.values` and [values.yaml](./values.yaml) comments
Configure the cluster, see `deployments.app.helm.values` and [values.yaml](./values.yaml) comments for more details

Set your registry for the image, example for `ECR`:
```
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ${aws_account}.dkr.ecr.us-west-2.amazonaws.com
export DEVSPACE_IMAGE="${aws_account}.dkr.ecr.us-west-2.amazonaws.com/chainlink-devspace"
```
Enter the shell and deploy
```
# set your unique namespace if it's a new cluster
Expand All @@ -45,11 +40,12 @@ Fix something in the code locally, it'd automatically sync, rebuild it inside co
make chainlink
make chainlink-local-start
```
If you need to update the whole cluster run `deploy` again with a new set of images

Reset the pod to original image
```
devspace reset pods
devspace deploy
```

Destroy the cluster
```
devspace purge
Expand Down
34 changes: 18 additions & 16 deletions charts/chainlink-cluster/devspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ deployments:
- name: node-1
image: ${DEVSPACE_IMAGE}
version: latest
# default resources are 300m/1Gi
# first node need more resources to build faster inside container
# at least 2Gi of memory is required otherwise build will fail (OOM)
resources:
requests:
cpu: 2000m
memory: 2048Mi
limits:
cpu: 2000m
memory: 2048Mi
# override default config per node
# for example, use OCRv2 P2P setup, the whole config
# toml: |
Expand Down Expand Up @@ -105,13 +115,6 @@ deployments:
- name: node-6
image: ${DEVSPACE_IMAGE}
version: latest
resources:
requests:
cpu: 350m
memory: 1024Mi
limits:
cpu: 350m
memory: 1024Mi

# each CL node have a dedicated PostgreSQL 11.15
# use StatefulSet by setting:
Expand Down Expand Up @@ -231,7 +234,7 @@ profiles:
patches:
- op: replace
path: dev.app.workingDir
value: /home/root/chainlink/integration-tests
value: /home/chainlink/integration-tests
- op: replace
path: dev.app.container
value: runner
Expand All @@ -256,21 +259,20 @@ profiles:
# This is a list of `dev` containers that are based on the containers created by your deployments
dev:
app:
workingDir: /home/root/chainlink
workingDir: /home/chainlink
container: node
labelSelector:
instance: node-1
# Sync files between the local filesystem and the development container
sync:
- path: ../../core/services/chainlink:/home/root/chainlink/core/services/chainlink
- path: ../../core/services/chainlink:/home/chainlink/core/services/chainlink
printLogs: true
disableDownload: true
- path: ../..:/home/root/chainlink
- path: ../..:/home/chainlink
printLogs: true
disableDownload: true
uploadExcludePaths:
- integration-tests/
- .git/
- .github/
- belt/
- charts/
Expand All @@ -280,16 +282,16 @@ dev:
- integration-scripts/
- testdata/
- evm-test-helpers/
- tools/
# Open a terminal and use the following command
terminal:
command: bash
ssh:
enabled: true
proxyCommands:
- command: devspace
- command: kubectl
- command: helm
# TODO: access issues
# - command: devspace
# - command: kubectl
# - command: helm
- gitCredentials: true
ports:
- port: "2345"
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ spec:
initialDelaySeconds: 15
periodSeconds: 5
failureThreshold: 20
{{ if (hasKey $.Values.chainlink "resources") }}
{{ if (hasKey $cfg "resources") }}
resources:
requests:
memory: {{ default "1024Mi" $.Values.chainlink.resources.requests.memory }}
cpu: {{ default "500m" $.Values.chainlink.resources.requests.cpu }}
memory: {{ default "1024Mi" $cfg.resources.requests.memory }}
cpu: {{ default "300m" $cfg.resources.requests.cpu }}
limits:
memory: {{ default "1024Mi" $.Values.chainlink.resources.limits.memory }}
cpu: {{ default "500m" $.Values.chainlink.resources.limits.cpu }}
memory: {{ default "1024Mi" $cfg.resources.limits.memory }}
cpu: {{ default "300m" $cfg.resources.limits.cpu }}
{{ else }}
{{ end }}
{{- with $.Values.nodeSelector }}
Expand Down
10 changes: 10 additions & 0 deletions charts/chainlink-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ chainlink:
nodes:
- name: node-1
image: "public.ecr.aws/chainlink/chainlink:latest"
# default resources are 300m/1Gi
# first node need more resources to build faster inside container
# at least 2Gi of memory is required otherwise build will fail (OOM)
resources:
requests:
cpu: 2000m
memory: 2048Mi
limits:
cpu: 2000m
memory: 2048Mi
# override default config per node
# for example, use OCRv2 P2P setup, the whole config
# toml: |
Expand Down
20 changes: 20 additions & 0 deletions core/chainlink.devspace.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ COPY . .
# Build the golang binary
RUN make install-chainlink

# Link LOOP Plugin source dirs with simple names
RUN go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-feeds | xargs -I % ln -s % /chainlink-feeds
RUN go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-solana | xargs -I % ln -s % /chainlink-solana

# Build image: Plugins
FROM golang:1.21-bullseye as buildplugins
RUN go version

WORKDIR /chainlink-feeds
COPY --from=buildgo /chainlink-feeds .
RUN go install ./cmd/chainlink-feeds

WORKDIR /chainlink-solana
COPY --from=buildgo /chainlink-solana .
RUN go install ./pkg/solana/cmd/chainlink-solana

# Final image: ubuntu with chainlink binary
FROM golang:1.21-bullseye

Expand All @@ -32,6 +48,10 @@ RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \

COPY --from=buildgo /go/bin/chainlink /usr/local/bin/

# Install (but don't enable) LOOP Plugins
COPY --from=buildplugins /go/bin/chainlink-feeds /usr/local/bin/
COPY --from=buildplugins /go/bin/chainlink-solana /usr/local/bin/

# Dependency of CosmWasm/wasmd
COPY --from=buildgo /go/pkg/mod/github.com/\!cosm\!wasm/wasmvm@v*/internal/api/libwasmvm.*.so /usr/lib/
RUN chmod 755 /usr/lib/libwasmvm.*.so
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/load/ocr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
## Setup
These tests can connect to any cluster create with [chainlink-cluster](../../../charts/chainlink-cluster/README.md)

Create your cluster
Create your cluster, if you already have one just use `kubefwd`
```
kubectl create ns my-cluster
devspace use namespace my-cluster
kubectl create ns cl-cluster
devspace use namespace cl-cluster
devspace deploy
sudo kubefwd svc -n my-cluster
sudo kubefwd svc -n cl-cluster
```

Change environment connection configuration [here](connection.toml)
Change environment connection configuration [here](../../../charts/chainlink-cluster/connect.toml)

If you haven't changed anything in [devspace.yaml](../../../charts/chainlink-cluster/devspace.yaml) then default connection configuration will work

Expand Down
4 changes: 2 additions & 2 deletions integration-tests/load/ocr/ocr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
}
)

func TestOCRPerformance(t *testing.T) {
func TestOCRLoad(t *testing.T) {
l := logging.GetTestLogger(t)
cc, msClient, cd, bootstrapNode, workerNodes, err := k8s.ConnectRemote(l)
require.NoError(t, err)
Expand Down Expand Up @@ -46,7 +46,7 @@ func TestOCRPerformance(t *testing.T) {
require.NoError(t, err)
}

func TestOCRCapacity(t *testing.T) {
func TestOCRVolume(t *testing.T) {
l := logging.GetTestLogger(t)
cc, msClient, cd, bootstrapNode, workerNodes, err := k8s.ConnectRemote(l)
require.NoError(t, err)
Expand Down

0 comments on commit c545d2c

Please sign in to comment.