Skip to content

Commit

Permalink
Improve the docker experience
Browse files Browse the repository at this point in the history
- Only one env variable to configure on first usage
- Auto-generate a default config
- Improve doc
  • Loading branch information
Maxime Dor committed Dec 16, 2017
1 parent 6571ff7 commit 7fff244
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ EXPOSE 8090

ADD build/libs/mxisd.jar /mxisd.jar
ADD src/docker/start.sh /start.sh
RUN mkdir -p /var/mxisd

ENV JAVA_OPTS=""
ENV CONF_FILE_PATH="/etc/mxisd/mxisd.yaml"
ENV SIGN_KEY_PATH="/var/mxisd/sign.key"
ENV SQLITE_DATABASE_PATH="/var/mxisd/mxisd.db"

CMD [ "/start.sh" ]
2 changes: 2 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Install via:
See the [Latest release](https://github.com/kamax-io/mxisd/releases/latest) for links to each.

## Configure
**NOTE**: please view the install instruction for your platform, as this step might be optional/handled for you.

Create/edit a minimal configuration (see installer doc for the location):
```
matrix.domain: 'MyMatrixDomain.org'
Expand Down
12 changes: 10 additions & 2 deletions docs/install/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@ Pull the latest stable image:
docker pull kamax/mxisd
```

## Configure
On first run, simply using `MATRIX_DOMAIN` as an environment variable will create a default config for you.
You can also provide a configuration file named `mxisd.yaml` in the volume mapped to `/etc/mxisd` before starting your
container.

## Run
Run it (adapt volume paths to your host):
Use the following command after adapting to your needs:
- The `MATRIX_DOMAIN` environment variable to yours
- The volumes host paths

```
docker run --rm -v /data/mxisd/etc:/etc/mxisd -v /data/mxisd/var:/var/mxisd -p 8090:8090 -t kamax/mxisd
docker run --rm -e MATRIX_DOMAIN=example.org -v /data/mxisd/etc:/etc/mxisd -v /data/mxisd/var:/var/mxisd -p 8090:8090 -t kamax/mxisd
```

For more info, including the list of possible tags, see [the public repository](https://hub.docker.com/r/kamax/mxisd/)
24 changes: 24 additions & 0 deletions src/docker/start.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,26 @@
#!/bin/sh

if ! [ -z "$CONF_FILE_PATH" ] && ! [ -f "CONF_FILE_PATH" ]; then
echo "Generating config file $CONF_FILE_PATH"
touch "CONF_FILE_PATH"

if ! [ -z "$MATRIX_DOMAIN" ]; then
echo "Setting matrix domain to $MATRIX_DOMAIN"
echo "matrix.domain: $MATRIX_DOMAIN" >> "$CONF_FILE_PATH"
fi

if ! [ -z "$SIGN_KEY_PATH" ]; then
echo "Setting signing key path to $SIGN_KEY_PATH"
echo "key.path: $SIGN_KEY_PATH" >> "$CONF_FILE_PATH"
fi

if ! [ -z "$SQLITE_DATABASE_PATH" ]; then
echo "Setting SQLite DB path to $SQLITE_DATABASE_PATH"
echo "storage.provider.sqlite.database: $SQLITE_DATABASE_PATH" >> "$CONF_FILE_PATH"
fi

echo "Starting mxisd..."
echo
fi

exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -Dspring.config.location=/etc/mxisd/ -Dspring.config.name=mxisd -jar /mxisd.jar

0 comments on commit 7fff244

Please sign in to comment.