diff --git a/ejabberd-base/README.md b/ejabberd-base/README.md index 1e5a10f..19628ae 100644 --- a/ejabberd-base/README.md +++ b/ejabberd-base/README.md @@ -6,22 +6,46 @@ This ejabberd Docker image allows you to run a single node ejabberd instance in ### Default configuration for domain localhost -You can run ejabberd with the following command: +You can run ejabberd in a new container with the following command: ```bash -docker run -it -p 5222:5222 ejabberd/ecs +docker run --name ejabberd -d -p 5222:5222 ejabberd/ecs +``` + +This command will run Docker image as a daemon, using ejabberd default configuration file and XMPP domain "localhost". + +To stop the running container, you can run: + +```bash +docker stop ejabberd +``` + +If needed you can restart the stopped ejabberd container with: + +```bash +docker restart ejabberd +``` + +### Running ejabberd with Erlang console attached + +If you would like to run it with console attached you can use the `console` command: + +```bash +docker run -it -p 5222:5222 ejabberd/ecs console ``` This command will use default configuration file and XMPP domain "localhost". ### Running ejabberd with your config file and database host directory +The following command + ```bash mkdir db -docker run --rm -it -v $(pwd)/db:/home/p1/db -p 5222:5222 ejabberd/ecs +docker run --name ejabberd -v $(pwd)/ejabberd.yml:/home/p1/cfg/ejabberd.yml -v $(pwd)/db:/home/p1/db -p 5222:5222 ejabberd/ecs ``` -## Docker configuration +## Docker image advanced configuration ### Files @@ -35,8 +59,7 @@ ejabberd base Docker image exposes the following port: - 5222: This is the default XMPP port for clients. - 5280: This is the port for admin interface, API, Websockets and XMPP BOSH. -- 5269: Optional. This is the port for XMPP federation. Only needed if you want - to communicate with users on other servers. +- 5269: Optional. This is the port for XMPP federation. Only needed if you want to communicate with users on other servers. ### Volumes @@ -46,21 +69,22 @@ This is the kind of data you probably want to store on a persistent or local dri Here are the volume you may want to map: - /home/p1/log/: Directory containing log files -- /home/p1/db/: Directory containing Mnesia database. You should backup or - export the content of the directory to persistent storage (host storage, local storage, any storage plugin) +- /home/p1/db/: Directory containing Mnesia database. You should backup or export the content of the directory to persistent storage (host storage, local storage, any storage plugin) ## Generating ejabberd release ### Configuration -Configuration of ejabberd release is customized with: +Image is build by embedding an ejabberd Erlang/OTP standalone release in the image. + +The configuration of ejabberd Erlang/OTP release is customized with: - rel/config.exs: Customize ejabberd release - rel/dev.exs: ejabberd environment configuration for development release - rel/docker.exs: ejabberd environment configuration for production Docker release - ejabberd.yml: ejabberd default config file -Run the build script to generate ejabberd ecs base image from ejabberd master on Github: +Run the build script to generate ejabberd Community Server base image from ejabberd master on Github: ```bash ./build.sh diff --git a/ejabberd-base/docker-entrypoint.sh b/ejabberd-base/docker-entrypoint.sh index d0d4824..2961979 100755 --- a/ejabberd-base/docker-entrypoint.sh +++ b/ejabberd-base/docker-entrypoint.sh @@ -15,3 +15,14 @@ if [ "$1" = 'ejabberd' ]; then su-exec p1 $HOME/ejabberd/bin/ejabberd foreground fi + +if [ "$1" = 'console' ]; then + mkdir -p "$P1DATA" + chmod 700 "$P1DATA" + chown -R p1 "$P1DATA" + mkdir -p "$P1LOG" + chmod 700 "$P1LOG" + chown -R p1 "$P1LOG" + + su-exec p1 $HOME/ejabberd/bin/ejabberd console +fi