Skip to content

Commit

Permalink
Update Lethe server configuration (#4854)
Browse files Browse the repository at this point in the history
  • Loading branch information
aradhanas9 committed May 9, 2024
1 parent 26ad323 commit 89d3bb7
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 20 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/alpha_cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,21 @@ jobs:
with:
fetch-depth: "0"

- name: Install SSH key
- name: Install SSH key for Bastion
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIV_KEY }}
known_hosts: ${{ secrets.SSH_KNOWN_HOST_DEPLOY }}
key: ${{ secrets.DEV_TOOLS_BASTION_PRIVATE_KEY }}
name: id_rsa-bastion
known_hosts: ${{ secrets.KNOWN_HOSTS_OF_BASTION }}
config: ${{ secrets.CONFIG }}

- name: Install SSH key of target
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.DEV_TOOLS_EC2_PRIVATE_KEY }}
name: id_rsa-target
known_hosts: ${{ secrets.KNOWN_HOSTS_OF_TARGET }}
config: ${{ secrets.CONFIG }}

- name: Clean-up old versions
run: bash tools/cleanup.sh ${{ github.event.inputs.appVersion }}
16 changes: 13 additions & 3 deletions .github/workflows/beta_to_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,21 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install SSH key
- name: Install SSH key for Bastion
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIV_KEY }}
known_hosts: ${{ secrets.SSH_KNOWN_HOST_DEPLOY }}
key: ${{ secrets.DEV_TOOLS_BASTION_PRIVATE_KEY }}
name: id_rsa-bastion
known_hosts: ${{ secrets.KNOWN_HOSTS_OF_BASTION }}
config: ${{ secrets.CONFIG }}

- name: Install SSH key of target
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.DEV_TOOLS_EC2_PRIVATE_KEY }}
name: id_rsa-target
known_hosts: ${{ secrets.KNOWN_HOSTS_OF_TARGET }}
config: ${{ secrets.CONFIG }}

- name: Ready for promotion
run: bash tools/deploy.sh ${{ github.event.inputs.betaVersion }}
16 changes: 13 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,21 @@ jobs:
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
id: extract_branch

- name: Install SSH key
- name: Install SSH key for Bastion
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIV_KEY }}
known_hosts: ${{ secrets.SSH_KNOWN_HOST_DEPLOY }}
key: ${{ secrets.DEV_TOOLS_BASTION_PRIVATE_KEY }}
name: id_rsa-bastion
known_hosts: ${{ secrets.KNOWN_HOSTS_OF_BASTION }}
config: ${{ secrets.CONFIG }}

- name: Install SSH key of target
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.DEV_TOOLS_EC2_PRIVATE_KEY }}
name: id_rsa-target
known_hosts: ${{ secrets.KNOWN_HOSTS_OF_TARGET }}
config: ${{ secrets.CONFIG }}
- name: Setup git
run: |
git config user.email ${{ env.GITHUB_EMAILID }}
Expand Down
6 changes: 3 additions & 3 deletions tools/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ purge() {

echo " - ${version}"
python3 tools/versions.py --delete "${version}"
ssh -o StrictHostKeyChecking=no -T nuxeo@lethe.nuxeo.com "rm -vf ${REMOTE_PATH_PROD}/alpha/*${version}.* ${REMOTE_PATH_PROD}/alpha/*${version}-*" || true
ssh -o StrictHostKeyChecking=no -T lethe.nuxeo.com "rm -vf ${REMOTE_PATH_PROD}/alpha/*${version}.* ${REMOTE_PATH_PROD}/alpha/*${version}-*" || true
git tag --delete "alpha-${version}" || true
git push --delete origin "wip-alpha-${version}" || true # branch
git push --delete origin "alpha-${version}" || true # tag
Expand All @@ -32,7 +32,7 @@ main() {
python3 -m pip install --user pyyaml==5.3.1

echo ">>> Retrieving versions.yml"
rsync -e "ssh -o StrictHostKeyChecking=no" -vz nuxeo@lethe.nuxeo.com:"${REMOTE_PATH_PROD}/versions.yml" .
rsync -e "ssh -o StrictHostKeyChecking=no" -vz lethe.nuxeo.com:"${REMOTE_PATH_PROD}/versions.yml" .

echo ">>> Checking versions.yml integrity"
python3 tools/versions.py --check || exit 1
Expand Down Expand Up @@ -68,7 +68,7 @@ main() {
python3 tools/versions.py --check || exit 1

echo ">>> Uploading versions.yml"
rsync -e "ssh -o StrictHostKeyChecking=no" -vz versions.yml nuxeo@lethe.nuxeo.com:"${REMOTE_PATH_PROD}/"
rsync -e "ssh -o StrictHostKeyChecking=no" -vz versions.yml lethe.nuxeo.com:"${REMOTE_PATH_PROD}/"
}

main "$@"
6 changes: 3 additions & 3 deletions tools/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ release() {
fi

echo ">>> [${latest_release}] Deploying to the production website"
ssh -o "StrictHostKeyChecking=no" -T nuxeo@lethe.nuxeo.com <<EOF
ssh -o "StrictHostKeyChecking=no" -T lethe.nuxeo.com <<EOF
# Move beta files into the release folder
mv -vf ${REMOTE_PATH_PROD}/beta/*${drive_version}* ${REMOTE_PATH_PROD}/release/
Expand All @@ -45,9 +45,9 @@ EOF
echo ">>> [release ${drive_version}] Generating the versions file"
python3 -m pip install --user -U setuptools wheel
python3 -m pip install --user pyyaml==5.3.1
rsync -e "ssh -o StrictHostKeyChecking=no" -vz nuxeo@lethe.nuxeo.com:"${REMOTE_PATH_PROD}/versions.yml" .
rsync -e "ssh -o StrictHostKeyChecking=no" -vz lethe.nuxeo.com:"${REMOTE_PATH_PROD}/versions.yml" .
python3 tools/versions.py --promote "${drive_version}" --type "release"
rsync -e "ssh -o StrictHostKeyChecking=no" -vz versions.yml nuxeo@lethe.nuxeo.com:"${REMOTE_PATH_PROD}/"
rsync -e "ssh -o StrictHostKeyChecking=no" -vz versions.yml lethe.nuxeo.com:"${REMOTE_PATH_PROD}/"
}

release "$@"
6 changes: 3 additions & 3 deletions tools/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cancel() {
artifacts="${REMOTE_PATH_STAGING}/${GITHUB_RUN_NUMBER}"

echo ">>> [Deploy] Removing uploaded artifacts"
ssh -o "StrictHostKeyChecking=no" nuxeo@lethe.nuxeo.com rm -rfv "${artifacts}"
ssh -o "StrictHostKeyChecking=no" lethe.nuxeo.com rm -rfv "${artifacts}"
}

create() {
Expand Down Expand Up @@ -48,8 +48,8 @@ publish() {
fi

echo ">>> [${release_type} ${drive_version}] Deploying to the server"
scp -o "StrictHostKeyChecking=no" tools/versions.py nuxeo@lethe.nuxeo.com:"${artifacts}"
ssh -o "StrictHostKeyChecking=no" -T nuxeo@lethe.nuxeo.com <<EOF
scp -o "StrictHostKeyChecking=no" tools/versions.py lethe.nuxeo.com:"${artifacts}"
ssh -o "StrictHostKeyChecking=no" -T lethe.nuxeo.com <<EOF
cd ${artifacts} || exit 1
echo " >> [Deploy] Generating ${drive_version}.yml"
Expand Down
4 changes: 2 additions & 2 deletions tools/upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ publish_staging() {
path="${REMOTE_PATH_STAGING}/${GITHUB_RUN_NUMBER}/"

echo ">>> [Upload] Deploying to the staging server"
rsync -e "ssh -o StrictHostKeyChecking=no" --chmod=755 -pvz "${artifact}" nuxeo@lethe.nuxeo.com:"${path}" || \
rsync -e "ssh -o StrictHostKeyChecking=no" -vz "${artifact}" nuxeo@lethe.nuxeo.com:"${path}" || exit 1 # macOS does not have --chmod
rsync -e "ssh -o StrictHostKeyChecking=no" --chmod=755 -pvz "${artifact}" lethe.nuxeo.com:"${path}" || \
rsync -e "ssh -o StrictHostKeyChecking=no" -vz "${artifact}" lethe.nuxeo.com:"${path}" || exit 1 # macOS does not have --chmod
echo "Artifacts deployed to:"
echo " >>> ${REMOTE_PATH_STAGING}/${GITHUB_RUN_NUMBER} <<<"
}
Expand Down

0 comments on commit 89d3bb7

Please sign in to comment.