-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from matrix-org/rav/synapse
Add support for running synapse
- Loading branch information
Showing
7 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# A dockerfile which builds an image suitable for testing Synapse under | ||
# complement. | ||
# | ||
# Currently this is based on the published 'synapse:latest' image -- ie, the | ||
# most recent Synapse release. | ||
# | ||
# Also... none of the tests seem to pass yet. They do run though. | ||
# | ||
# To use it: | ||
# | ||
# (cd dockerfiles && docker build -t complement-synapse -f Synapse.Dockerfile .) | ||
# COMPLEMENT_VERSION_CHECK_ITERATIONS=100 COMPLEMENT_BASE_IMAGE=complement-synapse go test -v ./tests | ||
|
||
FROM matrixdotorg/synapse:latest | ||
|
||
ENV SERVER_NAME=localhost | ||
|
||
COPY synapse/* /conf/ | ||
COPY keys/* /ca/ | ||
|
||
# SSL key for the server (can't make the cert until we know the server name) | ||
RUN openssl genrsa -out /conf/server.tls.key 2048 | ||
|
||
# generate a signing key | ||
RUN generate_signing_key.py -o /conf/server.signing.key | ||
|
||
WORKDIR /data | ||
|
||
EXPOSE 8008 8448 | ||
|
||
ENTRYPOINT ["/conf/start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
This directory contains a key and certificate for a dummy Certificate | ||
Authority. This is used to create certificates for the servers under test. | ||
|
||
The files were generated with: | ||
|
||
``` | ||
openssl genrsa -out ca.key 2048 | ||
openssl req -new -x509 -key ca.key -days 3650 -subj "/C=GB/ST=London/O=matrix.org/CN=Complement CA" -out ca.crt | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIDdzCCAl+gAwIBAgIUDZUl0q5DMzWkd/fev4gJurDpuH8wDQYJKoZIhvcNAQEL | ||
BQAwSzELMAkGA1UEBhMCR0IxDzANBgNVBAgMBkxvbmRvbjETMBEGA1UECgwKbWF0 | ||
cml4Lm9yZzEWMBQGA1UEAwwNQ29tcGxlbWVudCBDQTAeFw0yMDA4MDUxMjAyMDRa | ||
Fw0zMDA4MDMxMjAyMDRaMEsxCzAJBgNVBAYTAkdCMQ8wDQYDVQQIDAZMb25kb24x | ||
EzARBgNVBAoMCm1hdHJpeC5vcmcxFjAUBgNVBAMMDUNvbXBsZW1lbnQgQ0EwggEi | ||
MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9LfS/T0Y72b9j+M7/43Hry+Cf | ||
UUt7iym5z14su8cve545ceT3Y1SRwrGWRy8GuvhgQyVTzvgslwdsLYwVEaK1ZsWQ | ||
7l+UBD128HWCSo/OFMV3j+allMzj4PO3PnMcU1cq6HuTlYeAFlOelLB7FUGFmOzc | ||
c829XHWvDD/Hjz+SQ4E11nftHyu6Chw+Razfcftzp+qLjozjHeXMLI09peiy65zp | ||
DGYhiB78vTCjtioNlMZ5bTrI5PAG3O0nY0NAiAqrGgijpbJdYigf2vcJ8UQ6e0LH | ||
0nTIhITxRd+hN+FGbsLe+OtzaaEkgdtxQrtjAq7wjsxbchNDjnqh/eTJwBaPAgMB | ||
AAGjUzBRMB0GA1UdDgQWBBRNM7hzjkBvs7Rmw4I7g4wpEy53nDAfBgNVHSMEGDAW | ||
gBRNM7hzjkBvs7Rmw4I7g4wpEy53nDAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3 | ||
DQEBCwUAA4IBAQAOfCmPTM9NFPbVwu003kbOPfbtHULlDyMvx4LRiYmpvxfpFjGy | ||
Xp2p/ZqzFHvyT5QcCFrkOoQlX8tIzr8KZqbemf2aWfdRzqT1VG7ADErNfQ2JOjLo | ||
jptliOWcnknmCi8elGjBxVmAqWfDyQKYeiK2AyrJywMLr45UlrxRh03d81TaTRYk | ||
rRHMMKJ3iKb8HQKlrfjQrYCCCSzNkp0RP/TyhpB4qIZDg9AbhUlXn24bQ/Gpq9Hw | ||
pGmYXObJ8Uid7SICxxeFm42Nc8Orke+yw77glcQEumLJM0TqzR1UV3aTyE0qrXeG | ||
R8e6WTemuXtcDEeo1MzCwW/75Sd/1exbs2dW | ||
-----END CERTIFICATE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIEpQIBAAKCAQEAvS30v09GO9m/Y/jO/+Nx68vgn1FLe4spuc9eLLvHL3ueOXHk | ||
92NUkcKxlkcvBrr4YEMlU874LJcHbC2MFRGitWbFkO5flAQ9dvB1gkqPzhTFd4/m | ||
pZTM4+Dztz5zHFNXKuh7k5WHgBZTnpSwexVBhZjs3HPNvVx1rww/x48/kkOBNdZ3 | ||
7R8rugocPkWs33H7c6fqi46M4x3lzCyNPaXosuuc6QxmIYge/L0wo7YqDZTGeW06 | ||
yOTwBtztJ2NDQIgKqxoIo6WyXWIoH9r3CfFEOntCx9J0yISE8UXfoTfhRm7C3vjr | ||
c2mhJIHbcUK7YwKu8I7MW3ITQ456of3kycAWjwIDAQABAoIBAQCt+ctw/IiMlg2q | ||
9K/5J8Qmo1IpcevG7A4tcQUcgnwFsNur3JBC6jhl6/TBTSl0ORIeBOIZFueoqiQL | ||
Wj/PSG6oAKGETZPcXaHg9fY7IjLpxLRs5gupDxT2JHQ9etMFo6cwMKkk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CwCnlkGYTJeACno4u94fgbQBsRLksRM6g | ||
JvQZtOvi5OqrnVz2iTWJhtInV/dIbUtv+yJ9hYOa7AtP3AhiDVePvts= | ||
-----END RSA PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
## Server ## | ||
|
||
server_name: SERVER_NAME | ||
log_config: /conf/log_config.yaml | ||
report_stats: False | ||
signing_key_path: /conf/server.signing.key | ||
trusted_key_servers: [] | ||
enable_registration: true | ||
|
||
## Listeners ## | ||
|
||
tls_certificate_path: /conf/server.tls.crt | ||
tls_private_key_path: /conf/server.tls.key | ||
|
||
listeners: | ||
- port: 8448 | ||
bind_addresses: ['::'] | ||
type: http | ||
tls: true | ||
resources: | ||
- names: [federation] | ||
|
||
- port: 8008 | ||
bind_addresses: ['::'] | ||
type: http | ||
|
||
resources: | ||
- names: [client] | ||
|
||
## Database ## | ||
|
||
database: | ||
name: "sqlite3" | ||
args: | ||
database: "/data/homeserver.db" | ||
|
||
## Federation ## | ||
|
||
# trust certs signed by the dummy CA | ||
federation_custom_ca_list: | ||
- /ca/ca.crt | ||
|
||
# unblacklist RFC1918 addresses | ||
federation_ip_range_blacklist: [] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: 1 | ||
|
||
formatters: | ||
precise: | ||
format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s' | ||
|
||
filters: | ||
context: | ||
(): synapse.logging.context.LoggingContextFilter | ||
request: "" | ||
|
||
handlers: | ||
console: | ||
class: logging.StreamHandler | ||
formatter: precise | ||
filters: [context] | ||
|
||
root: | ||
level: INFO | ||
handlers: [console] | ||
|
||
disable_existing_loggers: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
sed -i "s/SERVER_NAME/${SERVER_NAME}/g" /conf/homeserver.yaml | ||
|
||
# generate an ssl cert for the server, signed by our dummy CA | ||
openssl req -new -key /conf/server.tls.key -out /conf/server.tls.csr \ | ||
-subj "/CN=${SERVER_NAME}" | ||
openssl x509 -req -in /conf/server.tls.csr \ | ||
-CA /ca/ca.crt -CAkey /ca/ca.key -set_serial 1 \ | ||
-out /conf/server.tls.crt | ||
|
||
exec python -m synapse.app.homeserver -c /conf/homeserver.yaml "$@" | ||
|