Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
195b261
docs: add LightBridge Mail Service implementation plan
WilliamWang1721 Jun 12, 2026
62a750c
feat(lbms): add mail service sidecar scaffold
WilliamWang1721 Jun 12, 2026
369b408
feat(lbms): add mail service sidecar server
WilliamWang1721 Jun 12, 2026
86b0cd2
docs(lbms): add mail service sidecar readme
WilliamWang1721 Jun 12, 2026
44db97d
build(lbms): add mail service dockerfile
WilliamWang1721 Jun 12, 2026
48e13f5
deploy(lbms): add optional mail service compose file
WilliamWang1721 Jun 12, 2026
261647e
deploy(lbms): add mail service env example
WilliamWang1721 Jun 12, 2026
8bd5467
deploy(lbms): add systemd unit
WilliamWang1721 Jun 12, 2026
3b1d0bb
deploy(lbms): add mail service installer
WilliamWang1721 Jun 12, 2026
27420ed
feat(lbms): add mail service module manifest template
WilliamWang1721 Jun 12, 2026
ab8e542
feat(lbms): add mail service frontend module scaffold
WilliamWang1721 Jun 12, 2026
7b9dd1d
fix(lbms): align compose network with LightBridge deployment
WilliamWang1721 Jun 12, 2026
5b93998
feat(mailservice): persist mailbox bindings to disk
WilliamWang1721 Jun 13, 2026
62b7a6e
chore(mailservice): persist docker data in named volume
WilliamWang1721 Jun 13, 2026
626067e
chore(mailservice): expose persistent data volume
WilliamWang1721 Jun 13, 2026
1cd843e
docs(mailservice): describe durable JSON store and mailbox APIs
WilliamWang1721 Jun 13, 2026
d7759d6
chore(mailservice): set data path in systemd installer
WilliamWang1721 Jun 13, 2026
a7aa45e
test(mailservice): cover mailbox binding persistence
WilliamWang1721 Jun 13, 2026
53b6b73
feat(mailservice-ui): load mailbox metrics from LBMS API
WilliamWang1721 Jun 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions deploy/LightBridge-mail-service.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[Unit]
Description=LightBridge Mail Service
After=network.target LightBridge.service
Wants=network.target

[Service]
Type=simple
User=LightBridge
Group=LightBridge
WorkingDirectory=/opt/LightBridge
EnvironmentFile=-/etc/LightBridge/mail-service.env
ExecStart=/opt/LightBridge/lightbridge-mail-service
Restart=always
RestartSec=5s
LimitNOFILE=100000
NoNewPrivileges=true
PrivateTmp=true
ReadWritePaths=/var/lib/LightBridge/mail-service

[Install]
WantedBy=multi-user.target
33 changes: 33 additions & 0 deletions deploy/docker-compose.mail-service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
services:
mail-service:
build:
context: ../mailservice
dockerfile: Dockerfile
container_name: LightBridge-mail-service
restart: unless-stopped
ports:
- "${LBMS_BIND_HOST:-127.0.0.1}:${LBMS_PORT:-8091}:8091"
environment:
LBMS_HOST: 0.0.0.0
LBMS_PORT: 8091
LBMS_API_KEY: ${LBMS_API_KEY:?LBMS_API_KEY is required}
LBMS_DATA_PATH: /data/lbms-store.json
LBMS_DRIVER: ${LBMS_DRIVER:-outlook_email_plus}
LBMS_DRIVER_BASE_URL: ${LBMS_DRIVER_BASE_URL:-http://outlook-mail-plus:5000}
LBMS_DRIVER_API_KEY: ${LBMS_DRIVER_API_KEY:?LBMS_DRIVER_API_KEY is required}
LBMS_REQUEST_TIMEOUT_SECONDS: ${LBMS_REQUEST_TIMEOUT_SECONDS:-10}
LBMS_VERIFICATION_CACHE_SECONDS: ${LBMS_VERIFICATION_CACHE_SECONDS:-30}
LIGHTBRIDGE_BASE_URL: ${LIGHTBRIDGE_BASE_URL:-http://LightBridge:8080}
volumes:
- mail_service_data:/data
depends_on:
- LightBridge
networks:
- LightBridge-network

volumes:
mail_service_data:

networks:
LightBridge-network:
driver: bridge
111 changes: 111 additions & 0 deletions deploy/install-mail-service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#!/usr/bin/env bash
set -euo pipefail

SERVICE_NAME="LightBridge-mail-service"
INSTALL_DIR="/opt/LightBridge"
DATA_DIR="/var/lib/LightBridge/mail-service"
ENV_DIR="/etc/LightBridge"
ENV_FILE="${ENV_DIR}/mail-service.env"
SYSTEMD_FILE="/etc/systemd/system/${SERVICE_NAME}.service"
BINARY_SOURCE=""

usage() {
cat <<'USAGE'
Install LightBridge Mail Service as an optional systemd sidecar.

Usage:
sudo ./install-mail-service.sh --binary ./lightbridge-mail-service

Options:
--binary PATH Path to a prebuilt lightbridge-mail-service binary.
-h, --help Show help.
USAGE
}

while [[ $# -gt 0 ]]; do
case "$1" in
--binary)
BINARY_SOURCE="${2:-}"
shift 2
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown argument: $1" >&2
usage
exit 1
;;
esac
done

if [[ -z "${BINARY_SOURCE}" ]]; then
echo "--binary is required" >&2
usage
exit 1
fi

if [[ ! -f "${BINARY_SOURCE}" ]]; then
echo "Binary not found: ${BINARY_SOURCE}" >&2
exit 1
fi

if [[ "${EUID}" -ne 0 ]]; then
echo "Please run as root or with sudo." >&2
exit 1
fi

if ! id -u LightBridge >/dev/null 2>&1; then
useradd --system --home-dir "${INSTALL_DIR}" --shell /usr/sbin/nologin LightBridge
fi

mkdir -p "${INSTALL_DIR}" "${DATA_DIR}" "${ENV_DIR}"
install -m 0755 "${BINARY_SOURCE}" "${INSTALL_DIR}/lightbridge-mail-service"
chown -R LightBridge:LightBridge "${DATA_DIR}"

if [[ ! -f "${ENV_FILE}" ]]; then
cat > "${ENV_FILE}" <<'ENV'
LBMS_HOST=0.0.0.0
LBMS_PORT=8091
LBMS_API_KEY=change-me-to-a-long-random-value
LBMS_DATA_PATH=/var/lib/LightBridge/mail-service/lbms-store.json
LBMS_DRIVER=outlook_email_plus
LBMS_DRIVER_BASE_URL=http://127.0.0.1:5000
LBMS_DRIVER_API_KEY=change-me-driver-key
LBMS_REQUEST_TIMEOUT_SECONDS=10
LBMS_VERIFICATION_CACHE_SECONDS=30
LIGHTBRIDGE_BASE_URL=http://127.0.0.1:8080
ENV
chmod 0600 "${ENV_FILE}"
fi

cat > "${SYSTEMD_FILE}" <<'UNIT'
[Unit]
Description=LightBridge Mail Service
After=network.target LightBridge.service
Wants=network.target

[Service]
Type=simple
User=LightBridge
Group=LightBridge
WorkingDirectory=/opt/LightBridge
EnvironmentFile=-/etc/LightBridge/mail-service.env
ExecStart=/opt/LightBridge/lightbridge-mail-service
Restart=always
RestartSec=5s
LimitNOFILE=100000
NoNewPrivileges=true
PrivateTmp=true
ReadWritePaths=/var/lib/LightBridge/mail-service

[Install]
WantedBy=multi-user.target
UNIT

systemctl daemon-reload
systemctl enable "${SERVICE_NAME}.service"

echo "Installed ${SERVICE_NAME}."
echo "Edit ${ENV_FILE}, then start with: sudo systemctl start ${SERVICE_NAME}.service"
17 changes: 17 additions & 0 deletions deploy/mail-service.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# LightBridge Mail Service optional sidecar configuration
# Copy this file to /etc/LightBridge/mail-service.env for systemd deployments,
# or export the variables before using deploy/docker-compose.mail-service.yml.

LBMS_HOST=0.0.0.0
LBMS_PORT=8091
LBMS_API_KEY=change-me-to-a-long-random-value

# Internal driver configuration. Keep these values server-side only.
LBMS_DRIVER=outlook_email_plus
LBMS_DRIVER_BASE_URL=http://127.0.0.1:5000
LBMS_DRIVER_API_KEY=change-me-driver-key

LBMS_REQUEST_TIMEOUT_SECONDS=10
LBMS_VERIFICATION_CACHE_SECONDS=30

LIGHTBRIDGE_BASE_URL=http://127.0.0.1:8080
Loading
Loading