Skip to content

Commit 61b9293

Browse files
authored
Merge pull request #119 from djmitche/issue118
Default DATA_DIR in entrypoint to match VOLUME in the Dockerfile
2 parents 4de5c9a + 240d1b4 commit 61b9293

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

RELEASING.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,55 @@
1919
1. Commit that change with comment "Bump to -pre version".
2020
1. Run `git push upstream`
2121
1. Navigate to the tag in the GitHub releases UI and create a release with general comments about the changes in the release
22+
23+
---
24+
25+
For the next release, include the folowing in the release notes:
26+
27+
Running the Docker image for this server without specifying DATA_DIR
28+
defaulted to storing the server data in
29+
`/var/lib/taskchampion-sync-server`. However, the Dockerfile only
30+
specifies that the subdirectory `/var/lib/taskchampion-sync-server/data`
31+
is a VOLUME. This change fixes the default to match the VOLUME, putting
32+
the server data on an ephemeral volume or, if a `--volume
33+
$NAME:/var/lib/taskchampion-sync-server/data` argument is provided to
34+
`docker run`, in a named volume.
35+
36+
Before this commit, with default settings the server data is stored in
37+
the container's ephemeral writeable layer. When the container is killed,
38+
the data is lost. This issue does not affect deployments with `docker
39+
compose`, as the compose configuration specifies a correct `DATA_DIR`.
40+
41+
You can determine if your deployment is affected as follows. First,
42+
determine the ID of the running server container, `$CONTAINER`. Examine
43+
the volumes for that container:
44+
45+
```shell
46+
$ docker container inspect $CONTAINER | jq '.[0].Config.Volumes'
47+
{
48+
"/var/lib/task-champion-sync-server/data": {}
49+
}
50+
```
51+
52+
Next, find the server data, in a `.sqlite3` file:
53+
54+
```shell
55+
$ docker exec $CONTAINER find /var/lib/taskchampion-sync-server
56+
/var/lib/taskchampion-sync-server
57+
/var/lib/taskchampion-sync-server/data
58+
/var/lib/taskchampion-sync-server/taskchampion-sync-server.sqlite3
59+
```
60+
61+
If the data is not in a directory mounted as a volume, then it is
62+
ephemeral. To copy the data out of the container:
63+
64+
```shell
65+
docker cp $CONTAINER:/var/lib/taskchampion-sync-server/taskchampion-sync-server.sqlite3 /tmp
66+
```
67+
68+
You may then upgrade the image and use `docker cp` to copy the data back
69+
to the correct location, `/var/lib/taskchampion-sync-server/data`.
70+
71+
Note that, as long as all replicas are fully synced, the TaskChampion
72+
sync protocol is resilient to loss of server data, so even if the server
73+
data has been lost, `task sync` may continue to work.

docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -e
33
echo "starting entrypoint script..."
44
if [ "$1" = "/bin/taskchampion-sync-server" ]; then
5-
: ${DATA_DIR:=/var/lib/taskchampion-sync-server}
5+
: ${DATA_DIR:=/var/lib/taskchampion-sync-server/data}
66
export DATA_DIR
77
echo "setting up data directory ${DATA_DIR}"
88
mkdir -p "${DATA_DIR}"

0 commit comments

Comments
 (0)