Skip to content

Commit

Permalink
Deploy to primary and secondary web servers
Browse files Browse the repository at this point in the history
  • Loading branch information
mudge committed Nov 15, 2023
1 parent 8baace0 commit dc50823
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
18 changes: 13 additions & 5 deletions .github/actions/deploy-action/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Deploy via Bastion Host
description: "Deploy specified files and directories to a server via a bastion host"
description: "Deploy specified files and directories to a primary and secondary server via a bastion host"
inputs:
private_ssh_key:
description: "The private SSH key used to authenticate with the remote servers"
Expand All @@ -13,8 +13,12 @@ inputs:
description: "The [user@]hostname of the bastion server"
required: true

host:
description: "The [user@]hostname of the web server"
primary_host:
description: "The [user@]hostname of the primary web server"
required: true

secondary_host:
description: "The [user@]hostname of the secondary web server"
required: true

source:
Expand Down Expand Up @@ -45,6 +49,10 @@ runs:
chmod 600 ~/.ssh/known_hosts
shell: bash

- name: rsync source to destination
run: rsync -avz --delete -e 'ssh -A ${{ inputs.bastion_host }} ssh' ${{ inputs.source }} ${{ inputs.host }}:${{ inputs.destination }}
- name: Deploy to primary server
run: rsync -avz --delete -e 'ssh -A ${{ inputs.bastion_host }} ssh' ${{ inputs.source }} ${{ inputs.primary_host }}:${{ inputs.destination }}
shell: bash

- name: Deploy to secondary server
run: rsync -avz --delete -e 'ssh -A ${{ inputs.bastion_host }} ssh' ${{ inputs.source }} ${{ inputs.secondary_host }}:${{ inputs.destination }}
shell: bash
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ jobs:
private_ssh_key: ${{ secrets.DEPLOY_SSH_KEY }}
public_bastion_host_keys: ${{ secrets.DEPLOY_KNOWN_HOSTS }}
bastion_host: ${{ secrets.DEPLOY_BASTION_HOST }}
host: ${{ secrets.DEPLOY_HOST }}
primary_host: ${{ secrets.DEPLOY_PRIMARY_HOST }}
secondary_host: ${{ secrets.DEPLOY_SECONDARY_HOST }}
# this needs to match destination: in _config.yml
source: documentation/html/
destination: documentation

0 comments on commit dc50823

Please sign in to comment.