containered launch empty web status
This commit is contained in:
@@ -5,6 +5,12 @@ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
cd "${ROOT_DIR}/bridge"
|
||||
|
||||
if [[ ! -f Cargo.lock ]]; then
|
||||
echo "Cargo.lock is missing. Generate it first:" >&2
|
||||
echo " cd bridge && cargo generate-lockfile" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cargo fmt --all -- --check
|
||||
cargo check --workspace
|
||||
cargo test --workspace
|
||||
cargo check --workspace --locked
|
||||
cargo test --workspace --locked
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
cd "${ROOT_DIR}"
|
||||
|
||||
docker compose build mm-bridge
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
cd "${ROOT_DIR}"
|
||||
|
||||
docker compose down
|
||||
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
CERT_DIR="${ROOT_DIR}/docker/certs"
|
||||
TARGET="${CERT_DIR}/corporate-ca.crt"
|
||||
|
||||
SOURCE="${MM_CORPORATE_CA_FILE:-/etc/ssl/certs/ca-certificates.crt}"
|
||||
|
||||
if [[ ! -f "${SOURCE}" ]]; then
|
||||
echo "CA source not found: ${SOURCE}" >&2
|
||||
echo "Set MM_CORPORATE_CA_FILE to your corporate CA bundle path." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "${CERT_DIR}"
|
||||
cp "${SOURCE}" "${TARGET}"
|
||||
|
||||
echo "CA bundle copied:"
|
||||
echo " from: ${SOURCE}"
|
||||
echo " to: ${TARGET}"
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
cd "${ROOT_DIR}"
|
||||
|
||||
mkdir -p data
|
||||
|
||||
./scripts/docker-prepare-ca.sh
|
||||
|
||||
docker compose up -d --build mm-bridge
|
||||
|
||||
echo "Bridge TCP: 127.0.0.1:8765"
|
||||
echo "Web status: http://127.0.0.1:8766/"
|
||||
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
BASE_URL="${MM_WEB_URL:-http://127.0.0.1:8766}"
|
||||
|
||||
python3 - "$BASE_URL" <<'PY'
|
||||
import json
|
||||
import sys
|
||||
import urllib.request
|
||||
|
||||
# Ignore system proxy settings: we talk to localhost directly.
|
||||
proxy_handler = urllib.request.ProxyHandler({})
|
||||
opener = urllib.request.build_opener(proxy_handler)
|
||||
urllib.request.install_opener(opener)
|
||||
|
||||
base_url = sys.argv[1].rstrip("/")
|
||||
|
||||
def get_json(path):
|
||||
with urllib.request.urlopen(base_url + path, timeout=5) as response:
|
||||
body = response.read().decode("utf-8")
|
||||
return json.loads(body)
|
||||
|
||||
health = get_json("/health")
|
||||
print(json.dumps(health, ensure_ascii=False))
|
||||
if health.get("ok") is not True:
|
||||
raise SystemExit("/health is not ok")
|
||||
|
||||
status = get_json("/status")
|
||||
print(json.dumps(status, ensure_ascii=False))
|
||||
if status.get("bridge", {}).get("state") != "running":
|
||||
raise SystemExit("/status bridge.state is not running")
|
||||
|
||||
with urllib.request.urlopen(base_url + "/", timeout=5) as response:
|
||||
html = response.read().decode("utf-8")
|
||||
if "emacs-mattermost bridge" not in html:
|
||||
raise SystemExit("index page does not contain expected title")
|
||||
print("index html ok")
|
||||
PY
|
||||
Reference in New Issue
Block a user