-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·84 lines (68 loc) · 2.14 KB
/
setup.sh
File metadata and controls
executable file
·84 lines (68 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
# Matrix Stack Setup Script
# This script configures the stack with user-provided secrets
set -e
echo "=== Local Matrix Stack Setup ==="
echo ""
# Check for .env file
if [ ! -f .env ]; then
echo "Error: .env file not found. Copy .env.example to .env and edit it."
exit 1
fi
source .env
# Validate variables
if [ -z "$MATRIX_SERVER_NAME" ] || [ "$MATRIX_SERVER_NAME" = "matrix.example.com" ]; then
echo "Error: Please set MATRIX_SERVER_NAME in .env"
exit 1
fi
if [ -z "$LIVEKIT_DOMAIN" ] || [ "$LIVEKIT_DOMAIN" = "livekit.example.com" ]; then
echo "Error: Please set LIVEKIT_DOMAIN in .env"
exit 1
fi
if [ -z "$POSTGRES_PASSWORD" ]; then
echo "Error: Please set POSTGRES_PASSWORD in .env"
exit 1
fi
if [ -z "$LIVEKIT_SECRET" ]; then
echo "Error: Please set LIVEKIT_SECRET in .env"
exit 1
fi
# Update LIVEKIT_URL if not set
if [ -z "$LIVEKIT_URL" ]; then
LIVEKIT_URL="wss://${LIVEKIT_DOMAIN}"
fi
echo ""
echo "Updating configuration files..."
# Create directories
mkdir -p synapse/data
mkdir -p synapse/data/media_store
mkdir -p postgres/data
# Generate Synapse signing key (one-time, persistent)
if [ ! -f synapse/data/${MATRIX_SERVER_NAME}.signing.key ]; then
echo "Generating Synapse signing key..."
python3 -c "
import os
key = ''
for _ in range(4):
key += os.urandom(32).hex()
print(f'ed25519 a_iKyM {key}')
" > synapse/data/${MATRIX_SERVER_NAME}.signing.key
else
echo "Using existing Synapse signing key"
fi
# Update synapse config
sed -i "s/YOUR_MATRIX_DOMAIN/${MATRIX_SERVER_NAME}/g" synapse/data/homeserver.yaml
sed -i "s/REPLACE_WITH_GENERATED_SECRET/${POSTGRES_PASSWORD}/g" synapse/data/homeserver.yaml
# Update log config
sed -i "s|SERVER_NAME|${MATRIX_SERVER_NAME}|g" synapse/data/log.config
# Update livekit config
sed -i "s/REPLACE_WITH_GENERATED_SECRET/${LIVEKIT_SECRET}/g" livekit/livekit.yaml
echo ""
echo "=== Setup Complete ==="
echo ""
echo "Next steps:"
echo "1. Review and update your reverse proxy configuration"
echo "2. Run: docker compose up -d"
echo "3. Register your first user:"
echo " docker exec -it matrix-synapse register_new_matrix_user http://localhost:8008"
echo ""