Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helper script and self-submodule to aid update process #24

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "src/datalab"]
path = src/datalab
url = [email protected]:the-grey-group/datalab
[submodule "src/datalab-ansible-terraform"]
path = src/datalab-ansible-terraform
url = [email protected]:datalab-industries/datalab-ansible-terraform
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ repository state (i.e., no uncommited changes) to ensure reproducibility.

### Ansible automation

#### First-time setup

These instructions assume you have prepared the server on which you would like
to deploy *datalab*, and that it is:

Expand Down Expand Up @@ -151,6 +153,35 @@ instance at your configured URL!

If you are using your own domain, you will need to update your DNS settings so that your domain name points to the IP of the server as given in your inventory file.

#### Keeping things up to date

To update the *datalab* version, you simply update the git submodule in
`src/datalab`. This can be pinned to your fork and accomodate any custom changes
you desire (though you may also need to test and maintain your own set of
ansible rules and configuration for this).

Once you have chosen the *datalab* version, it can be redployed with `make
deploy` or

```shell
ansible-playbook --ask-vault-pass -i inventory.yml playbook.yml --tags deploy
```

To update the ansible playbooks themselves with any changes from the upstream
repository, you can similarly maintain the submodule in
`src/datalab-ansible-terraform` and either manually sync changes across, or use
the helper script:

```shell
./sync-ansible-upstream.sh
```

which will copy just the changed playbooks across, and commit them. You should
be careful to review these changes before committing them to your fork,
especially if you have made any custom changes to the playbooks.
Be sure to also commit the changes to your submodule so you know precisely which versions
of the playbooks are running.

### Cloud provisioning

These instructions will use OpenTofu, an open source fork of Terraform.
Expand Down
1 change: 1 addition & 0 deletions src/datalab-ansible-terraform
7 changes: 7 additions & 0 deletions sync-ansible-upstream.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -e -u -o pipefail
commit=$(cd src/datalab-ansible-terraform && git describe --tags)
rsync --exclude vaults --exclude inventory.yml -avr src/datalab-ansible-terraform/ansible .
git add -p ansible
git add $(git ls-files ansible --others --exclude-standard)
git commit ansible -p -m "Sync with upstream definitions from datalab-ansible-terraform $commit"
Loading