Skip to content

Deploying Wekan (kanban) on AlmaLinux 9 (production-ready)

Stand up a hardened Wekan kanban on AlmaLinux 9 — MongoDB 6 replica-set, LDAP integration against OpenLDAP, nginx + Let's Encrypt, oplog-aware backups.

You’re rolling Wekan out as the kanban for support, sustaining, and the operations rota — three teams that already live in OpenLDAP for everything else. The Snap installer is the path of least resistance for a proof of concept, the first board is moving cards within an afternoon, and by week three the support lead is asking why every new hire has to be added manually, why the user list looks nothing like the directory tree, and why a routine MongoDB restart cost forty-five minutes because the WiredTiger checkpoint was mid-write when the host went down. The Snap shipped a single-instance MongoDB with no replica set, no oplog to roll forward from, and an embedded login table with no link to the directory. The kanban itself works fine; the integration around it is the part that wasn’t built.

What’s happening

Wekan is a Meteor.js application backed by MongoDB. Two things make a production Wekan deployment different from the Snap quickstart: MongoDB has to run as a single-node replica set (not a standalone instance) so the oplog exists, and authentication has to go through your existing directory. The replica-set requirement is non-negotiable for point-in-time recovery — without an oplog, the only recovery surface is the nightly mongodump, which means anything between dump and incident is gone. Single-node replica sets give you the oplog mechanics of HA without the operational cost of a quorum. Wekan reads MongoDB through MONGO_URL and writes through MONGO_OPLOG_URL; both have to point at the same instance with ?replicaSet=rs0 in the URI or Wekan’s reactive UI updates won’t propagate. LDAP integration is configured through environment variables — LDAP_ENABLE=true, LDAP_URL, LDAP_BASEDN, attribute mappings — and Wekan caches LDAP responses in MongoDB, so first sign-in creates the local user record while subsequent sign-ins reuse it. Done correctly, removing a user from LDAP locks them out immediately; done sloppily, the local record outlives the directory entry indefinitely.

How to verify

The host should expose only :443 and :22:

ss -lntp | grep -E ':(80|443|3001|27017)\b'
# 0.0.0.0:443  nginx
# 127.0.0.1:3001  wekan (node)
# 127.0.0.1:27017 mongod

MongoDB must not appear on the public NIC. The replica-set status should report one healthy primary:

mongosh --quiet --eval 'rs.status().members.map(m => ({name: m.name, state: m.stateStr}))'
# [ { name: '127.0.0.1:27017', state: 'PRIMARY' } ]

The oplog should exist and have a useful window:

mongosh --quiet --eval 'db.getReplicationInfo()'
# { logSizeMB: 2048, usedMB: 412.3, timeDiff: 86400, timeDiffHours: 24, ... }

A timeDiffHours below 12 on a busy system means the oplog is too small to roll forward through a routine evening of activity — increase replSetOpLogSizeMB. The Wekan environment file should reference the replica set:

grep -E '^(MONGO_URL|MONGO_OPLOG_URL|LDAP_ENABLE)' /etc/wekan/wekan.env
# MONGO_URL=mongodb://wekan:...@127.0.0.1:27017/wekan?replicaSet=rs0&authSource=wekan
# MONGO_OPLOG_URL=mongodb://wekan:...@127.0.0.1:27017/local?replicaSet=rs0&authSource=admin
# LDAP_ENABLE=true

If MONGO_OPLOG_URL is missing, Wekan falls back to MongoDB polling and the UI feels broken for everyone on the same board. The LDAP test endpoint should accept a directory bind:

ldapsearch -x -H ldaps://ldap.example.com -D "cn=wekan,ou=service,dc=example,dc=com" \
  -w "$(cat /etc/wekan/ldap.secret)" \
  -b "ou=people,dc=example,dc=com" "(uid=alice)" cn mail

If that returns the user object, Wekan will accept their first sign-in and create the local record.

The fix

Save the script below as /root/setup-wekan-almalinux9.sh, then run it. It installs Wekan on a fresh AlmaLinux 9 VM: base hardening (SELinux enforcing, fail2ban, dnf-automatic, SSH key-only), firewalld (SSH + HTTP + HTTPS), MongoDB 6 from the official mongodb-org repository configured as a single-node replica set with a properly sized oplog, the wekan MongoDB user, Wekan from the official Snap-free distribution tarball (since the Snap forces its own MongoDB bundle), a systemd unit that loads /etc/wekan/wekan.env, LDAP environment variables pointed at your directory, nginx in front with Let’s Encrypt, and a poll loop that fails loudly if the Wekan process doesn’t start.

#!/usr/bin/env bash
set -euo pipefail

### AlmaLinux 9 Wekan installer
### MongoDB 6 single-node replica set with oplog
### LDAP integration against an existing directory
### Keeps root SSH key login enabled
### Disables SSH password login
### Enables automatic security updates
### No local backups; assumes VM-level backup + scheduled mongodump

if [[ "$(id -u)" -ne 0 ]]; then
  echo "Run as root."
  exit 1
fi

: "${WEKAN_DOMAIN:?Set WEKAN_DOMAIN=board.example.com}"
: "${WEKAN_EMAIL:?Set WEKAN_EMAIL=ops@example.com for Let's Encrypt}"
: "${LDAP_URL:?Set LDAP_URL=ldaps://ldap.example.com:636}"
: "${LDAP_BASE_DN:?Set LDAP_BASE_DN=ou=people,dc=example,dc=com}"
: "${LDAP_BIND_DN:?Set LDAP_BIND_DN=cn=wekan,ou=service,dc=example,dc=com}"
: "${LDAP_BIND_PW:?Set LDAP_BIND_PW=...}"

WEKAN_VERSION="${WEKAN_VERSION:-v7.61}"
MONGO_WEKAN_PASSWORD="${MONGO_WEKAN_PASSWORD:-$(openssl rand -hex 24)}"
MONGO_ROOT_PASSWORD="${MONGO_ROOT_PASSWORD:-$(openssl rand -hex 24)}"

echo
echo "========================================"
echo "Wekan AlmaLinux 9 Setup"
echo "========================================"
echo

echo "==> Updating base OS"
dnf -y update
dnf -y install epel-release
dnf -y install vim curl wget chrony fail2ban dnf-automatic \
  policycoreutils-python-utils lsof tcpdump bind-utils tar gzip xz \
  iproute net-tools openssl jq socat openldap-clients

systemctl enable --now chronyd

echo "==> SELinux enforcing"
sed -i 's/^SELINUX=.*/SELINUX=enforcing/' /etc/selinux/config
setenforce 1 || true

echo "==> Kernel/sysctl tuning"
cat > /etc/sysctl.d/99-wekan.conf <<'SYSCTL'
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
net.core.somaxconn = 4096
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_local_port_range = 10240 65535
vm.swappiness = 1
fs.file-max = 2097152
kernel.dmesg_restrict = 1
SYSCTL
modprobe tcp_bbr || true
echo tcp_bbr > /etc/modules-load.d/bbr.conf
sysctl --system

cat > /etc/security/limits.d/99-wekan.conf <<'LIMITS'
mongod soft nofile 64000
mongod hard nofile 64000
wekan soft nofile 64000
wekan hard nofile 64000
LIMITS

echo "==> Configuring firewalld"
dnf -y install firewalld
systemctl enable --now firewalld
firewall-cmd --permanent --add-service=ssh
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload

echo "==> Hardening SSH"
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak.$(date +%F-%H%M%S)
sed -i 's|^[#[:space:]]*PermitRootLogin.*|PermitRootLogin prohibit-password|' /etc/ssh/sshd_config
sed -i 's|^[#[:space:]]*PasswordAuthentication.*|PasswordAuthentication no|' /etc/ssh/sshd_config
sed -i 's|^[#[:space:]]*X11Forwarding.*|X11Forwarding no|' /etc/ssh/sshd_config
sshd -t && systemctl restart sshd

echo "==> fail2ban + automatic security updates"
cat > /etc/fail2ban/jail.d/sshd.local <<'FAIL2BAN'
[sshd]
enabled = true
port = ssh
backend = systemd
maxretry = 4
findtime = 10m
bantime = 1h
FAIL2BAN
systemctl enable --now fail2ban

cat > /etc/dnf/automatic.conf <<'DNFAUTO'
[commands]
upgrade_type = security
random_sleep = 900
download_updates = yes
apply_updates = yes
[emitters]
emit_via = stdio
DNFAUTO
systemctl enable --now dnf-automatic.timer

echo "==> Installing MongoDB 6"
cat > /etc/yum.repos.d/mongodb-org-6.0.repo <<'EOF'
[mongodb-org-6.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/9/mongodb-org/6.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc
EOF

dnf -y install mongodb-org

# OpenSSL keyfile for the single-node replica set
mkdir -p /etc/mongod
openssl rand -base64 756 > /etc/mongod/keyfile
chown mongod:mongod /etc/mongod/keyfile
chmod 400 /etc/mongod/keyfile

cat > /etc/mongod.conf <<EOF
systemLog:
  destination: file
  path: /var/log/mongodb/mongod.log
  logAppend: true
storage:
  dbPath: /var/lib/mongo
  engine: wiredTiger
processManagement:
  pidFilePath: /var/run/mongodb/mongod.pid
  timeZoneInfo: /usr/share/zoneinfo
net:
  port: 27017
  bindIp: 127.0.0.1
  maxIncomingConnections: 4000
security:
  authorization: enabled
  keyFile: /etc/mongod/keyfile
replication:
  replSetName: rs0
  oplogSizeMB: 4096
EOF

systemctl enable --now mongod

echo "==> Waiting for mongod"
for i in {1..60}; do
  if mongosh --quiet --eval 'db.runCommand({ping:1}).ok' 2>/dev/null | grep -q 1; then break; fi
  sleep 2
done

echo "==> Initiating replica set"
mongosh --quiet <<EOF
rs.initiate({ _id: "rs0", members: [{ _id: 0, host: "127.0.0.1:27017" }] })
EOF

# Wait for PRIMARY
for i in {1..60}; do
  STATE=$(mongosh --quiet --eval 'rs.status().myState' 2>/dev/null | tr -d '\r' || true)
  if [[ "${STATE}" == "1" ]]; then break; fi
  sleep 2
done

echo "==> Creating MongoDB users"
mongosh --quiet <<EOF
use admin
db.createUser({user:"root", pwd:"${MONGO_ROOT_PASSWORD}", roles:[{role:"root", db:"admin"}]})
use wekan
db.createUser({user:"wekan", pwd:"${MONGO_WEKAN_PASSWORD}", roles:[
  {role:"readWrite", db:"wekan"},
  {role:"read", db:"local"}
]})
EOF

echo "==> Creating wekan service user"
useradd -r -m -d /opt/wekan -s /usr/sbin/nologin wekan || true

echo "==> Installing Node.js 14 (Wekan requirement)"
curl -fsSL https://rpm.nodesource.com/setup_14.x | bash -
dnf -y install nodejs

echo "==> Fetching Wekan ${WEKAN_VERSION}"
cd /opt/wekan
curl -fsSL -o wekan.tar.gz \
  "https://github.com/wekan/wekan/releases/download/${WEKAN_VERSION}/wekan-${WEKAN_VERSION#v}.tar.gz"
tar xzf wekan.tar.gz
mv bundle wekan-app
rm wekan.tar.gz
cd wekan-app/programs/server
npm install --production --unsafe-perm
cd /opt/wekan
chown -R wekan:wekan /opt/wekan

mkdir -p /etc/wekan
cat > /etc/wekan/wekan.env <<EOF
NODE_ENV=production
PORT=3001
MONGO_URL=mongodb://wekan:${MONGO_WEKAN_PASSWORD}@127.0.0.1:27017/wekan?replicaSet=rs0&authSource=wekan
MONGO_OPLOG_URL=mongodb://wekan:${MONGO_WEKAN_PASSWORD}@127.0.0.1:27017/local?replicaSet=rs0&authSource=wekan
ROOT_URL=https://${WEKAN_DOMAIN}
MAIL_URL=
MAIL_FROM=Wekan <wekan@${WEKAN_DOMAIN}>
WITH_API=true
RICHER_CARD_COMMENT_EDITOR=true
NOTIFICATION_TRAY_AFTER_READ_DAYS_BEFORE_REMOVE=14
DEFAULT_AUTHENTICATION_METHOD=ldap

LDAP_ENABLE=true
LDAP_PORT=636
LDAP_HOST=$(echo ${LDAP_URL} | sed -E 's|^ldaps?://([^:/]+).*|\1|')
LDAP_BASEDN=${LDAP_BASE_DN}
LDAP_LOGIN_FALLBACK=false
LDAP_RECONNECT=true
LDAP_TIMEOUT=10000
LDAP_IDLE_TIMEOUT=10000
LDAP_CONNECT_TIMEOUT=10000
LDAP_AUTHENTIFICATION=true
LDAP_AUTHENTIFICATION_USERDN=${LDAP_BIND_DN}
LDAP_AUTHENTIFICATION_PASSWORD=${LDAP_BIND_PW}
LDAP_ENCRYPTION=ssl
LDAP_USER_SEARCH_FILTER=(objectClass=inetOrgPerson)
LDAP_USER_SEARCH_SCOPE=sub
LDAP_USER_SEARCH_FIELD=uid
LDAP_SEARCH_PAGE_SIZE=200
LDAP_SEARCH_SIZE_LIMIT=2000
LDAP_GROUP_FILTER_ENABLE=true
LDAP_GROUP_FILTER_OBJECTCLASS=groupOfNames
LDAP_GROUP_FILTER_GROUP_ID_ATTRIBUTE=cn
LDAP_GROUP_FILTER_GROUP_MEMBER_ATTRIBUTE=member
LDAP_GROUP_FILTER_GROUP_NAME=wekan-users
LDAP_USERNAME_FIELD=uid
LDAP_FULLNAME_FIELD=cn
LDAP_EMAIL_FIELD=mail
LDAP_SYNC_USER_DATA=true
LDAP_SYNC_USER_DATA_FIELDMAP={"cn":"name","mail":"email"}
EOF

chown root:wekan /etc/wekan/wekan.env
chmod 640 /etc/wekan/wekan.env

cat > /etc/systemd/system/wekan.service <<'WEKAN'
[Unit]
Description=Wekan kanban
After=network.target mongod.service
Wants=mongod.service

[Service]
Type=simple
User=wekan
Group=wekan
WorkingDirectory=/opt/wekan/wekan-app
EnvironmentFile=/etc/wekan/wekan.env
ExecStart=/usr/bin/node main.js
Restart=on-failure
RestartSec=5
LimitNOFILE=64000
StandardOutput=append:/var/log/wekan.log
StandardError=append:/var/log/wekan.log

[Install]
WantedBy=multi-user.target
WEKAN

touch /var/log/wekan.log
chown wekan:wekan /var/log/wekan.log

systemctl daemon-reload
systemctl enable --now wekan

echo "==> Waiting for Wekan on 127.0.0.1:3001"
for i in {1..120}; do
  if ss -lntp | grep -q '127.0.0.1:3001'; then break; fi
  sleep 2
done

if ! ss -lntp | grep -q '127.0.0.1:3001'; then
  echo "Wekan failed to listen on 127.0.0.1:3001"
  journalctl -u wekan --no-pager -n 200 || true
  exit 1
fi

echo "==> Installing nginx + certbot"
dnf -y install nginx
dnf -y install certbot python3-certbot-nginx

cat > /etc/nginx/conf.d/wekan.conf <<NGINX
upstream wekan_backend {
    server 127.0.0.1:3001;
    keepalive 32;
}

server {
    listen 80;
    server_name ${WEKAN_DOMAIN};
    return 301 https://\$host\$request_uri;
}

server {
    listen 443 ssl http2;
    server_name ${WEKAN_DOMAIN};

    client_max_body_size 100M;
    proxy_read_timeout   600s;
    proxy_send_timeout   600s;

    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    add_header X-Content-Type-Options nosniff always;
    add_header X-Frame-Options SAMEORIGIN always;
    add_header Referrer-Policy strict-origin-when-cross-origin always;

    location / {
        proxy_set_header Host \$host;
        proxy_set_header X-Real-IP \$remote_addr;
        proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto \$scheme;
        proxy_set_header Upgrade \$http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_http_version 1.1;
        proxy_pass http://wekan_backend;
    }
}
NGINX

# Remove default
rm -f /etc/nginx/conf.d/default.conf

nginx -t
systemctl enable --now nginx
systemctl reload nginx

echo "==> Requesting Let's Encrypt certificate"
certbot --nginx --non-interactive --agree-tos \
  -m "${WEKAN_EMAIL}" -d "${WEKAN_DOMAIN}" --redirect

systemctl enable --now certbot.timer

echo "==> Installing nightly mongodump (secondary backup layer)"
mkdir -p /var/backups/wekan
chmod 700 /var/backups/wekan

cat > /usr/local/sbin/wekan-backup.sh <<EOF
#!/usr/bin/env bash
set -euo pipefail
TS=\$(date +%F-%H%M)
mongodump --uri "mongodb://root:${MONGO_ROOT_PASSWORD}@127.0.0.1:27017/?authSource=admin" \\
  --db wekan --gzip --archive=/var/backups/wekan/wekan-\${TS}.gz
find /var/backups/wekan -name 'wekan-*.gz' -mtime +14 -delete
EOF
chmod 700 /usr/local/sbin/wekan-backup.sh

cat > /etc/systemd/system/wekan-backup.service <<'EOF'
[Unit]
Description=Wekan nightly mongodump
After=mongod.service

[Service]
Type=oneshot
ExecStart=/usr/local/sbin/wekan-backup.sh
EOF

cat > /etc/systemd/system/wekan-backup.timer <<'EOF'
[Unit]
Description=Daily Wekan backup

[Timer]
OnCalendar=*-*-* 03:25:00
RandomizedDelaySec=600
Persistent=true

[Install]
WantedBy=timers.target
EOF

systemctl daemon-reload
systemctl enable --now wekan-backup.timer

echo "==> Final package update"
dnf -y update

echo
echo "========================================"
echo "DONE"
echo "========================================"
echo
echo "Listeners:"
ss -lntp | grep -E ':(80|443|3001|27017)\b' || true
echo
echo "Replica set status:"
mongosh --quiet -u root -p "${MONGO_ROOT_PASSWORD}" --authenticationDatabase admin \
  --eval 'rs.status().myState' || true
echo
echo "Oplog window:"
mongosh --quiet -u root -p "${MONGO_ROOT_PASSWORD}" --authenticationDatabase admin \
  --eval 'db.getSiblingDB("local").oplog.rs.stats().size + " bytes"' || true
echo
echo "Wekan service:"
systemctl is-active wekan mongod nginx fail2ban
echo
echo "Web UI:"
echo "https://${WEKAN_DOMAIN}/"
echo
echo "First steps:"
echo "1. Open the URL — sign in as an LDAP user that belongs to the 'wekan-users' group."
echo "2. First sign-in creates the Wekan account; admin status must be granted via the Admin Panel by the first admin."
echo "3. Promote the first admin via MongoDB:"
echo "   mongosh -u root -p '...' --authenticationDatabase admin"
echo "   use wekan"
echo "   db.users.updateOne({username:'<uid>'}, {\$set:{isAdmin:true}})"

Make it executable and run it:

chmod 700 /root/setup-wekan-almalinux9.sh
WEKAN_DOMAIN=board.example.com \
WEKAN_EMAIL=ops@example.com \
LDAP_URL=ldaps://ldap.example.com:636 \
LDAP_BASE_DN=ou=people,dc=example,dc=com \
LDAP_BIND_DN=cn=wekan,ou=service,dc=example,dc=com \
LDAP_BIND_PW=$(cat /root/.ldap-wekan.secret) \
/root/setup-wekan-almalinux9.sh

Sign in as an LDAP user that belongs to the wekan-users group; the first sign-in creates the local Wekan record. Promote that user to admin through the MongoDB shell — Wekan doesn’t ship a first-user-becomes-admin path, so the one-line update is the entry point. Once you have one admin in place, you can manage further admin promotions through the Wekan Admin Panel. Confirm the oplog window is at least 24 hours under normal load: mongosh --eval 'db.getReplicationInfo().timeDiffHours'. If it drops below 12 on busy weeks, bump replication.oplogSizeMB in /etc/mongod.conf and restart mongod — the replica-set quorum of one means restarts are still single-node downtime, not zero. Confirm the nightly mongodump lands in /var/backups/wekan/; the dump plus the oplog is the recovery surface, and the VM-level backup is what catches the dump.

For a Wekan tier you don’t have to operate yourself, run it on our managed cloud compute with patching, monitoring, and Sev-1 escalation in place — or start a scoping call if you’d like us to plan the LDAP wiring and MongoDB sizing up front.