Loading Dockerfile.cloudron +3 −2 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ RUN apt-get update && apt-get install -y \ git \ build-essential \ libolm-dev \ gosu \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* Loading @@ -36,8 +37,8 @@ COPY start.sh /app/pkg/ VOLUME /app/data ENV UID=1337 GID=1337 # Add health check endpoint # Add health check endpoint - check if the appservice port is responding HEALTHCHECK --interval=60s --timeout=10s --start-period=30s --retries=3 \ CMD curl -f http://localhost:29318/health || exit 1 CMD nc -z localhost 29318 || exit 1 CMD ["/app/pkg/start.sh"] No newline at end of file start.sh +40 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,46 @@ BACKUP_PATH="/app/data/config.yaml.bak" if [ ! -f "$CONFIG_PATH" ]; then echo "=> Generating example configuration" # Generate config as root first, then fix permissions /app/pkg/mautrix-whatsapp -g -c "$CONFIG_PATH" -r "$REGISTRATION_PATH" /app/pkg/mautrix-whatsapp -g -c "$CONFIG_PATH" -r "$REGISTRATION_PATH" || { echo "=> Config generation failed, creating minimal config" cat > "$CONFIG_PATH" << 'EOF' homeserver: address: https://matrix.example.com domain: example.com appservice: address: https://example.com hostname: 0.0.0.0 port: 29318 database: type: postgres uri: postgres://user:pass@localhost/db bridge: username_template: whatsapp_{{.}} displayname_template: "{{if .BusinessName}}{{.BusinessName}}{{else}}{{.PushName}}{{end}} (WA)" logging: handlers: file: filename: /app/data/logs/mautrix-whatsapp.log EOF cat > "$REGISTRATION_PATH" << 'EOF' id: whatsapp url: https://example.com as_token: generated_token hs_token: generated_token rate_limited: false sender_localpart: whatsappbot namespaces: users: - exclusive: true regex: '@whatsapp_.*:.*' aliases: - exclusive: true regex: '#whatsapp_.*:.*' EOF } # Configure for Cloudron environment if [ -n "${CLOUDRON_POSTGRESQL_URL:-}" ]; then Loading Loading
Dockerfile.cloudron +3 −2 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ RUN apt-get update && apt-get install -y \ git \ build-essential \ libolm-dev \ gosu \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* Loading @@ -36,8 +37,8 @@ COPY start.sh /app/pkg/ VOLUME /app/data ENV UID=1337 GID=1337 # Add health check endpoint # Add health check endpoint - check if the appservice port is responding HEALTHCHECK --interval=60s --timeout=10s --start-period=30s --retries=3 \ CMD curl -f http://localhost:29318/health || exit 1 CMD nc -z localhost 29318 || exit 1 CMD ["/app/pkg/start.sh"] No newline at end of file
start.sh +40 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,46 @@ BACKUP_PATH="/app/data/config.yaml.bak" if [ ! -f "$CONFIG_PATH" ]; then echo "=> Generating example configuration" # Generate config as root first, then fix permissions /app/pkg/mautrix-whatsapp -g -c "$CONFIG_PATH" -r "$REGISTRATION_PATH" /app/pkg/mautrix-whatsapp -g -c "$CONFIG_PATH" -r "$REGISTRATION_PATH" || { echo "=> Config generation failed, creating minimal config" cat > "$CONFIG_PATH" << 'EOF' homeserver: address: https://matrix.example.com domain: example.com appservice: address: https://example.com hostname: 0.0.0.0 port: 29318 database: type: postgres uri: postgres://user:pass@localhost/db bridge: username_template: whatsapp_{{.}} displayname_template: "{{if .BusinessName}}{{.BusinessName}}{{else}}{{.PushName}}{{end}} (WA)" logging: handlers: file: filename: /app/data/logs/mautrix-whatsapp.log EOF cat > "$REGISTRATION_PATH" << 'EOF' id: whatsapp url: https://example.com as_token: generated_token hs_token: generated_token rate_limited: false sender_localpart: whatsappbot namespaces: users: - exclusive: true regex: '@whatsapp_.*:.*' aliases: - exclusive: true regex: '#whatsapp_.*:.*' EOF } # Configure for Cloudron environment if [ -n "${CLOUDRON_POSTGRESQL_URL:-}" ]; then Loading