Skip to content

Commit 8033aec

Browse files
committed
Improve how to deploy a collection
1 parent abe1dd2 commit 8033aec

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

content/deployment/how-to/deploy.md

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,17 @@ weight: 1
55

66
# How to deploy a collection
77

8-
This guide will help you deploy an Open Terms Archive collection to a server. The deployment is automated using [Ansible](https://docs.ansible.com/ansible/latest/index.html), a configuration management tool that will set up the Open Terms Archive engine and configure it to track your collection's terms.
8+
This guide will help you deploy an Open Terms Archive collection to a server. The deployment is automated using [Ansible](https://docs.ansible.com/ansible/latest/index.html) and will set up the Open Terms Archive engine and configure it to track your collection's terms.
99

1010
## System Overview
1111

12-
Before diving into the deployment steps, here's a high-level overview of how Open Terms Archive works:
12+
Before diving into the deployment steps, here's a quick reminder of the high-level overview of how Open Terms Archive works.
1313

14-
1. **Repository structure**: Each collection uses three GitHub repositories:
15-
- `declarations`: Contains the terms to track, engine configuration and deployment configuration
16-
- `versions`: Automatically managed repository storing versions history
17-
- `snapshots`: Automatically managed repository storing snapshots history
14+
Each collection uses three repositories, `declarations` which contains the terms to track, the engine and deployment configuration, `versions` and `snapshots` which are automatically managed repositories storing versions and snapshots history.
1815

19-
2. **Deployment process**: The deployment is automated through GitHub Actions. Ansible configures the server and sets up the Open Terms Archive engine. On your server, [PM2](https://pm2.keymetrics.io) starts and controls the engine.
16+
The deployment process is automated through GitHub Actions. Ansible configures the server and sets up the Open Terms Archive engine. On the server, [PM2](https://pm2.keymetrics.io) is used to start and control the engine.
2017

21-
3. **Operation**: The engine runs continuously on your server, periodically checking for changes in the tracked terms. When changes are detected, it automatically commits them to the versions and snapshots repositories. Email notifications are sent when issues occur.
18+
When deployed, the engine runs continuously on the server, periodically checking for changes in the tracked terms. When changes are detected, it automatically commits them to the versions and snapshots repositories. When issues occur, email notifications are sent.
2219

2320
## Prerequisites
2421

@@ -45,7 +42,7 @@ First, ensure your server provides unsupervised access:
4542
If no Ed25519 key appears, generate one by running the following commands on the server:
4643

4744
```shell
48-
sudo ssh-keygen -t ed25519 --file=/etc/ssh/ssh_host_ed25519_key
45+
sudo ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key
4946
sudo systemctl restart ssh
5047
```
5148

@@ -60,23 +57,24 @@ First, ensure your server provides unsupervised access:
6057

6158
> **Note**: The `adduser` command might not be installed by default on your system. It can be installed with `sudo apt-get install adduser`.
6259
63-
3. Configure sudo access for this user, by running the adding the following line to the `/etc/sudoers` file on the server:
60+
3. Configure passwordless sudo access for this user, by running the adding the following line to the `/etc/sudoers` file on the server:
6461

6562
```shell
6663
<deployment_user> ALL=(ALL) NOPASSWD:ALL
6764
```
6865

69-
> **Note**: While passwordless sudo access does reduce security compared to requiring a password, it is essential for full automation in deployment workflows with Ansible. The deployment process requires system-level operations (like installing packages and configuring services) that must be executed without manual intervention. To mitigate security risks, this configuration is limited to a dedicated deployment user that should only be used for deployment purposes, and the server must be properly secured with SSH key authentication.
66+
> **Note**: While passwordless sudo access does reduce security compared to requiring a password, it is required for full automation in deployment workflows with Ansible. The deployment process requires system-level operations (like installing packages and configuring services) that must be executed without manual intervention. To mitigate security risks, this configuration is limited to a dedicated deployment user that should only be used for deployment purposes, and the server must be properly secured with SSH key authentication.
7067
7168
## 2. Set up the deployment configuration
7269

73-
1. Clone the collection declarations repository that you want to deploy:
70+
1. Clone the collection declarations repository that you want to deploy and navigate to the collection folder:
7471

7572
```shell
7673
git clone https://github.com/<organization>/<collection_id>-declarations.git
74+
cd <collection_id>-declarations
7775
```
7876

79-
2. Configure the inventory file `deployment/inventory.yml` with your server's IP address, deployment user (from step 1), server fingerprint (from step 1) and the repository URL:
77+
2. Configure the inventory file `deployment/inventory.yml` with your server's IP address, deployment user, server fingerprint and the repository URL:
8078

8179
```yaml
8280
<server_ip>:
@@ -115,10 +113,11 @@ First, ensure your server provides unsupervised access:
115113
- Set repository access for both declarations and versions repositories
116114
- Grant "Contents" and "Issues" write permissions
117115

118-
3. Get the token approved:
119-
- Have an organization admin approve the token request
116+
3. If relevant, get the token approved by having an organization admin approve the token request
120117

121-
4. > _Specific to Open Terms Archive organization members_
118+
4. Keep this token for the next steps
119+
120+
5. > _Specific to Open Terms Archive organization members_
122121
>
123122
> Back up the token in the shared password database by creating an entry titled "GitHub Token" in the collection folder and storing the token in this entry
124123

@@ -128,14 +127,15 @@ This section uses [Ansible Vault](https://docs.ansible.com/ansible/latest/vault_
128127

129128
1. Generate and store a vault key:
130129
- Generate a secure password without quotes/backticks
131-
- Inside the collection folder, create `deployment/vault.key` with the password.
132-
- Add the same password as `ANSIBLE_VAULT_KEY` in GitHub secrets.
130+
- Inside the collection folder, create a file named `deployment/vault.key` and paste the generated password into it.
131+
- Go to `https://github.com/<organization>/<collection_id>-declarations/settings/secrets/actions`
132+
- Create a new secret named `ANSIBLE_VAULT_KEY` and paste the same password into it.
133133

134134
> **Note**: The same vault key is used in two places:
135135
> - Locally as `vault.key` to encrypt/decrypt files during development
136136
> - In GitHub Actions as `ANSIBLE_VAULT_KEY` to decrypt files during automated deployment
137137

138-
2. Store the GitHub token (from step 4), in `deployment/.env`:
138+
2. Store the GitHub token, generated in the previous section, in `deployment/.env`:
139139

140140
```shell
141141
OTA_ENGINE_GITHUB_TOKEN=your_token
@@ -147,13 +147,16 @@ This section uses [Ansible Vault](https://docs.ansible.com/ansible/latest/vault_
147147
ansible-vault encrypt .env
148148
```
149149

150-
> **Note**: Running the command above from the `deployment` folder will ensure that the vault.key file is used as the vault key, as this folder contains an ansible.cfg file that explicitly configures this behavior.
150+
> **Note**: Running the command from the `deployment` folder will ensure that the `vault.key` file is used as vault key, since this folder contains an `ansible.cfg` file that explicitly configures this behavior.
151151
>
152152
> To decrypt an encrypted file, use:
153+
>
153154
> ```shell
154155
> ansible-vault decrypt deployment/.env
155156
> ```
157+
>
156158
> After making changes, re-encrypt it:
159+
>
157160
> ```shell
158161
> ansible-vault encrypt deployment/.env
159162
> ```

0 commit comments

Comments
 (0)