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 the container is configured to serve attachments (see `SELF_CONTAINED` below), make sure to install Git LFS and pull the LFS files:
9
+
## Settings
10
+
11
+
-``GIT_REPO_PATH``: the path to the Git repository to use.
12
+
-``SELF_CONTAINED`` (default: `false`): if set to `true`, the application will serve all necessary content from the Git repository, including
13
+
attachments and certificates chains.
14
+
-``ATTACHMENTS_BASE_URL`` (default: `None`): this URL will be used as the base URL for attachments. If `SELF_CONTAINED` is `false`, this URL is required. With self-contained, the current domain will be used by default (`Host` request header) if not set.
12
15
13
-
```bash
14
-
git lfs install
15
-
git lfs pull
16
-
git lfs fsck
17
-
```
18
16
19
-
Build the container:
17
+
## Running the application
18
+
19
+
The application needs access to a Git repository containing Remote Settings data (read-only);
20
20
21
21
```bash
22
-
docker build -t remote-settings-git-reader .
22
+
docker run --rm -p 8000:8000 \
23
+
-e GIT_REPO_PATH=/mnt/data/latest \
24
+
-e SELF_CONTAINED=true \
25
+
-v /mnt/git/remote-settings-data:/mnt/data:ro \
26
+
remote-settings-git-reader
23
27
```
24
28
25
-
Then you can start the application with:
29
+
But first, we will initialize the folder structure required to execute Git updates atomically.
30
+
Use the ``init`` command and the ``GIT_REPO_URL`` environment variable to specify the repository to clone:
Unless you used an anonymous clone, this is likely to fail, as the container needs access to the Git repository via SSH.
42
+
35
43
### Using SSH keys
36
44
37
45
When cloning the repository anonymously (from `https://...`) the Git LFS is rate-limited and it is very likely that you will hit the limit when pulling the LFS files.
@@ -45,13 +53,13 @@ Since the container is going to regularly run Git fetch commands to keep the rep
45
53
This requires to have a SSH agent working on the host. It has the advantage of not requiring the container to have access to the actual key and passphrase (if any).
46
54
47
55
```bash
48
-
docker run --rm -p 8000:8000 \
49
-
-e GIT_REPO_PATH=/mnt/data \
56
+
docker run --rm \
57
+
-e GIT_REPO_PATH=/mnt/data/latest \
50
58
-e SELF_CONTAINED=true \
51
59
-v /mnt/git/remote-settings-data:/mnt/data \
52
60
-e SSH_AUTH_SOCK=/app/ssh-agent \
53
61
-v $SSH_AUTH_SOCK:/app/ssh-agent \
54
-
remote-settings-git-reader
62
+
remote-settings-git-reader init
55
63
```
56
64
57
65
2. Or pass the private key file into the container.
@@ -73,12 +81,12 @@ EOF
73
81
And then mount the SSH material directory into the container:
74
82
75
83
```bash
76
-
docker run --rm -p 8000:8000 \
77
-
-e GIT_REPO_PATH=/mnt/data \
84
+
docker run --rm \
85
+
-e GIT_REPO_PATH=/mnt/data/latest \
78
86
-e SELF_CONTAINED=true \
79
87
-v /mnt/git/remote-settings-data:/mnt/data \
80
88
-v `pwd`/ssh-material:/app/.ssh \
81
-
remote-settings-git-reader
89
+
remote-settings-git-reader init
82
90
```
83
91
84
92
You can test your SSH setup:
@@ -92,9 +100,19 @@ docker run \
92
100
Hi <username>! You've successfully authenticated, but GitHub does not provide shell access.
93
101
```
94
102
95
-
## Settings
103
+
## Updating the repository
96
104
97
-
- ``GIT_REPO_PATH``: the path to the Git repository to use.
98
-
- ``SELF_CONTAINED`` (default: `false`): if set to `true`, the application will serve all necessary content from the Git repository, including
99
-
attachments and certificates chains.
100
-
- ``ATTACHMENTS_BASE_URL`` (default: `None`): this URL will be used as the base URL for attachments. If `SELF_CONTAINED` is `false`, this URL is mandatory, otherwise the current domain will be used by default (`Host` request header).
105
+
The container can be used to update the Git repository, by running the `update` command:
106
+
107
+
```bash
108
+
docker run --rm \
109
+
-e GIT_REPO_PATH=/mnt/data/latest \
110
+
-e SELF_CONTAINED=true \
111
+
-v /mnt/git/remote-settings-data:/mnt/data \
112
+
remote-settings-git-reader update
113
+
```
114
+
This command can be run periodically (e.g., via a cron job) to keep the repository up to date. For example, every 5 minutes:
0 commit comments