I am having trouble setting up ejabberd to use PostgreSQL. My environment is OSX for development and a Debian server for production.
The OSX story goes as follows:
ejabberd is compiled from source with odbc support. erlang is installed through macports.
First problem I encountered was the psql modules for erlang. In the docs it’s mentioned to compile them from a non-existing svn location. I copied from the binary installation the relevant .beam to my ejabberd lib which seems to work fine.
My ejabberd configuration is deliberately minimal and at the moment only does authentication through odbc with the native pgsql driver. However, while ejabberd starts cleanly it never actually creates the table structure. In processone’s repo there is pg.sql but with a big warning about it being obsolete and mentioning that the tables will be created automatically. How and when does that happen? I can verify that for instance trying to authenticate does send queries to postgresql, but since there are no tables there, it errors out…
ejabberd config follows:
{loglevel, 4}.
{hosts, ["localhost"]}.
{listen,
[
{{5222, {127, 0, 0, 1}}, ejabberd_c2s, [
{access, c2s},
{shaper, c2s_shaper},
{max_stanza_size, 65536}
]},
{{5269, {127, 0, 0, 1}}, ejabberd_s2s_in, [
{shaper, s2s_shaper},
{max_stanza_size, 131072}
]},
{{5280, {127, 0, 0, 1}}, ejabberd_http, [
http_bind,
web_admin
]}
]}.
{odbc_server, {pgsql, "localhost", "ejabberd", "ejabberd", "ejabberd"}}.
{auth_method, [odbc]}.
{shaper, normal, {maxrate, 1000}}.
{shaper, fast, {maxrate, 50000}}.
{host_config, "localhost", [{acl, admin, {user, "admin", "localhost"}}]}.
{acl, local, {user_regexp, ""}}.
{access, max_user_sessions, [{10, all}]}.
{access, local, [{allow, local}]}.
{access, c2s, [{deny, blocked},
{allow, all}]}.
{access, c2s_shaper, [{none, admin},
{normal, all}]}.
{access, s2s_shaper, [{fast, all}]}.
{access, announce, [{allow, admin}]}.
{access, configure, [{allow, admin}]}.
{access, muc_admin, [{allow, admin}]}.
{access, muc, [{allow, all}]}.
{access, muc_create, [{allow, local}]}.
{access, register, [{allow, all}]}.
{access, pubsub_createnode, [{allow, local}]}.
{language, "en"}.
{modules,
[
{mod_adhoc, []},
{mod_announce, [{access, announce}]},
{mod_caps, []},
{mod_configure,[]},
{mod_disco, []},
{mod_http_bind,[]},
{mod_last, []},
{mod_offline, []},
{mod_privacy, []},
{mod_private, []},
{mod_pubsub, [
{access_createnode, pubsub_createnode},
{ignore_pep_from_offline, false},
{last_item_cache, false},
{nodetree, "dag"},
{plugins, ["dag", "flat", "hometree", "pep"]},
{max_items_node, 1000}
]},
{mod_register, [
{welcome_message, {"Welcome!",
"Welcome to localhost Jabber server."}},
{access, register}
]},
{mod_roster, []},
{mod_shared_roster,[]},
{mod_time, []},
{mod_vcard, []},
{mod_version, []}
]}.
Right, this is mostly for documentation after I figured this out eventually… Hopefully it’s useful for others with similar trouble. It applies for ejabberd 2.1.*, certainly not for the 3 series.
\'by ejabberd which does not go well in the 9.* series of PostgreSQL.subversionanderlang-toolsinstalled for the next step.Compile and copy to path/lib/ejabberd/ebin