#Running Dagger in K8S

1 messages ยท Page 1 of 1 (latest)

dire escarp
silver wraith
#

I managed to have another error now, but if I go in the container and check the /usr/local/bin nerdctl is here

failed to run container: time="2023-11-22T11:35:09Z" level=fatal msg="failed to create shim task: failed to create init process I/O: 1 error occurred:\n\t* failed to start binary process: fork/exec /usr/local/bin/nerdctl: no such file or directory\n\n: unknown"
: exit status 1
dire escarp
#

When you deploy dagger as a deamon set, all nodes should have unix:///var/run/dagger/buildkitd.sock and /var/run/dagger paths and ideally it should work.

silver wraith
#

Dagger is installed inside the Docker and not the host

dire escarp
silver wraith
#

But yes if I continue to fail using dagger without creating a daemonset, I will use a daemonset :

#

:/

dire escarp
#

if you share more details about your setup I can have a look. Can't tell too much from this snippets

silver wraith
#

Not sure I understand, today I have installed docker inside the dockerfile and not in the host.

This is the dockerfile

ARG CONTAINERIZED_SYSTEMD_VERSION=v0.1.1
ARG CONTAINER_BASE="containerd"

FROM ghcr.io/containerd/nerdctl:main AS containerd-base
amd64.tar.gz
ENV NODE_VERSION=18
RUN apt-get update && apt-get install -y ca-certificates curl gnupg
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN apt-get update && apt-get install nodejs -y

RUN node --version
RUN npm --version
RUN chmod +x /usr/local/bin/nerdctl
RUN ln -s `which nerdctl` /usr/local/bin/docker
systemd/${CONTAINERIZED_SYSTEMD_VERSION}/docker-entrypoint.sh && \
/usr/local/lib/systemd/system/*.service && \

FROM node:18-bullseye AS docker-base
COPY --from=docker:latest /usr/local/bin/docker  /usr/local/bin/

RUN curl -fsSL https://bun.sh/install | bash
ENV PATH=${HOME}/.bun/bin:${PATH}

FROM ${CONTAINER_BASE}-base AS builder
WORKDIR /app
RUN npm i -g turbo
COPY . .
RUN turbo prune --scope=@animaapp/scoring-worker --docker

# Add lockfile and package.json's of isolated subworkspace
FROM ${CONTAINER_BASE}-base AS installer
WORKDIR /
RUN curl -sfL https://releases.dagger.io/dagger/install.sh | sh

...
dire escarp
#

If you want we could jump over dev-audio and pair on this.

silver wraith
#

It would be amazing, I will grabe something to eat and we can see that this afternoon if this is ok for you ?

dire escarp
#

sure ๐Ÿ‘ , I'm planning to go outside of the office in the afternoon but I'm sure we can find a suitable time

silver wraith
#

Hey I'm available if you want @dire escarp

dire escarp
#

@silver wraith I have 20~30 min free time if you're available

silver wraith
#

Still available @dire escarp, I'm now

silver wraith
#

Thanks for the help @dire escarp , now when running a pod and the daemonset and get this:

new client: remote is not a valid dagger server (expected "github.com/dagger/dagger", got "dagger-dagger-helm-engine-9nl4g")

Not sure if I need to override the name of the daemonset but it seems weird to do that

errant fox
errant fox
#

Perhaps you can try with this PR and see if it fixes your issue ๐Ÿ™

oblique rapids
#

@silver wraith can you check that the image tag is using dagger 0.9.0 or higher?

half crow
#

cc @silver wraith you need to bump your helmchart image match your dagger version in your code/CLI

silver wraith
#

Ok thx, will try that and keep you up to date

silver wraith
#

It finally seems to be working like that thank you all !

#

A small question on this but if I have 10 workers using only 2 dagger engine is it ok ?

half crow
#

since the way the helm chart is designed is for the engines to run as a DaemonSet and connect via unix socket which will require all dagger jobs/pods to be scheduled in worker nodes where that DaemonSet is present

silver wraith
#

By the way I'm receiving a lot of this error any idea how it could happen ?
UnknownDaggerError: Encountered an unknown error while requesting data via graphql

half crow
silver wraith
#

Just double checked and I don't see anything not awaited

errant fox
#

Not getting those errors so much. Did setup like this.
In a new directory with your build.mts in there:

npm install ts-node typescript --save-dev
npx tsc --init --module esnext --moduleResolution nodenext
npm install @dagger.io/dagger@latest --save-dev
dagger run node --loader ts-node/esm ./build.mts
#
[1.81s] exec docker-entrypoint.sh sh -c npm run build; echo -n $? > ./exit_code
โ”ƒ npm ERR! Missing script: "build"
โ”ƒ npm ERR!
โ”ƒ npm ERR! To see a list of scripts, run:
โ”ƒ npm ERR!   npm run
โ”ƒ
โ”ƒ npm ERR! A complete log of this run can be found in: /app/.npm/_logs/2023-11-24T20_40_35_295Z-debu
โ”ƒ g-0.log
โ–ˆ [0.09s] exec docker-entrypoint.sh echo Build failed
โ”ƒ Build failed
โ–ˆ [0.09s] exec docker-entrypoint.sh cat ./tmp/logs
โ”ƒ npm ERR! Missing script: "build"
โ”ƒ npm ERR!
โ”ƒ npm ERR! To see a list of scripts, run:
โ”ƒ npm ERR!   npm run
โ”ƒ
โ”ƒ npm ERR! A complete log of this run can be found in: /app/.npm/_logs/2023-11-24T20_40_35_295Z-debu
โ”ƒ g-0.log
โ–ˆ [0.01s] export file /app/tmp/logs to host ./logs.log
โ–ˆ [8.78s] ERROR node --loader ts-node/esm ./build.mts
โ”ƒ (node:958) ExperimentalWarning: Custom ESM Loaders is an experimental feature and might change a
โ”ƒ any time
โ”ƒ (Use `node --trace-warnings ...` to show where the warning was created)
โ”ƒ Running test...
โ”ƒ Build Graphql Runner error: GraphQLRequestError: lstat /app/bun.lockb: no such file or directory
โ–ˆ [0.00s] ERROR file(path: "./bun.lockb")
โ”ป
โ€ข Engine: 3b6f7d2772be (version v0.9.3)
โง— 10.06s โœ” 48 โˆ… 1 โœ˜ 2
exit status 1
#

but I don't have a "build" script in my package.json

silver wraith
#

By the way I run it with dagger run bun ./build.mts do you think it can be related ?

errant fox
#

ah. could be.
I just cleared all errors incrementally (with no other objective than to clear errors ๐Ÿ˜† ) by:

  • adding a dummy build script "scripts": { "build": "echo build; exit 0" }
  • adding needed directory mkdir dist
  • adding file that was complained about touch ./bun.lockb

Maybe that will help you find the issue...

I know we haven't tested our Node.js SDK with Bun, Deno, etc, though some folks have made various things work for them.

half crow
#

@silver wraith oh, you're using bun? Well.. that might explain some things

#

can you try if that happens with node?

silver wraith
#

Yes I'm making the change and trying to see if I see the same errors

silver wraith
#

Oh never updated sorry
Everything working fine now, it seems that bun is not working

half crow
#

Creating a bun channel in the Dagger AND... section. cc @native pine

woven fable
#

Here is a list of commands to:

  1. One line install of Dagger Engine to K8s (currently v0.9.3, which is latest released)
  2. Run a module in the Dagger Engine on K8s
  3. Downgrade to Dagger Engine v0.9.2-gpu (there is no v0.9.4 to upgrade just yet)
  4. Run the same module in the downgraded Dagger Engine
  5. Clean everything up

Let me know if this is helpful to you @silver wraith

Thanks @errant fox for helloSecret! FWIW https://daggerverse.dev/mod/github.com/jpadams/daggerverse/helloSecret@68b6243b2e981126dbd397d836776573efae0d6e

#

I'm curious what would be more interesting as a next step for you @silver wraith?
A. Expand the above into a blog post on https://dagger.io/blog
B. Record a short video (2-3 mins)