Skip to content

Instantly share code, notes, and snippets.

@gabrielgatu
Last active August 20, 2016 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielgatu/7aae9fa01f6640946324e33aad2e609c to your computer and use it in GitHub Desktop.
Save gabrielgatu/7aae9fa01f6640946324e33aad2e609c to your computer and use it in GitHub Desktop.
GSoC Work Product Submission

GSoC Work Product Submission

Improve ejabberd configuration and extensibility with configuration DSL

Introduction

The goal of this project was to develop an alternative configuration model for ejabberd, using elixir DSL capabilities, and improve, in general, the elixir support inside ejabberd.

Proposal Link

The project is relative to the #4 idea proposed by the ejabberd community.

Project status

A fully functional configuration DSL has been developed and is currently pending as a pull request. It introduces some new functionalities, like module dependencies, git support for external modules and hooks support.

Now, elixir external modules are also supported. Module writing in elixir has also been improved.

Have a look at this more detailed explanation of what is now supported.

Commits made

Here's a list of all commits made:

Support for Elixir configuration file (Pull Request)

processone/ejabberd#1208

Description Commits
Add elixir config support dd296a1
Remove module/1 macro from config 35ab90a
Support hook macro inside config file 19e5fe0
Fix comment for hook example in config 59534a1
Ejabberd.Config.init now takes the the file_path. Refactoring d683502
Resolve issue when Ejabberd.Config.init/1 called multiple times and a… b52c539
Add support for git modules 64ba5d9
Format @opts attributes in elixir config 786774a
Extract git mods installation into Ejabberd.Config.EjabberdModule 6d48544
Remove deprecated Ejabberd.Config.EjabberdModule.start_modules/1 9bdf98a
Move validation module into /validator folder 26081d9
Rename Ejabberd.Config.Validator into ValidatorUtility 0418ed7
Resolve issues when using elixir config with built ejabberd b4bb471
Remove unused before/after hook in @attr_supported 3b63e24
Reverse key-val order of :request_handlers opt in ejabberd_http bc8684a
Create deps.tree mix task 5d4bc14
Remove duplicate :mod_version from ejabberd.exs cb7e862
Fix call to Ejabberd.Config.init/1 in deps.tree bb9c3cd
Move is_using_elixir_config/0 inside ejabberd_config.erl 9e07c16
Remove unused annotation @version from attr.ex f2c2050
Resolve alias syntax for compatibility before elixir 1.2 1c42f93
Remove unused start_link for Store in Ejabberd.Config.using/1 99aa073
Import automatically Ejabberd.Logger when using Ejabberd.Config fb76084
Resolve issue in Attr.insert_default_attrs_if_missing/1 … 5fa756a
Resolve case in Ejabberd.Config.EjabberdModule.is_git_module/1 … 5a7f52a
Remove unused Ejabberd.Config.OptsFormatter.into_root_element/1 f8a609a
Split multi-aliasing into single line to support elixir before 1.2 06bb5fe
Add stop/0 to Config.Store. Refactor/resolve minor issue in config.ex 89142ba
Add case for :attr_not_supported in EjabberdLogger.log_errors/1 57a44a7
Refactor Config.start_hooks/0 8c63fa7
Split multi aliasing into single line for support elixir < 1.2 bf5a6f8
Create base Ejabberd.Module for writing mods. Adapt ModPresenceDemo 8b9d1eb
Add tests for elixir-config 29cecee
Add docs and specs 8c00c6a

To see the commit just append the commit number to "https://github.com/processone/ejabberd/commit/"

ex: https://github.com/processone/ejabberd/commit/8c00c6a

Fix issue #625: Writing Elixir modules (Merged)

processone/ejabberd#1193

Description Commits
Support elixir module installer b31c0d9
Start elixir application after ejabberd_app:start_apps() 91865c6

To see the commit just append the commit number to "https://github.com/processone/ejabberd/commit/"

ex: https://github.com/processone/ejabberd/commit/91865c6

Mix tasks for ejabberd (Working on pull request)

https://github.com/gabrielgatu/ejabberd_task

Description Commits
Initial Commit a5e8391
Add readme 6e1df6a
Add correct archive link 97ad41a
Resolve git visibility of /archive 960977f
Rename archive to archives 3e03831

To see the commit just append the commit number to "https://github.com/gabrielgatu/ejabberd_task/commit/"

ex: https://github.com/gabrielgatu/ejabberd_task/commit/3e03831

Functionalities introduced

With this patches numerous features has been introduced regarding ejabberd configuration, module installation and mix tasks:

ejabberd configuration

Now it is possible to configure ejabberd through an elixir based file. It supports all the previous configuration options, but, on top of them, it adds new features like:

  • Module visibility

    When false the module is not visible to ejabberd

  • Git modules

    Modules now can be located on a remote repository and ejabberd will take care of downloading&compiling the code and adding it to the execution stack.

  • Module dependency

    Module dependency can now be specified and informations will be displayed to the user in case there is a required module missing, using terminal logging or mix tasks.

  • Hooks

    Hooks functions can now be registered directly inside the configuration file, supporting also different hosts and priorities.

Module writing in elixir has also been improved: a use/2 macro has been implemented that takes care of importing and setting the correct values.

Writing elixir modules

When using ejabberd built from source, it is possible, now, to have also elixir modules specified and the build chain will take care of compiling them using the compiling features provided by elixir.

Mix tasks for ejabberd

It has been introduced the mix ejabberd.new task that allows the users to scaffold immediately an ejabberd based project. The task is based on the already present mix new task and it supports also all its options, introducing some more for controlling the ejabberd project configuration.

Integration into ejabberd

Currently 1 of the 3 functionalities has already been merged into ejabberd master.

We are currently working with the ejabberd team to integrated also the Support for Elixir configuration file pull request into master, with the main september release.

This will allow ejabberd to be more extensible and easier to configure. Attracting also more people from the elixir community to use and contribute to ejabberd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment