62 lines
3.0 KiB
Bash
Executable File
62 lines
3.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# Build a local Prosody test server (no root needed) in tests/e2e/xmpp and
|
|
# create the test accounts alice/alicepass and bob/bobpass.
|
|
# Requires: lua 5.4 headers, expat, openssl, curl, gcc, make.
|
|
set -e
|
|
D=$(cd "$(dirname "$0")" && pwd)
|
|
P=$D/xmpp
|
|
SRC=$D/xmpp-src
|
|
mkdir -p "$SRC" "$P/lib/lua/5.4" "$P/share/lua/5.4/lxp" "$P/data" "$P/certs"
|
|
cd "$SRC"
|
|
[ -d prosody-13.0.7 ] || curl -sL https://prosody.im/downloads/source/prosody-13.0.7.tar.gz | tar xz
|
|
[ -d luasocket-3.1.0 ] || curl -sL https://github.com/lunarmodules/luasocket/archive/refs/tags/v3.1.0.tar.gz | tar xz
|
|
[ -d luafilesystem-1_8_0 ] || curl -sL https://github.com/lunarmodules/luafilesystem/archive/refs/tags/v1_8_0.tar.gz | tar xz
|
|
[ -d luaexpat-1.5.2 ] || curl -sL https://github.com/lunarmodules/luaexpat/archive/refs/tags/1.5.2.tar.gz | tar xz
|
|
[ -d luasec-1.3.2 ] || curl -sL https://github.com/lunarmodules/luasec/archive/refs/tags/v1.3.2.tar.gz | tar xz
|
|
|
|
(cd luasocket-3.1.0 && make LUAV=5.4 LUAINC_linux=/usr/include/lua5.4 linux >/dev/null && make LUAV=5.4 prefix="$P" install >/dev/null)
|
|
gcc -O2 -fPIC -shared -I/usr/include/lua5.4 luafilesystem-1_8_0/src/lfs.c -o "$P/lib/lua/5.4/lfs.so"
|
|
gcc -O2 -fPIC -shared -I/usr/include/lua5.4 -Iluaexpat-1.5.2/src luaexpat-1.5.2/src/lxplib.c -lexpat -o "$P/lib/lua/5.4/lxp.so" 2>/dev/null
|
|
cp luaexpat-1.5.2/src/lxp/*.lua "$P/share/lua/5.4/lxp/"
|
|
(cd luasec-1.3.2 && make linux INC_PATH="-I/usr/include/lua5.4" LIB_PATH="" >/dev/null && make install LUAPATH="$P/share/lua/5.4" LUACPATH="$P/lib/lua/5.4" >/dev/null)
|
|
(cd prosody-13.0.7 && ./configure --lua-version=5.4 --with-lua-include=/usr/include/lua5.4 --prefix="$P/prosody" --no-example-certs >/dev/null && make >/dev/null && make install >/dev/null)
|
|
|
|
cat > "$P/prosody.cfg.lua" <<CFG
|
|
prosodyctl_service_warnings = false
|
|
pidfile = "$P/prosody.pid"
|
|
data_path = "$P/data"
|
|
certificates = "$P/certs"
|
|
log = { info = "$P/prosody.log"; error = "$P/prosody.err" }
|
|
c2s_ports = { 5222 }
|
|
http_ports = { 5280 }
|
|
http_interfaces = { "127.0.0.1" }
|
|
https_ports = {}
|
|
interfaces = { "127.0.0.1" }
|
|
c2s_require_encryption = false
|
|
allow_unencrypted_plain_auth = true
|
|
authentication = "internal_hashed"
|
|
allow_registration = true
|
|
modules_enabled = {
|
|
"roster"; "saslauth"; "disco"; "carbons"; "pep"; "private"; "blocklist";
|
|
"vcard4"; "vcard_legacy"; "version"; "uptime"; "time"; "ping"; "register";
|
|
"mam"; "csi_simple"; "smacks"; "bookmarks"; "server_contact_info";
|
|
}
|
|
modules_disabled = { "s2s"; "tls" }
|
|
archive_expires_after = "never"
|
|
default_archive_policy = true
|
|
http_host = "localhost"
|
|
http_external_url = "http://localhost:5280/"
|
|
VirtualHost "localhost"
|
|
Component "conference.localhost" "muc"
|
|
modules_enabled = { "muc_mam" }
|
|
Component "upload.localhost" "http_file_share"
|
|
http_file_share_size_limit = 20*1024*1024
|
|
CFG
|
|
|
|
"$D/prosody.sh" start
|
|
sleep 2
|
|
"$D/prosody.sh" register alice localhost alicepass || true
|
|
"$D/prosody.sh" register bob localhost bobpass || true
|
|
"$D/prosody.sh" register carol localhost carolpass || true
|
|
echo "Prosody is running on 127.0.0.1:5222"
|