备注: 我开发测试的环境时centos
1. 预备环境
1. openssl
yum install -y openssl-devel
2. xml
yum install -y expat-devel
3. yaml
yum install -y libyaml-devel
2. 项目创建
mix new ejapp
项目结构
├── Jenkinsfile
├── README.md
├── config
│ ├── config.exs
│ └── ejabberd.yml
├── lib
│ └── ejapp.ex
├── mix.exs
├── mix.lock
└── test
├── ejapp_test.exs
└── test_helper.exs
主要是 config/ 目录中文件的配置
config/config.exs
config :ejabberd,
file: "config/ejabberd.yml",
log_path: 'logs/ejabberd.log'
# Customize Mnesia directory:
config :mnesia,
dir: 'mnesiadb/'
config/ejabberd.yml
wget https://gist.githubusercontent.com/mremond/383666d563025e86adfe/raw/723dfa50c955c112777f3361b4f2067b76a55d7b/ejabberd.yml
3. 运行
a. 依赖下载&& 编译运行
mix deps.get
mix compile
iex -S mix
b. 注册用户
:ejabberd_auth.try_register("test", "localhost", "passw0rd")
4. 参考资料
https://docs.ejabberd.im/developer/extending-ejabberd/elixir/
https://github.com/rongfengliang/ejabberd-elixir