You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.9 KiB
Markdown
87 lines
2.9 KiB
Markdown
8 years ago
|
## Docker image for ejabberd developers
|
||
8 years ago
|
|
||
8 years ago
|
Thanks to this image, you can build ejabberd with dependencies provided in Docker image, without the need to install build software (beside Docker) directly on your own machine.
|
||
8 years ago
|
|
||
8 years ago
|
Please note that this image can likely be reused as is to build other Erlang or Elixir software.
|
||
8 years ago
|
|
||
8 years ago
|
### Building ejabberd from source
|
||
8 years ago
|
|
||
8 years ago
|
You can build ejabberd from source with all dependencies, with the following commands:
|
||
8 years ago
|
|
||
|
```bash
|
||
|
git clone https://github.com/processone/ejabberd.git
|
||
|
docker run --rm -v $(pwd):$(pwd) -w $(pwd) ejabberd/mix do deps.get, deps.compile, compile
|
||
|
```
|
||
|
|
||
8 years ago
|
Alternatively if you do not have Git installed, you can do:
|
||
|
```bash
|
||
|
wget https://github.com/processone/ejabberd/archive/master.zip
|
||
|
unzip ejabberd-master
|
||
|
cd ejabberd-master
|
||
|
docker run --rm -v $(pwd):$(pwd) -w $(pwd) ejabberd/mix do deps.get, deps.compile, compile
|
||
|
```
|
||
|
|
||
8 years ago
|
## Run ejabberd with mix command-line tool attached
|
||
8 years ago
|
|
||
8 years ago
|
You can customize the configuration by editing the file `config/ejabberd.yml`. As a default, you can run ejabberd with console attached on "localhost" domain:
|
||
|
|
||
8 years ago
|
```bash
|
||
|
docker run --rm -it -p 5222:5222 -p 5280:5280 -v $(pwd):$(pwd) -w $(pwd) --entrypoint="/usr/bin/iex" ejabberd/mix -S mix
|
||
|
```
|
||
|
|
||
8 years ago
|
You can then create a user from Elixir shell:
|
||
|
|
||
|
```bash
|
||
|
|
||
|
Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:2:2] [async-threads:10] [kernel-poll:false]
|
||
|
Interactive Elixir (1.3.4) - press Ctrl+C to exit (type h() ENTER for help)
|
||
|
iex(1)> :ejabberd_auth.try_register("test", "localhost", "passw0rd")
|
||
|
{:atomic, :ok}
|
||
|
```
|
||
|
|
||
|
You can then connect with user test@localhost (password: passw0rd) on server on localhost port 5222 and use those parameters to connect with an XMPP client.
|
||
8 years ago
|
|
||
8 years ago
|
## Get into the container
|
||
8 years ago
|
|
||
8 years ago
|
If you want to run Erlang command line, you can do so by opening a shell inside the container:
|
||
8 years ago
|
|
||
|
```bash
|
||
|
docker run -it -v $(pwd):$(pwd) -w $(pwd) --entrypoint="/bin/sh" ejabberd/mix
|
||
|
```
|
||
|
|
||
8 years ago
|
## Getting Elixir version
|
||
|
|
||
|
```bash
|
||
|
docker run -it --rm -v $(pwd):$(pwd) -w $(pwd) ejabberd/mix --version
|
||
|
Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:2:2] [async-threads:10] [kernel-poll:false]
|
||
|
|
||
|
Mix 1.3.4
|
||
|
```
|
||
|
|
||
8 years ago
|
## Build the image
|
||
8 years ago
|
|
||
8 years ago
|
Building the image is not needed if you simply want to use it. You can simply use the one from [ejabberd Docker Hub](https://hub.docker.com/u/ejabberd/dashboard/).
|
||
8 years ago
|
|
||
|
```bash
|
||
|
docker build -t ejabberd/mix .
|
||
|
```
|
||
|
|
||
8 years ago
|
## Troubleshooting
|
||
8 years ago
|
|
||
8 years ago
|
### Clock resync
|
||
8 years ago
|
|
||
8 years ago
|
If you have warning about file timestamp being out of sync (Like 'Clock skew detected'), you may want to force resync your clock before running the build. Docker on MacOS does not force clock resync of Docker after the laptop went to sleep.
|
||
8 years ago
|
|
||
|
You can force clock resync as follow:
|
||
|
|
||
|
```bash
|
||
|
docker run -it --rm --privileged --entrypoint="/sbin/hwclock" ejabberd/mix -s
|
||
|
```
|
||
|
|
||
8 years ago
|
You can check if the clock of your laptop is in sync with the one inside Docker with the following command:
|
||
8 years ago
|
|
||
|
```bash
|
||
|
docker run --rm --entrypoint="/bin/sh" ejabberd/mix -c date -u && date -u
|
||
|
```
|
||
|
|