-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to ubuntu 22.04 from ChainGaurd docker image (#4725)
We were using nvidia-device-plugin ChainGuard base image to build our docker images, but they have made the their images not public anymore. We will switch to Ubuntu 24.04 LTS image. In this PR, an integration test was added that uses the Ubuntu 24.04 LTS image for the test. Linear: https://linear.app/expanso/issue/ENG-398/add-ubuntu-2404-as-the-base-image-for-published-docker-images <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new Docker Compose configuration for orchestrating services, including `bacalhau-orchestrator-node` and `bacalhau-jumpbox-node`. - Added a basic orchestrator configuration file with API settings and authentication tokens. - New test suite for the Ubuntu orchestrator configuration to validate node listing functionality. - Updated Dockerfile for the orchestrator node to ensure proper setup and integration test readiness with Ubuntu 24.04. - **Chores** - Changed the base image of the Dockerfile to Ubuntu 24.04 for improved compatibility and performance. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
Showing
6 changed files
with
155 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
test_integration/10_ubuntu_orchestrator_basic_suite_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package test_integration | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/google/uuid" | ||
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
type UbuntuOrchestratorBasicConfigSuite struct { | ||
BaseDockerComposeTestSuite | ||
} | ||
|
||
func NewUbuntuOrchestratorBasicConfigSuite() *UbuntuOrchestratorBasicConfigSuite { | ||
s := &UbuntuOrchestratorBasicConfigSuite{} | ||
s.GlobalRunIdentifier = globalTestExecutionId | ||
s.SuiteRunIdentifier = strings.ToLower(strings.Split(uuid.New().String(), "-")[0]) | ||
return s | ||
} | ||
|
||
func (s *UbuntuOrchestratorBasicConfigSuite) SetupSuite() { | ||
rawDockerComposeFilePath := "./common_assets/docker_compose_files/orchestrator-ubuntu-node-with-custom-start-command.yml" | ||
s.Context, s.Cancel = context.WithCancel(context.Background()) | ||
|
||
orchestratorConfigFile := s.commonAssets("nodes_configs/10_basic_orchestrator_config.yaml") | ||
orchestratorStartCommand := fmt.Sprintf("bacalhau serve --config=%s", orchestratorConfigFile) | ||
extraRenderingData := map[string]interface{}{ | ||
"OrchestratorStartCommand": orchestratorStartCommand, | ||
"OrchestratorImageName": fmt.Sprintf("bacalhau-test-ubuntu-orchestrator-%s:%s", s.GlobalRunIdentifier, s.GlobalRunIdentifier), | ||
} | ||
s.BaseDockerComposeTestSuite.SetupSuite(rawDockerComposeFilePath, extraRenderingData) | ||
} | ||
|
||
func (s *UbuntuOrchestratorBasicConfigSuite) TearDownSuite() { | ||
s.T().Log("Tearing down [Test Suite] in UbuntuOrchestratorBasicConfigSuite...") | ||
s.BaseDockerComposeTestSuite.TearDownSuite() | ||
} | ||
|
||
func (s *UbuntuOrchestratorBasicConfigSuite) TestNodesCanBeListed() { | ||
nodeListOutput, err := s.executeCommandInDefaultJumpbox( | ||
[]string{ | ||
"bacalhau", "node", "list", "--output=json", | ||
}, | ||
) | ||
s.Require().NoErrorf(err, "Error listing nodes: %q", err) | ||
|
||
output, err := s.convertStringToDynamicJSON(nodeListOutput) | ||
s.Require().NoError(err) | ||
|
||
nodeList, err := output.Query("$") | ||
s.Require().NoError(err) | ||
s.Require().Equal(1, len(nodeList.Array())) | ||
|
||
nodeInfo, err := output.Query("$[0].Info.NodeType") | ||
s.Require().NoError(err) | ||
s.Require().Equal("Requester", nodeInfo.String()) | ||
|
||
label1Value, err := output.Query("$[0].Info.Labels.label1") | ||
s.Require().NoError(err) | ||
s.Require().Equal("label1Value", label1Value.String()) | ||
label2Value, err := output.Query("$[0].Info.Labels.label2") | ||
s.Require().NoError(err) | ||
s.Require().Equal("label2Value", label2Value.String()) | ||
} | ||
|
||
func TestUbuntuOrchestratorBasicConfigSuite(t *testing.T) { | ||
suite.Run(t, NewUbuntuOrchestratorBasicConfigSuite()) | ||
} |
40 changes: 40 additions & 0 deletions
40
...common_assets/docker_compose_files/orchestrator-ubuntu-node-with-custom-start-command.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
x-common-env-variables: &common-env-variables | ||
NETWORK_AUTH_TOKEN: "i_am_very_secret_token" | ||
BACALHAU_API_PORT: "1234" | ||
BACALHAU_UPDATECONFIG_INTERVAL: "0" | ||
BACALHAU_DISABLEANALYTICS: true | ||
|
||
networks: | ||
bacalhau-network: | ||
driver: bridge | ||
|
||
services: | ||
bacalhau-orchestrator-node: | ||
image: {{ .OrchestratorImageName }} | ||
networks: | ||
- bacalhau-network | ||
environment: *common-env-variables | ||
privileged: true | ||
command: | ||
- /bin/bash | ||
- -c | ||
- | | ||
{{ .OrchestratorStartCommand }} | ||
healthcheck: | ||
test: [ "CMD-SHELL", "nc -zv localhost 1234" ] | ||
interval: 1s | ||
timeout: 5s | ||
retries: 30 | ||
# Need to increase the time since ubuntu container takes a bit longer to start | ||
start_period: 20s | ||
|
||
bacalhau-jumpbox-node: | ||
image: {{ .JumpboxImageName }} | ||
privileged: true | ||
command: tail -f /dev/null | ||
restart: unless-stopped | ||
networks: | ||
- bacalhau-network | ||
environment: | ||
<<: *common-env-variables | ||
BACALHAU_API_HOST: 'bacalhau-orchestrator-node' |
24 changes: 24 additions & 0 deletions
24
test_integration/common_assets/dockerfiles/Dockerfile-UbuntuOrchestratorNode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM ubuntu:24.04 | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
RUN apt update && apt install -y \ | ||
bash \ | ||
netcat-traditional \ | ||
ca-certificates \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy a root ca into the image | ||
COPY ./common_assets/certificates/generated_assets/bacalhau_test_root_ca.crt /usr/local/share/ca-certificates/bacalhau_test_root_ca.crt | ||
|
||
# Update CA certificates | ||
RUN update-ca-certificates | ||
|
||
# Copy Tests Assets | ||
RUN mkdir -p /bacalhau_integration_tests | ||
COPY ./ /bacalhau_integration_tests | ||
|
||
COPY ./common_assets/bacalhau_bin /usr/local/bin/bacalhau | ||
RUN chown root:root /usr/local/bin/bacalhau && \ | ||
chmod 755 /usr/local/bin/bacalhau |
10 changes: 10 additions & 0 deletions
10
test_integration/common_assets/nodes_configs/10_basic_orchestrator_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
NameProvider: "uuid" | ||
API: | ||
Port: 1234 | ||
Orchestrator: | ||
Enabled: true | ||
Auth: | ||
Token: "i_am_very_secret_token" | ||
Labels: | ||
label1: label1Value | ||
label2: label2Value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters