41 lines
1.3 KiB
Bash
Executable File
41 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Generate DB password
|
|
DB_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)
|
|
|
|
# Replace the default password in docker-compose.yml
|
|
sed -i "s/POSTGRES_PASSWORD: itsasecret/POSTGRES_PASSWORD: $DB_PASSWORD/" docker-compose.yml
|
|
|
|
# Prompt for domain input
|
|
read -p "Enter your domain (e.g., example.com): " DOMAIN
|
|
if [[ -z "$DOMAIN" ]]; then
|
|
echo "Domain cannot be empty. Exiting."
|
|
exit 1
|
|
fi
|
|
|
|
# Generate private keys
|
|
echo "Generating private keys..."
|
|
docker run --rm --entrypoint="/usr/bin/generate-keys" \
|
|
-v $(pwd)/config/dendrite:/mnt \
|
|
matrixdotorg/dendrite-monolith:latest \
|
|
-private-key /mnt/matrix_key.pem
|
|
|
|
# Generate configuration
|
|
echo "Generating configuration with domain: $DOMAIN..."
|
|
docker run --rm --entrypoint="/bin/sh" \
|
|
-v $(pwd)/config/dendrite:/mnt \
|
|
matrixdotorg/dendrite-monolith:latest \
|
|
-c "/usr/bin/generate-config \
|
|
-dir /var/dendrite/ \
|
|
-db postgres://dendrite:$DB_PASSWORD@postgres/dendrite?sslmode=disable \
|
|
-server $DOMAIN > /mnt/dendrite.yaml"
|
|
|
|
# Generate and display the registration shared secret
|
|
SHARED_SECRET=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 50)
|
|
echo
|
|
echo "Registration shared secret: $SHARED_SECRET"
|
|
echo "Make sure to copy it!"
|
|
echo
|
|
echo "Database URI: postgres://dendrite:$DB_PASSWORD@postgres/dendrite?sslmode=disable"
|
|
echo "Make sure to save this information securely!"
|