Skip to content

Commit

Permalink
Added a deployment script that creates a file containing details on w…
Browse files Browse the repository at this point in the history
…hat git commit was used.
  • Loading branch information
Richard Liang committed Jan 16, 2024
1 parent 6fdba76 commit bd8a62b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cluster-setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ This sets up the root user's SSH key and `/etc/hosts`, and installs Ansible on t
Accept the defaults whenever it asks which services should be restarted.
Now that Ansible is available on the root node, most of the rest of the procedure will be done
using Ansible playbooks defined in the [deployment] directory. Copy the `cluster-setup` directory
to the head node, e.g. using `rsync -avz`, placing it in a sensible location with the appropriate
permissions. If you make changes, you can also use `rsync -avz` to keep them synchronized between
your workstation and the head node.
to the head node using the `deploy_cluster_setup.bash` script, placing it in a sensible location
with the appropriate permissions. If you make changes, you can also use the same script
to keep them synchronized between your workstation and the head node.

#### Prepare Ansible configuration

Expand Down
38 changes: 38 additions & 0 deletions cluster-setup/deploy_cluster_setup.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

# Use rsync to copy the cluster setup code to a target server.

# Command-line parameters:
# prod|test
# e.g.
# ./deploy_cluster_setup.sh prod

# If you need to override the default login/server or upload path, set
# the environment variables CLUSTER_SETUP_LOGIN and/or CLUSTER_SETUP_PATH.
# Check out the version of the code you want before running, as this script
# does not check out a fresh repository; we want this script to transfer over
# config files that would not be in a stock repo.

# Make sure you have (or the account you log into the server with has) appropriate
# permissions on the deployment path.

prod_or_test=$1

echo "Deployed tag/commit/branch $git_tag on $(date)." > deployment_notes.txt
echo 'Output of "git describe":' >> deployment_notes.txt
git describe --tags >> deployment_notes.txt
echo 'Output of "git show --format=oneline --no-patch":' >> deployment_notes.txt
git show --format=oneline --no-patch >> deployment_notes.txt

if [ "$prod_or_test" == "prod" ]; then
server="kive-int.cfenet.ubc.ca"
else
server="testkive-int.cfenet.ubc.ca"
fi
server_login=${CLUSTER_SETUP_LOGIN:-"${USER}@${server}"}

deployment_path=${CLUSTER_SETUP_PATH:-"/usr/local/src/cluster-setup"}

rsync -avz --exclude-from deploy_exclude_list.txt -a ./ ${server_login}:${deployment_path}

echo "... done."
4 changes: 4 additions & 0 deletions cluster-setup/deploy_exclude_list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
deployment/group_vars/all.yml
deployment/group_vars/all.yaml
deployment/ansible.cfg
initialization/worker/head_node_root_id_ed25519.pub

0 comments on commit bd8a62b

Please sign in to comment.