Skip to content

Commit

Permalink
COSI-17: add-dev-container-for-sodi-driver
Browse files Browse the repository at this point in the history
- the container sets up minikube, s3 and iam services.
  • Loading branch information
anurag4DSB committed Nov 13, 2024
1 parent 9e51a25 commit e69f1fb
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/go
{
"name": "Go Dev Container",
"image": "mcr.microsoft.com/devcontainers/go:1-1.23-bookworm",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/go:1": {
"version": "latest"
},
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
"moby": true
},
"ghcr.io/devcontainers/features/aws-cli:1": {},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"version": "1.31",
"helm": "latest",
"minikube": "latest"
}
},
"forwardPorts": [8000, 8600],
"customizations": {
"codespaces": {
"repositories": {
"scality/cloudserver": {
"permissions": {
"packages": "read"
}
},
"scality/vault": {
"permissions": {
"packages": "read"
}
}
}
}
},
"postCreateCommand": "bash .devcontainer/setup-dev-container.sh"
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
33 changes: 33 additions & 0 deletions .devcontainer/setup-dev-container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

echo "Installing Ginkgo and Gomega..."
go install github.com/onsi/ginkgo/v2/ginkgo
go get github.com/onsi/gomega/...

# Create a KIND cluster
echo "Starting Minikube..."
minikube start

echo "Logging into GHCR (GitHub Container Registry)..."
echo "$REPOSITORY_USER_TOKEN" | docker login ghcr.io -u "$REPOSITORY_USER" --password-stdin

# Navigate to the directory and prepare the environment
echo "Preparing S3 and IAM log and directories..."
cd .github/s3_and_iam_deployment && \
mkdir -p logs/s3 logs/iam logs/cosi_driver data/vaultdb && \
sudo chown -R vscode:vscode logs data && \
chmod -R ugo+rwx logs data && \

# Start Docker Compose for the 'iam_s3' profile
echo "Deploying S3 and IAM using docker compose..."
docker compose --profile iam_s3 up -d

# Set Minikube's Docker environment variables
eval $(minikube docker-env)

# Prune Docker on Minikube's Docker Daemon
echo "Pruning unused images..."
docker images
docker system prune -af

echo "Setup complete."

0 comments on commit e69f1fb

Please sign in to comment.