Skip to content

Commit

Permalink
chore(dev): add SSH_USER and SSH_HOST
Browse files Browse the repository at this point in the history
  • Loading branch information
bas-kirill committed Aug 29, 2024
1 parent 86bad45 commit 328cbb3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ jobs:
- name: Deploy at home lab
run: echo "$(pwd)" && ./tools/scripts/deploy.sh dev
env:
SSH_USER: ${{ secrets.SSH_USER }}
SSH_HOST: ${{ secrets.SSH_HOST }}
MUSE_DOCKER_DEFAULT_CONTEXT: default
MUSE_JWT_SECRET_KEY: ${{ secrets.MUSE_JWT_SECRET_KEY }}
CI: false # https://stackoverflow.com/questions/34917977/disable-npm-warnings-as-errors-build-definition-tfs
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ docker context use "${MUSE_DOCKER_DEFAULT_CONTEXT}"
if [ "$stage" != "local" ]; then
context_name=muse-deploy-server
if ! docker context ls --format '{{.Name}}' | grep -q "^${context_name}$"; then
docker context create "${context_name}" --description "[MUSE] Deploy Server" --docker "host=ssh://[email protected]"
docker context create "${context_name}" --description "[MUSE] Deploy Server" --docker "host=ssh://${SSH_USER}@${SSH_HOST}"
fi

docker context use muse-deploy-server
Expand Down
4 changes: 3 additions & 1 deletion tools/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ rootDir="$currentDir/../../"

[[ -z "${MUSE_DOCKER_DEFAULT_CONTEXT}" ]] && { echo "'MUSE_DOCKER_DEFAULT_CONTEXT' is not set. Exiting."; exit 1; }
[[ -z "${MUSE_JWT_SECRET_KEY}" ]] && { echo "'MUSE_JWT_SECRET_KEY' is not set. Exiting."; exit 1; }
[[ -z "${SSH_USER}" ]] && { echo "'SSH_USER' is not set. Exiting."; exit 1; }
[[ -z "${SSH_HOST}" ]] && { echo "'SSH_HOST' is not set. Exiting."; exit 1; }

trap 'docker context use "${MUSE_DOCKER_DEFAULT_CONTEXT}"' EXIT

Expand Down Expand Up @@ -32,7 +34,7 @@ fi
if [ "$stage" != "local" ]; then
context_name=muse-$stage
if ! docker context ls --format '{{.Name}}' | grep -q "^${context_name}$"; then
docker context create "${context_name}" --description "[MUSE] '$stage' Deploy Server" --docker "host=ssh://[email protected]"
docker context create "${context_name}" --description "[MUSE] '$stage' Deploy Server" --docker "host=ssh://${SSH_USER}@${SSH_HOST}"
fi

docker context use "$context_name"
Expand Down
4 changes: 3 additions & 1 deletion tools/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ rootDir="$currentDir/../../"

[[ -z "${MUSE_DOCKER_DEFAULT_CONTEXT}" ]] && { echo "'MUSE_DOCKER_DEFAULT_CONTEXT' is not set. Exiting."; exit 1; }
[[ -z "${MUSE_JWT_SECRET_KEY}" ]] && { echo "'MUSE_JWT_SECRET_KEY' is not set. Exiting."; exit 1; }
[[ -z "${SSH_USER}" ]] && { echo "'SSH_USER' is not set. Exiting."; exit 1; }
[[ -z "${SSH_HOST}" ]] && { echo "'SSH_HOST' is not set. Exiting."; exit 1; }

trap 'docker context use "${MUSE_DOCKER_DEFAULT_CONTEXT}"' EXIT

Expand All @@ -27,7 +29,7 @@ docker context use "${MUSE_DOCKER_DEFAULT_CONTEXT}"
if [ "$stage" != "local" ]; then
context_name=muse-$stage
if ! docker context ls --format '{{.Name}}' | grep -q "^${context_name}$"; then
docker context create "${context_name}" --description "[MUSE $stage] Deploy Server" --docker "host=ssh://[email protected]"
docker context create "${context_name}" --description "[MUSE $stage] Deploy Server" --docker "host=ssh://${SSH_USER}@${SSH_HOST}"
fi

docker context use "$context_name"
Expand Down
4 changes: 3 additions & 1 deletion tools/scripts/stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ currentDir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
rootDir="$currentDir/../../"

[[ -z "${MUSE_DOCKER_DEFAULT_CONTEXT}" ]] && { echo "'MUSE_DOCKER_DEFAULT_CONTEXT' is not set. Exiting."; exit 1; }
[[ -z "${SSH_USER}" ]] && { echo "'SSH_USER' is not set. Exiting."; exit 1; }
[[ -z "${SSH_HOST}" ]] && { echo "'SSH_HOST' is not set. Exiting."; exit 1; }

trap 'docker context use "${MUSE_DOCKER_DEFAULT_CONTEXT}"' EXIT

Expand All @@ -26,7 +28,7 @@ docker context use "${MUSE_DOCKER_DEFAULT_CONTEXT}"
if [ "$stage" != "local" ]; then
context_name=muse-$stage
if ! docker context ls --format '{{.Name}}' | grep -q "^${context_name}$"; then
docker context create "${context_name}" --description "[MUSE] '$stage' Deploy Server" --docker "host=ssh://[email protected]"
docker context create "${context_name}" --description "[MUSE] '$stage' Deploy Server" --docker "host=ssh://${SSH_USER}@${SSH_HOST}"
fi

docker context use "$context_name"
Expand Down

0 comments on commit 328cbb3

Please sign in to comment.