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

feat: Upgrade to bacalhau 1.6 #441

Merged
merged 22 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from 20 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
38 changes: 24 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,38 @@ jobs:
- name: Install node
uses: actions/setup-node@v4

- name: Build Docker Images
run: ./stack compose-build
- name: Build Base Docker Images
run: ./stack compose-build-services

- name: Initialize chain
run: ./stack compose-init

- name: Run stack
env:
DISABLE_TELEMETRY: true
API_HOST: ""
run: ./stack compose-up -d
- name: Start base services
run: |
./stack compose-services -d
sleep 5

- name: Run tests
env:
LOG_LEVEL: debug
run: ./stack integration-tests
- name: Start solver
run: |
./stack solver --disable-telemetry=true --api-host="" > solver.log &
sleep 5

- name: Display resource provider logs
run: docker logs resource-provider
- name: Run solver integration tests
run: ./stack integration-tests-solver

- name: Start resource provider
run: |
./stack resource-provider --disable-telemetry=true --api-host="" > resource-provider.log &
sleep 5

- name: Run main integration tests
run: ./stack integration-tests
Comment on lines +53 to +67
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This staged set of integration tests allows us to run solver tests without having resource offers being added by an RP. This will be important for #462 e.g.


- name: Display solver logs
run: docker logs solver
run: cat solver.log

- name: Display resource provider logs
run: cat resource-provider.log

- name: Display chain logs
run: docker logs chain
5 changes: 4 additions & 1 deletion .local.dev
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ WEB3_PAYMENTS_ADDRESS=0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6
WEB3_POW_ADDRESS_=0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1
WEB3_STORAGE_ADDRESS_=0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e
WEB3_TOKEN_ADDRESS_=0xa513E6E4b8f2a923D98304ec87F64353C4D5C853
WEB3_USERS_ADDRESS=0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82
WEB3_USERS_ADDRESS=0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82
BACALHAU_API_HOST=localhost
BACALHAU_API_PORT=1234

9 changes: 1 addition & 8 deletions cmd/lilypad/mediator.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package lilypad

import (
"fmt"

"github.com/lilypad-tech/lilypad/pkg/executor/bacalhau"
"github.com/lilypad-tech/lilypad/pkg/ipfs"
"github.com/lilypad-tech/lilypad/pkg/mediator"
optionsfactory "github.com/lilypad-tech/lilypad/pkg/options"
"github.com/lilypad-tech/lilypad/pkg/system"
Expand Down Expand Up @@ -48,12 +45,8 @@ func runMediator(cmd *cobra.Command, options mediator.MediatorOptions) error {
return err
}

ipfsClient, err := ipfs.NewClient(commandCtx.Ctx, options.IPFS.Addr)
if err != nil {
return fmt.Errorf("error creating IPFS client: %s", err.Error())
}

executor, err := bacalhau.NewBacalhauExecutor(options.Bacalhau, ipfsClient)
executor, err := bacalhau.NewBacalhauExecutor(options.Bacalhau)
if err != nil {
return err
}
Expand Down
10 changes: 1 addition & 9 deletions cmd/lilypad/resource-provider.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package lilypad

import (
"fmt"

"github.com/lilypad-tech/lilypad/pkg/executor/bacalhau"
"github.com/lilypad-tech/lilypad/pkg/ipfs"
optionsfactory "github.com/lilypad-tech/lilypad/pkg/options"
"github.com/lilypad-tech/lilypad/pkg/resourceprovider"
"github.com/lilypad-tech/lilypad/pkg/system"
Expand Down Expand Up @@ -53,12 +50,7 @@ func runResourceProvider(cmd *cobra.Command, options resourceprovider.ResourcePr
return err
}

ipfsClient, err := ipfs.NewClient(commandCtx.Ctx, options.IPFS.Addr)
if err != nil {
return fmt.Errorf("error creating IPFS client: %s", err.Error())
}

executor, err := bacalhau.NewBacalhauExecutor(options.Bacalhau, ipfsClient)
executor, err := bacalhau.NewBacalhauExecutor(options.Bacalhau)
if err != nil {
return err
}
Expand Down
4 changes: 1 addition & 3 deletions cmd/lilypad/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ func runJob(cmd *cobra.Command, options jobcreator.JobCreatorOptions, network st
os.Exit(1)
}

// UPDATE FUNCTION
// fmt.Printf("evOffer: %s --------------------------------------\n")
// spew.Dump(evOffer)


})
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions docker/bacalhau/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ RUN mkdir -pm755 /etc/apt/keyrings && curl -o /etc/apt/keyrings/docker.asc -fsSL
RUN nvidia-ctk runtime configure --runtime=docker --set-as-default

# Install Bacalhau
ADD https://github.com/bacalhau-project/bacalhau/releases/download/v1.3.2/bacalhau_v1.3.2_linux_amd64.tar.gz .
RUN tar xfv bacalhau_v1.3.2_linux_amd64.tar.gz
ADD https://github.com/bacalhau-project/bacalhau/releases/download/v1.6.0/bacalhau_v1.6.0_linux_amd64.tar.gz .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

RUN tar xfv bacalhau_v1.6.0_linux_amd64.tar.gz
RUN mv bacalhau /usr/local/bin

ADD https://raw.githubusercontent.com/moby/moby/refs/heads/master/hack/dind /usr/local/bin/dind
Expand Down
29 changes: 3 additions & 26 deletions docker/docker-compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,11 @@ services:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=solver-db
ipfs:
image: ipfs/kubo:v0.32.1
container_name: ipfs
restart: unless-stopped
ports:
- 127.0.0.1:5001:5001
- 127.0.0.1:8080:8080
volumes:
- ipfs-data:/data/ipfs
bacalhau:
image: ghcr.io/lilypad-tech/bacalhau
container_name: bacalhau
restart: unless-stopped
privileged: true
depends_on:
ipfs:
condition: service_healthy
build:
context: ..
dockerfile: ./docker/bacalhau/Dockerfile
Expand All @@ -74,23 +62,12 @@ services:
- BACALHAU_ENVIRONMENT=local
ports:
- 1234:1234
command:
[
"bacalhau",
"serve",
"--node-type",
"compute,requester",
"--peer",
"none",
"--private-internal-ipfs=false",
"--job-selection-accept-networked",
"--ipfs-connect",
"/dns4/ipfs/tcp/5001",
]
- 6001:6001
command: ["bacalhau", "serve", "--orchestrator", "--compute"]
volumes:
- bacalhau-data:/root/.bacalhau
volumes:
bacalhau-data:
chain-data:
ipfs-data:
bacalhau-data:
postgres-data:
2 changes: 0 additions & 2 deletions docker/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ services:
container_name: resource-provider
restart: unless-stopped
depends_on:
ipfs:
condition: service_healthy
solver:
condition: service_healthy
bacalhau:
Expand Down
28 changes: 2 additions & 26 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,16 @@
# This is a docker-compose file for use by Resource Providers
services:
ipfs:
image: ipfs/kubo:v0.32.1
container_name: ipfs
restart: unless-stopped
ports:
- 4001:4001
- 127.0.0.1:5001:5001
- 127.0.0.1:8080:8080
volumes:
- ipfs-data:/data/ipfs
bacalhau:
image: ghcr.io/lilypad-tech/bacalhau
container_name: bacalhau
restart: unless-stopped
privileged: true
depends_on:
ipfs:
condition: service_healthy
build:
context: ..
dockerfile: ./docker/bacalhau/Dockerfile
environment:
- BACALHAU_ENVIRONMENT=local
command:
[
"bacalhau",
"serve",
"--node-type",
"compute,requester",
"--peer",
"none",
"--private-internal-ipfs=false",
"--job-selection-accept-networked",
"--ipfs-connect",
"/dns4/ipfs/tcp/5001",
]
command: ["bacalhau", "serve", "--orchestrator", "--compute"]
volumes:
- bacalhau-data:/root/.bacalhau
resource-provider:
Expand All @@ -51,6 +26,7 @@ services:
- COMPUTE_MODE=gpu
volumes:
- lilypad-data:/tmp/lilypad/data
- bacalhau-data:/root/.bacalhau
environment:
- WEB3_PRIVATE_KEY
- WEB3_RPC_URL
Expand Down
13 changes: 1 addition & 12 deletions docker/resource-provider/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG COMPUTE_MODE=gpu

FROM golang:1.22.4 AS base
FROM golang:latest AS base
WORKDIR /usr/src/app
ARG NETWORK=testnet
ARG VERSION
Expand Down Expand Up @@ -33,24 +33,13 @@ RUN mv lilypad /usr/local/bin
# Install necessary dependencies
RUN apt update && apt install -y wget bash curl && apt clean

# Install Bacalhau
RUN cd /tmp && \
wget https://github.com/bacalhau-project/bacalhau/releases/download/v1.3.2/bacalhau_v1.3.2_linux_amd64.tar.gz && \
tar xfv bacalhau_v1.3.2_linux_amd64.tar.gz && \
mv bacalhau /usr/local/bin/bacalhau && \
rm bacalhau_v1.3.2_linux_amd64.tar.gz

Comment on lines -36 to -42
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the http API means we no longer need to also have the bacalhau CLI installed here

# Add both lilypad and bacalhau executables to PATH
ENV PATH="/usr/local/bin:${PATH}"

# Create a startup script to run both services simultaneously
RUN touch run
RUN echo "#!/bin/bash" >> run

# Ensure bacalhau is initialized
RUN echo "export BACALHAU_ENVIRONMENT=local" >> run
RUN echo "bacalhau id" >> run

# Launch Lilypad
RUN echo "/usr/local/bin/lilypad resource-provider --network ${NETWORK} --disable-pow=${DISABLE_POW} --disable-telemetry=${DISABLE_TELEMETRY} &" >> run
RUN echo "wait -n" >> run
Expand Down
Loading
Loading