Skip to content

Commit 5657afd

Browse files
committed
Initial commit: beacon-synapse v1.147.1
Production Matrix homeserver image for Tezos Beacon relay nodes. - Ed25519 crypto auth provider (derived from Papers/AirGap beacon-node) - Beacon monitor module (logfmt observability for room events, membership, logins) - Beacon info module (region and known servers endpoint) - Worker support (4 generic workers with metrics) - envsubst-based config templating - CI workflow for GHCR publishing on tagged releases
0 parents  commit 5657afd

20 files changed

+1758
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build and Publish Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
branches:
11+
- main
12+
workflow_dispatch:
13+
14+
env:
15+
REGISTRY: ghcr.io
16+
IMAGE_NAME: ${{ github.repository }}
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
packages: write
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Log in to Container Registry
33+
if: startsWith(github.ref, 'refs/tags/v')
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ${{ env.REGISTRY }}
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Extract metadata
41+
id: meta
42+
uses: docker/metadata-action@v5
43+
with:
44+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
45+
annotations: |
46+
org.opencontainers.image.description=Synapse homeserver with Ed25519 Beacon auth for Tezos dApp/wallet relay
47+
# Tag scheme: push v1.147.1-ecad.1 -> ghcr tags: v1.147.1-ecad.1, latest
48+
tags: |
49+
type=semver,pattern={{version}}
50+
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
51+
52+
- name: Build and push Docker image
53+
uses: docker/build-push-action@v6
54+
with:
55+
context: .
56+
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}
59+
annotations: ${{ steps.meta.outputs.annotations }}
60+
cache-from: type=gha
61+
cache-to: type=gha,mode=max

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
__pycache__/
2+
*.pyc
3+
.env
4+
.claude/settings.local.json

Dockerfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
FROM ghcr.io/element-hq/synapse:v1.147.1
2+
LABEL maintainer="ECAD Infra <ops@ecadinfra.com>"
3+
LABEL org.opencontainers.image.description="Synapse homeserver with Ed25519 Beacon auth for Tezos dApp/wallet relay"
4+
LABEL org.opencontainers.image.source="https://github.com/ECADInfra/beacon-synapse"
5+
LABEL org.opencontainers.image.licenses="AGPL-3.0-only"
6+
7+
# Install dependencies for crypto auth provider
8+
RUN apt-get update && apt-get install -y libsodium-dev gcc netcat-openbsd gettext-base && apt-get clean && rm -rf /var/lib/apt/lists/*
9+
10+
# Install Python packages
11+
RUN pip install --no-cache-dir psycopg2 pysodium
12+
13+
# Create keys and data directories
14+
RUN mkdir -p /keys /data
15+
16+
# Copy custom modules (using Python 3.13 path for Element HQ image)
17+
COPY crypto_auth_provider.py /usr/local/lib/python3.13/site-packages/
18+
COPY beacon_info_module.py /usr/local/lib/python3.13/site-packages/
19+
COPY beacon_monitor_module.py /usr/local/lib/python3.13/site-packages/
20+
21+
# Copy configuration templates (envsubst at runtime) and static configs
22+
COPY homeserver.yaml /config/homeserver.yaml.template
23+
COPY synapse.log.config /config/
24+
COPY shared_config.yaml /config/shared_config.yaml.template
25+
26+
# Copy worker configuration templates
27+
COPY workers /config/workers.template
28+
29+
# Increase max event size (1MB instead of default 64KB).
30+
# Beacon messages can exceed the default Matrix PDU size limit.
31+
RUN sed -i 's/65536/1048576/' /usr/local/lib/python3.13/site-packages/synapse/api/constants.py && \
32+
grep -q '1048576' /usr/local/lib/python3.13/site-packages/synapse/api/constants.py || \
33+
(echo "FATAL: PDU size patch failed - 65536 not found in constants.py. Upstream may have changed." >&2 && exit 1)
34+
35+
COPY wait-for.sh /usr/local/bin/
36+
COPY synctl_entrypoint.sh /usr/local/bin/
37+
38+
# Expose ports:
39+
# 8008: HTTP (client and federation)
40+
# 19090: Metrics for main process (when SYNAPSE_ENABLE_METRICS=1)
41+
# 19091-19094: Metrics for workers 1-4 (when SYNAPSE_ENABLE_METRICS=1 and SYNAPSE_WORKERS=true)
42+
EXPOSE 8008 19090 19091 19092 19093 19094
43+
44+
ENTRYPOINT ["/usr/local/bin/synctl_entrypoint.sh"]

0 commit comments

Comments
 (0)