mirror of
https://github.com/GothenburgBitFactory/taskchampion-sync-server.git
synced 2025-08-01 20:20:25 +02:00
Default DATA_DIR in entrypoint to match VOLUME in the Dockerfile
Details are included in RELEASING.md for inclusion in the next set of release notes.
This commit is contained in:
parent
953411bff8
commit
240d1b4df5
2 changed files with 53 additions and 1 deletions
52
RELEASING.md
52
RELEASING.md
|
@ -19,3 +19,55 @@
|
||||||
1. Commit that change with comment "Bump to -pre version".
|
1. Commit that change with comment "Bump to -pre version".
|
||||||
1. Run `git push upstream`
|
1. Run `git push upstream`
|
||||||
1. Navigate to the tag in the GitHub releases UI and create a release with general comments about the changes in the release
|
1. Navigate to the tag in the GitHub releases UI and create a release with general comments about the changes in the release
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
For the next release, include the folowing in the release notes:
|
||||||
|
|
||||||
|
Running the Docker image for this server without specifying DATA_DIR
|
||||||
|
defaulted to storing the server data in
|
||||||
|
`/var/lib/taskchampion-sync-server`. However, the Dockerfile only
|
||||||
|
specifies that the subdirectory `/var/lib/taskchampion-sync-server/data`
|
||||||
|
is a VOLUME. This change fixes the default to match the VOLUME, putting
|
||||||
|
the server data on an ephemeral volume or, if a `--volume
|
||||||
|
$NAME:/var/lib/taskchampion-sync-server/data` argument is provided to
|
||||||
|
`docker run`, in a named volume.
|
||||||
|
|
||||||
|
Before this commit, with default settings the server data is stored in
|
||||||
|
the container's ephemeral writeable layer. When the container is killed,
|
||||||
|
the data is lost. This issue does not affect deployments with `docker
|
||||||
|
compose`, as the compose configuration specifies a correct `DATA_DIR`.
|
||||||
|
|
||||||
|
You can determine if your deployment is affected as follows. First,
|
||||||
|
determine the ID of the running server container, `$CONTAINER`. Examine
|
||||||
|
the volumes for that container:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ docker container inspect $CONTAINER | jq '.[0].Config.Volumes'
|
||||||
|
{
|
||||||
|
"/var/lib/task-champion-sync-server/data": {}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Next, find the server data, in a `.sqlite3` file:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ docker exec $CONTAINER find /var/lib/taskchampion-sync-server
|
||||||
|
/var/lib/taskchampion-sync-server
|
||||||
|
/var/lib/taskchampion-sync-server/data
|
||||||
|
/var/lib/taskchampion-sync-server/taskchampion-sync-server.sqlite3
|
||||||
|
```
|
||||||
|
|
||||||
|
If the data is not in a directory mounted as a volume, then it is
|
||||||
|
ephemeral. To copy the data out of the container:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker cp $CONTAINER:/var/lib/taskchampion-sync-server/taskchampion-sync-server.sqlite3 /tmp
|
||||||
|
```
|
||||||
|
|
||||||
|
You may then upgrade the image and use `docker cp` to copy the data back
|
||||||
|
to the correct location, `/var/lib/taskchampion-sync-server/data`.
|
||||||
|
|
||||||
|
Note that, as long as all replicas are fully synced, the TaskChampion
|
||||||
|
sync protocol is resilient to loss of server data, so even if the server
|
||||||
|
data has been lost, `task sync` may continue to work.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
set -e
|
set -e
|
||||||
echo "starting entrypoint script..."
|
echo "starting entrypoint script..."
|
||||||
if [ "$1" = "/bin/taskchampion-sync-server" ]; then
|
if [ "$1" = "/bin/taskchampion-sync-server" ]; then
|
||||||
: ${DATA_DIR:=/var/lib/taskchampion-sync-server}
|
: ${DATA_DIR:=/var/lib/taskchampion-sync-server/data}
|
||||||
export DATA_DIR
|
export DATA_DIR
|
||||||
echo "setting up data directory ${DATA_DIR}"
|
echo "setting up data directory ${DATA_DIR}"
|
||||||
mkdir -p "${DATA_DIR}"
|
mkdir -p "${DATA_DIR}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue