Skip to content

Commit

Permalink
chore(dev-environment): Add Docker Compose and script for local testi…
Browse files Browse the repository at this point in the history
…ng environment (#595)

Signed-off-by: instamenta <[email protected]>
  • Loading branch information
instamenta authored Sep 18, 2024
1 parent a6954d0 commit 3a8fceb
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 0 deletions.
54 changes: 54 additions & 0 deletions solo-compose/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
services:
# Init Containers

init-dind-externals:
image: "ghcr.io/hashgraph/runner-images/scaleset-runner:ubuntu-22.04"
platform: linux/amd64
command: [ "sudo", "sh", "-c", "chmod -R 777 /home/runner/tmpDir && cp -r /home/runner/externals/. /home/runner/tmpDir/" ]
privileged: true
volumes:
- dind-externals:/home/runner/tmpDir
depends_on:
- dind

init-work-directory:
image: "ghcr.io/hashgraph/runner-images/scaleset-runner:ubuntu-22.04"
command: [ "cp", "-r", "/home/runner/.", "/tmp/work/" ]
platform: linux/amd64
privileged: true
volumes:
- work:/tmp/work
depends_on:
- runner

# Containers

runner:
image: "ghcr.io/hashgraph/runner-images/scaleset-runner:ubuntu-22.04"
command: [ "/usr/bin/env", "bash", "/home/runner/setup-runner.sh" ]
platform: linux/amd64
environment:
- DOCKER_HOST=unix:///var/run/solo-compose.sock
privileged: true
volumes:
- work:/home/runner/_work
- dind-sock:/var/run
- type: bind
source: setup-runner.sh
target: /home/runner/setup-runner.sh

dind:
image: "docker:20.10-dind"
command: [ "dockerd", "--host=unix:///var/run/solo-compose.sock", "--group=123", "--registry-mirror=https://hub.mirror.solo-compose.lat.ope.eng.hashgraph.io" ]
environment:
- DOCKER_GROUP_GID=123
privileged: true
volumes:
- work:/home/runner/_work
- dind-sock:/var/run
- dind-externals:/home/runner/externals

volumes:
work:
dind-sock:
dind-externals:
60 changes: 60 additions & 0 deletions solo-compose/setup-runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#! /usr/bin/env bash

BRANCH_NAME="main"

# Clone repository
echo "***** Setting up Solo Repository *****"

git clone https://github.com/hashgraph/solo.git solo
cd ./solo || exit
git checkout "${BRANCH_NAME}"

# Dependencies Versions
NODE_VERSION="20.17.0"
KIND_VERSION="v0.22.0"
HELM_VERSION="3.15.4"

echo "***** Setup *****"

# Setup Corepack
sudo ln -s /home/runner/_work/_tool/node/${NODE_VERSION}/x64/bin/corepack /usr/bin/corepack
echo "Corepack setup completed."

# Setup NPM
sudo ln -s /home/runner/_work/_tool/node/${NODE_VERSION}/x64/bin/npm /usr/bin/npm
echo "NPM setup completed."

# Setup NPX
sudo ln -s /home/runner/_work/_tool/node/${NODE_VERSION}/x64/bin/npx /usr/bin/npx
echo "NPX setup completed."

# Setup Node.js
sudo ln -s /home/runner/_work/_tool/node/${NODE_VERSION}/x64/bin/node /usr/bin/node
echo "Node.js setup completed."

# Setup Kind
sudo ln -s /home/runner/_work/_tool/kind/${KIND_VERSION}/amd64/kind /usr/bin/kind
echo "Kind setup completed."

# Setup Kubectl
sudo ln -s /home/runner/_work/_tool/kind/${KIND_VERSION}/amd64/kubectl /usr/bin/kubectl
echo "Kubectl setup completed."

# Setup Helm
sudo ln -s /home/runner/_work/_tool/helm/${HELM_VERSION}/x64/linux-amd64/helm /usr/bin/helm
echo "Helm setup completed."

# Install Dependencies
echo "Installing dependencies..."
npm ci
echo "Dependencies installed successfully."

#####################################################

# Example
npm run test

#####################################################

# Prevent Service from exiting
/usr/bin/env sleep infinity

0 comments on commit 3a8fceb

Please sign in to comment.