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
If no Ed25519 key appears, generate one by running the following commands on the server:
@@ -37,16 +43,26 @@ First, ensure your server provides unsupervised access:
37
43
38
44
> **Note**: A server fingerprint is a unique identifier for your server's SSH key. It helps verify that you're connecting to the correct server and not a malicious one. The fingerprint is a hash of the server's public key and is used to prevent man-in-the-middle attacks. You'll need this fingerprint in the next steps for secure deployment.
39
45
40
-
2.Create a dedicated user account specifically for deployment purposes, by running the following commands on the server:
46
+
2.Connect to the server and create a dedicated user account specifically for deployment purposes, by running the following commands:
41
47
42
48
```shell
43
-
adduser <deployment_user>
49
+
adduser --disabled-password <deployment_user>
44
50
usermod --append --groups=sudo <deployment_user>
45
51
```
46
52
53
+
> **Note**: The `--disabled-password` option creates a user account that cannot log in with a password unless one is explicitly set later. This is a security measure since the deployment process will use SSH keys for authentication instead of passwords.
54
+
47
55
> **Note**: The `adduser` command might not be installed by default on your system. It can be installed with `sudo apt-get install adduser`.
48
56
49
-
3. Configure passwordless sudo access for this user, by adding the following line to the `/etc/sudoers` file on the server:
57
+
3. Create and configure the SSH directory for the deployment user by running these commands on the server:
4. Configure passwordless sudo access for this deployment user, by adding the following line to the `/etc/sudoers` file on the server:
50
66
51
67
```shell
52
68
<deployment_user> ALL=(ALL) NOPASSWD:ALL
@@ -73,20 +89,20 @@ First, ensure your server provides unsupervised access:
73
89
```
74
90
75
91
3. Add the server fingerprint to GitHub, to allow the deployment workflow to uniquely identify the server:
76
-
- Go to `https://github.com/<organization>/<collection_id>-declarations/settings/secrets/actions`
92
+
- Go to `https://github.com/<organization>/<collection_id>-declarations/settings/secrets/actions/new`
77
93
- Create a new secret named `SERVER_FINGERPRINT` with your Ed25519 fingerprint
78
94
79
95
## 3. Configure SSH deployment keys
80
96
81
97
1. On the server, generate a deployment key, which will be used by the continuous deployment workflow to connect to the server to deploy the collection:
2. Add the private key to GitHub, to allow the deployment workflow to connect to the server:
89
-
- Go to `https://github.com/<organization>/<collection_id>-declarations/settings/secrets/actions`
105
+
- Go to `https://github.com/<organization>/<collection_id>-declarations/settings/secrets/actions/new`
90
106
- Create a new secret named `SERVER_SSH_KEY` with the private key content
91
107
92
108
{{< showIfParam "ota" >}}
@@ -98,13 +114,17 @@ First, ensure your server provides unsupervised access:
98
114
1. Log in as the user account dedicated to bot-related actions in GitHub
99
115
100
116
2. Create a fine-grained GitHub token:
101
-
- Create a new token at github.com/settings/personal-access-tokens/new
102
-
- Set repository access for both declarations and versions repositories
103
-
- Grant "Contents" and "Issues" write permissions
117
+
- Go to [https://github.com/settings/personal-access-tokens/new](https://github.com/settings/personal-access-tokens/new)
118
+
- Select an option for the "Resource owner", it can be the organization or the user account
119
+
- Set the expiration date to "No expiration"
120
+
- If the resource owner is an organization, in "Repository access", select "Only select repositories" and select the `<collection_id>-declarations` and `<collection_id>-versions` repositories
121
+
- If the resource owner is a user account, in "Repository access", select "All repositories"
122
+
- In "Permissions", select "Repository permissions" and grant "Contents" and "Issues" "Read and write" permissions
123
+
- Click on "Generate token"
104
124
105
-
3. If relevant, get the token approved by having an organization admin approve the token request
125
+
3. If the resource owner is an organization, have an organization admin approve the token request. This step is not needed if the resource owner is a user account.
106
126
107
-
4. Keep this token for the next steps
127
+
4. Keep this token for later use as `<github_token>`
108
128
109
129
{{< showIfParam "ota" >}}
110
130
5. 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
@@ -127,7 +147,7 @@ This section uses [Ansible Vault](https://docs.ansible.com/ansible/latest/vault_
127
147
2. Store the GitHub token, generated in the previous section, in `deployment/.env`:
128
148
129
149
```shell
130
-
OTA_ENGINE_GITHUB_TOKEN=your_token
150
+
OTA_ENGINE_GITHUB_TOKEN=<github_token>
131
151
```
132
152
133
153
3. Encrypt the `.env` file by running the following command inside the `deployment` folder of the collection:
@@ -158,13 +178,24 @@ This section uses [Ansible Vault](https://docs.ansible.com/ansible/latest/vault_
158
178
159
179
## 6. Set up collection-specific SSH key
160
180
161
-
1. Generate a new key, which will be used by the Open Terms Archive engine to perform actions on GitHub as the bot user:
181
+
1. On your local machine, generate a new key, which will be used by the Open Terms Archive engine to perform actions on GitHub as the bot user:
2. Store the private key in `deployment/github-bot-private-key`
187
+
2. Store the private key by replacing the whole content of `deployment/github-bot-private-key` with the content of the private key file you just generated (`./<collection_name>-key`). Make sure to include the entire key, including the "-----BEGIN OPENSSH PRIVATE KEY-----" and "-----END OPENSSH PRIVATE KEY-----" lines, with the newline at the end of the file. It should look like this:
> **Note**: The local deployment will only work if your personal SSH key is authorized to connect to the deployment user on the server. If you haven't done this yet, follow these steps:
267
+
> 1. On your local machine, copy your public SSH key
268
+
> 2. Connect to the server and paste the key at the end of the `/home/<deployment_user>/.ssh/authorized_keys` file
269
+
234
270
If all steps complete successfully, your collection should now be properly deployed and running.
0 commit comments