Skip to content

Commit

Permalink
Merge pull request #5 from omnivector-solutions/add_environment_arg
Browse files Browse the repository at this point in the history
Add environment arg
  • Loading branch information
jamesbeedy authored Mar 7, 2024
2 parents b0b7573 + b6513f3 commit ef98344
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,18 @@

This project contains the democluster image producing codebase.


#### Tuning
The environment variables `JG_VERSION` and `ENV` are exposed as tunables
to enable customizing the `democluster` for development purposes.

Example
```bash
ENV=dev JG_VERSION=4.3.1 \
./public-scripts/deploy-democluster.sh \
aset-fc8b1039-faa7-47b1-967a-c1a55c418740 \
9mWa98GbTJMcBZhinfy08aqHPyQWZUn7tH_XrAGLiYE
```

###### Copyright
Omnivector &copy; 2024 <admin@omnivector.soloutions>
12 changes: 7 additions & 5 deletions public-scripts/deploy-democluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

CLIENT_ID=$1
CLIENT_SECRET=$2
ENVIRONMENT=$3
CLOUD_IMAGE_URL=https://omnivector-public-assets.s3.us-west-2.amazonaws.com/cloud-images/democluster/latest/democluster.img
CLOUD_IMAGE_DEST=/tmp/democluster.img

Expand All @@ -62,14 +61,12 @@ launch_instance () {
fi

# Set the environment to the empty string if not supplied
if [ -z $3 ]; then
if [ -z $ENV ]; then
ENVIRONMENT=""
else
ENVIRONMENT="${3}."
ENVIRONMENT="${ENV}."
fi

echo "$ENVIRONMENT"

# Create the cloud-init file and launch the demo cluster instance.
cat <<EOF > /tmp/cloud-init.yaml
#cloud-config
Expand Down Expand Up @@ -107,6 +104,11 @@ runcmd:
- systemctl start jobbergate-agent
EOF

if [ -n $JG_VERSION ]; then
echo " - systemctl stop jobbergate-agent" >> /tmp/cloud-init.yaml
echo " - /srv/jobbergate-agent-venv/bin/pip install -U jobbergate-agent==$JG_VERSION" >> /tmp/cloud-init.yaml
echo " - systemctl start jobbergate-agent" >> /tmp/cloud-init.yaml
fi
mkdir -p $HOME/democluster/tmp

cat /tmp/cloud-init.yaml | multipass launch -c$(nproc) \
Expand Down

0 comments on commit ef98344

Please sign in to comment.