Skip to content

Commit 2a23b6d

Browse files
committed
Create a reference for Deployment architecture
1 parent 532d689 commit 2a23b6d

File tree

3 files changed

+86
-11
lines changed

3 files changed

+86
-11
lines changed

content/deployment/how-to/deploy.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,11 @@ weight: 1
77

88
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

10-
## System Overview
11-
12-
Before diving into the deployment steps, here's a quick reminder of the high-level overview of how Open Terms Archive works.
13-
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.
15-
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.
17-
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.
19-
2010
## Prerequisites
2111

2212
Before starting, ensure you have:
2313

14+
- A basic understanding of the [deployment architecture]({{< relref "deployment/reference/architecture" >}})
2415
- A server with admin access
2516
- All collections repositories created, if not, see the [guide to create repositories]({{< relref "collections/how-to/create-repositories" >}})
2617
- At least one declaration added to your collection
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: Deployment architecture
3+
linkTitle: Architecture
4+
weight: 1
5+
---
6+
7+
# Deployment architecture
8+
9+
This document provides an overview of the key components and elements involved in the deployment process of a collection.
10+
11+
## Repository structure
12+
13+
A collection is defined by three repositories that work together to manage and track terms.
14+
15+
The declarations repository, `<collection_name>-declarations`, serves as the primary workspace for collection maintainers, containing declarations of the terms to track along with engine and deployment configurations.
16+
17+
This repository is complemented by two automatically managed repositories:
18+
19+
- The versions repository, `<collection_name>-versions`, which maintains a chronological history of terms changes in their readable format
20+
- The snapshots repository, `<collection_name>-snapshots`, which maintains a chronological history of the original source document (HTML, PDF…) from which the terms will be extracted
21+
22+
These repositories must be considered as databases and are automatically updated by the engine whenever changes are detected in the tracked terms.
23+
24+
## Infrastructure
25+
26+
The server is where the Open Terms Archive engine runs.
27+
28+
The server requires administrative access to allow setting up the system in the appropriate state.
29+
30+
It has an Ed25519 SSH host key pair, `ssh_host_ed25519_key`, which provides a unique server fingerprint, `<server_ssh_fingerprint>`, for identity verification.
31+
32+
There is also a dedicated deployment user account, `<deployment_user>`, with passwordless sudo access to facilitate automated deployment tasks while maintaining security.
33+
34+
Process management is handled through [PM2](https://pm2.keymetrics.io/) and ensures the Open Terms Archive engine runs continuously and reliably.
35+
36+
The engine itself is the core application that performs the actual term tracking and repository management tasks.
37+
38+
## Security elements
39+
40+
### Authentication
41+
42+
Security is maintained through multiple layers of authentication.
43+
44+
The server's SSH host key pair, `ssh_host_ed25519_key`, generates a unique server fingerprint, `<server_ssh_fingerprint>`. This fingerprint verifies server identity and prevents man-in-the-middle attacks during deployment.
45+
46+
The deployment process uses a dedicated SSH key pair, `ota-deploy`, for secure server connections during the continuous deployment workflow.
47+
48+
A separate collection-specific SSH key pair, `<collection_name>-key`, enables the engine to perform GitHub actions as a bot user.
49+
50+
Access to GitHub repositories is controlled through a fine-grained access token, `OTA_ENGINE_GITHUB_TOKEN`, that provides specific permissions for repository management.
51+
52+
### Secret management
53+
54+
Sensitive information is protected by the [Ansible Vault](https://docs.ansible.com/ansible/latest/vault_guide/index.html) encryption system.
55+
56+
The vault system uses a master password, `vault.key` to encrypt and decrypt sensitive data. This includes the environment configuration file, `.env`, and the GitHub bot's private key, `github-bot-private-key`, ensuring that sensitive credentials remain secure while still being accessible to the deployment process.
57+
58+
## Automation tools
59+
60+
[GitHub Actions](https://docs.github.com/en/actions) and [Ansible](https://www.ansible.com/) automate the deployment process. GitHub Actions runs the workflow while Ansible configures the server and deploys the engine.
61+
62+
A dedicated GitHub user account is used for bot-related actions such as committing entries in versions and snapshots repositories, reporting issues when tracking fails, and publishing releases. This account is configured with specific permissions to perform these automated tasks.
63+
64+
The engine sends email notifications to collection administrators when errors or issues occur during the tracking process, enabling prompt intervention when needed.
65+
66+
The engine automatically creates issues in the declarations repository to notify collection maintainers when terms can no longer be tracked. These issues provide details about the tracking failure to allow maintainers to investigate and resolve the problem.
67+
68+
## Configuration files
69+
70+
The system's behavior is controlled through several key configuration files:
71+
72+
- `inventory.yml`: Defines server address and deployment parameters
73+
- `production.json`: Stores application-specific settings
74+
- `vault.key`: Protects sensitive data through encryption
75+
76+
## Maintenance
77+
78+
The Open Terms Archive system is designed for continuous operation with minimal intervention.
79+
80+
The engine automatically tracks changes in terms, commits updates to the appropriate repositories, reports issues and sends notifications when issues occur.
81+
82+
System health is maintained through PM2's process management capabilities.
83+
84+
Regular administrative maintenance involves updating collections dependencies such as engine and deployment recipes. It also includes monitoring email notifications and reviewing application logs in case of issues or tracking interruptions.

content/deployment/reference/server-specifications.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Server specifications
3-
weight: 1
3+
weight: 2
44
---
55

66
# Server specifications

0 commit comments

Comments
 (0)