Skip to content

Commit

Permalink
docker: enable environment variables settings by default
Browse files Browse the repository at this point in the history
By leveraging the templating mechanism in `settings.json`, this change allows a
Docker client to run a prebuilt image and change some basic configuration
settings, like the instance name or, more importantly, the database
coordinates.

By default, the image runs witho no administrative user enabled. If a value is
given to ADMIN_PASSWORD, the `admin` user will be activated.

Also closes ether#3623

---
Modified by muxator to support conditional user activation at runtime.
  • Loading branch information
pierreprinetti committed Oct 1, 2019
1 parent 7c099fe commit 2ee47e2
Show file tree
Hide file tree
Showing 5 changed files with 527 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules
settings.json
/settings.json
!settings.json.template
APIKEY.txt
SESSIONKEY.txt
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ RUN for PLUGIN_NAME in ${ETHERPAD_PLUGINS}; do npm install "${PLUGIN_NAME}"; don
#
# For the conditional COPY trick, see:
# https://stackoverflow.com/questions/31528384/conditional-copy-add-in-dockerfile#46801962
COPY nop setting[s].json /opt/etherpad-lite/
COPY ./settings.json /opt/etherpad-lite/

EXPOSE 9001
CMD ["node", "node_modules/ep_etherpad-lite/node/server.js"]
50 changes: 50 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,53 @@ docker run --detach --publish <DESIDERED_PORT>:9001 <YOUR_USERNAME>/etherpad
```

And point your browser to `http://<YOUR_IP>:<DESIDERED_PORT>`

# Options available by default

The `settings.json` available by default enables some configuration to be set from the environment.

Available options:
* `TITLE`: The name of the instance
* `FAVICON`: favicon default name, or a fully specified URL to your own favicon
* `SKIN_NAME`: either `no-skin`, `colibris` or an existing directory under `src/static/skins`.
* `IP`: IP which etherpad should bind at. Change to `::` for IPv6
* `PORT`: port which etherpad should bind at
* `SHOW_SETTINGS_IN_ADMIN_PAGE`: hide/show the settings.json in admin page
* `DB_TYPE`: a database supported by https://www.npmjs.com/package/ueberdb2
* `DB_HOST`: the host of the database
* `DB_PORT`: the port of the database
* `DB_NAME`: the database name
* `DB_USER`: a database user with sufficient permissions to create tables
* `DB_PASS`: the password for the database username
* `DB_CHARSET`: the character set for the tables (only required for MySQL)
* `DB_FILENAME`: in case `DB_TYPE` is `DirtyDB`, the database filename. Default: `var/dirty.db`
* `ADMIN_PASSWORD`: the password for the `admin` user (leave unspecified if you do not want to create it)
* `USER_PASSWORD`: the password for the first user `user` (leave unspecified if you do not want to create it)
* `LOGLEVEL`: valid values are `DEBUG`, `INFO`, `WARN` and `ERROR`

## Examples

Use a Postgres database, no admin user enabled:

```shell
docker run -d \
--name etherpad \
-p 9001:9001 \
-e 'DB_TYPE=postgres' \
-e 'DB_HOST=db.local' \
-e 'DB_PORT=4321' \
-e 'DB_NAME=etherpad' \
-e 'DB_USER=dbusername' \
-e 'DB_PASS=mypassword' \
etherpad/etherpad
```

Run enabling the administrative user `admin`:

```shell
docker run -d \
--name etherpad \
-p 9001:9001 \
-e 'ADMIN_PASSWORD=supersecret' \
etherpad/etherpad
```
4 changes: 0 additions & 4 deletions docker/nop

This file was deleted.

Loading

0 comments on commit 2ee47e2

Please sign in to comment.