You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/deployment/how-to/deploy.md
+23-20Lines changed: 23 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,20 +5,17 @@ weight: 1
5
5
6
6
# How to deploy a collection
7
7
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.
9
9
10
10
## System Overview
11
11
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.
13
13
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.
18
15
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.
20
17
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.
22
19
23
20
## Prerequisites
24
21
@@ -45,7 +42,7 @@ First, ensure your server provides unsupervised access:
45
42
If no Ed25519 key appears, generate one by running the following commands on the server:
@@ -60,23 +57,24 @@ First, ensure your server provides unsupervised access:
60
57
61
58
> **Note**: The `adduser` command might not be installed by default on your system. It can be installed with `sudo apt-get install adduser`.
62
59
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:
64
61
65
62
```shell
66
63
<deployment_user> ALL=(ALL) NOPASSWD:ALL
67
64
```
68
65
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.
70
67
71
68
## 2. Set up the deployment configuration
72
69
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:
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:
80
78
81
79
```yaml
82
80
<server_ip>:
@@ -115,10 +113,11 @@ First, ensure your server provides unsupervised access:
115
113
- Set repository access for both declarations and versions repositories
116
114
- Grant "Contents" and "Issues" write permissions
117
115
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
120
117
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_
122
121
>
123
122
> 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
124
123
@@ -128,14 +127,15 @@ This section uses [Ansible Vault](https://docs.ansible.com/ansible/latest/vault_
128
127
129
128
1. Generate and store a vault key:
130
129
- 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.
133
133
134
134
> **Note**: The same vault key is used in two places:
135
135
> - Locally as `vault.key` to encrypt/decrypt files during development
136
136
> - In GitHub Actions as `ANSIBLE_VAULT_KEY` to decrypt files during automated deployment
137
137
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`:
139
139
140
140
```shell
141
141
OTA_ENGINE_GITHUB_TOKEN=your_token
@@ -147,13 +147,16 @@ This section uses [Ansible Vault](https://docs.ansible.com/ansible/latest/vault_
147
147
ansible-vault encrypt .env
148
148
```
149
149
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.
0 commit comments