Skip to content

Commit

Permalink
docker + log fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
walkah committed Dec 10, 2024
1 parent 710e9fa commit cb27d88
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 103 deletions.
5 changes: 3 additions & 2 deletions .local.dev
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# posting your private keys in your commits/PRs. Unless you have a very good reason to do so,
# leave the `.local.dev` file unchanged.

API_HOST=http://localhost:8002/
# API_HOST=http://localhost:8002/
API_HOST=""
WEB3_RPC_URL=ws://localhost:8548
SERVER_PORT=8081
SERVER_URL=http://localhost:8081
Expand All @@ -28,6 +29,6 @@ WEB3_STORAGE_ADDRESS_=0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e
WEB3_TOKEN_ADDRESS_=0xa513E6E4b8f2a923D98304ec87F64353C4D5C853
WEB3_USERS_ADDRESS=0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82
BACALHAU_API_HOST=localhost
BACALHAU_API_PORT=20000
BACALHAU_API_PORT=1234
JOB_STATUS_POLL_INTERVAL=5

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.5.1/bacalhau_v1.5.1_linux_amd64.tar.gz .
RUN tar xfv bacalhau_v1.5.1_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
28 changes: 2 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,21 +62,9 @@ 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",
]
command: ["bacalhau", "serve", "--orchestrator", "--compute"]
volumes:
- bacalhau-data:/root/.bacalhau
- ${HOME}/.bacalhau:/root/.bacalhau
volumes:
chain-data:
ipfs-data:
Expand Down
3 changes: 1 addition & 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 All @@ -68,6 +66,7 @@ services:
- "localhost:host-gateway"
volumes:
- lilypad-data:/tmp/lilypad/data
- ${HOME}/.bacalhau:/root/.bacalhau
environment:
- WEB3_PRIVATE_KEY=${RESOURCE_PROVIDER_PRIVATE_KEY}
- IPFS_CONNECT=/dns4/ipfs/tcp/5001
Expand Down
25 changes: 2 additions & 23 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
# 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
Expand All @@ -23,19 +13,7 @@ services:
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 +29,7 @@ services:
- COMPUTE_MODE=gpu
volumes:
- lilypad-data:/tmp/lilypad/data
- bacalhau-data:/root/.bacalhau
environment:
- WEB3_PRIVATE_KEY
- WEB3_RPC_URL
Expand Down
16 changes: 8 additions & 8 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 @@ -34,11 +34,11 @@ RUN mv lilypad /usr/local/bin
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
# 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

# Add both lilypad and bacalhau executables to PATH
ENV PATH="/usr/local/bin:${PATH}"
Expand All @@ -48,8 +48,8 @@ RUN touch run
RUN echo "#!/bin/bash" >> run

# Ensure bacalhau is initialized
RUN echo "export BACALHAU_ENVIRONMENT=local" >> run
RUN echo "bacalhau id" >> run
# 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
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/lilypad-tech/lilypad

go 1.23

toolchain go1.23.2
toolchain go1.23.3

require (
github.com/BurntSushi/toml v0.3.1
Expand Down
4 changes: 2 additions & 2 deletions pkg/options/bacalhau.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

func GetDefaultBacalhauOptions() bacalhau.BacalhauExecutorOptions {
return bacalhau.BacalhauExecutorOptions{
ApiHost: GetDefaultServeOptionString("BACALHAU_API_HOST", "localhost"),
ApiPort: GetDefaultServeOptionString("BACALHAU_API_PORT", "20000"),
ApiHost: GetDefaultServeOptionString("BACALHAU_API_HOST", "localhost"),
ApiPort: GetDefaultServeOptionString("BACALHAU_API_PORT", "1234"),
JobStatusPollInterval: GetDefaultServeOptionUint64("JOB_STATUS_POLL_INTERVAL", 5),
}
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/system/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"os"
"time"

"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)
Expand Down Expand Up @@ -49,6 +50,7 @@ func SetupLogging() {
logLevel = parsedLogLevel
}
zerolog.CallerSkipFrameCount = 3 // Skip 3 frames (this function, log.Output, log.Logger)
zerolog.SetGlobalLevel(logLevel)
log.Logger = log.Output(output).With().Caller().Logger().Level(logLevel)
}

Expand Down
36 changes: 0 additions & 36 deletions stack
Original file line number Diff line number Diff line change
Expand Up @@ -305,42 +305,6 @@ function integration-tests() {
go test -v -tags="integration" -count 1 ./...
}

############################################################################
# run
#
# Note: The presence of the WEB3_PRIVATE_KEY here is only necessary for local development. You are advised not to import this key into a wallet nor use it for anything other for testing Lilypad locally
############################################################################
function dev1(){
export DISABLE_TELEMETRY=true
chain-clean
echo "========CHAIN CLEANED========"
clear
echo "========CHAIN========"
chain
}

function dev2(){
export DISABLE_TELEMETRY=true
echo "========BOOTING UP CHAIN========"
chain-boot
echo "========CHAIN BOOTED========"
clear
echo "========SOLVER========"
solver
}
function dev3(){
export DISABLE_TELEMETRY=true
echo "========BACALHAU EXECUTOR========"
bacalhau-node
}

function dev4(){
export DISABLE_TELEMETRY=true
echo "========RESOURCE PROVIDER========"
resource-provider
}


############################################################################
# run
#
Expand Down
2 changes: 1 addition & 1 deletion test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func TestNoModeration(t *testing.T) {
})

assert.NoError(t, err, "there was an error running the job")
assert.Equal(t, "QmbCi3yoKzckff24rUJML1ZesVb35cd2LUNMiMYksEGkWv", result.Result.DataID, "the data ID was correct")
assert.Equal(t, "bafkreie2v6u2wyd6p7ke4itufngshkmgzppwulakfvrmkb5bibcqk5qjgy", result.Result.DataID, "the data ID was correct")

localPath := solver.GetDownloadsFilePath(result.Result.DealID)
fmt.Printf("local path: %s\n", localPath)
Expand Down

0 comments on commit cb27d88

Please sign in to comment.