bundles/matrix-synapse: add option to automatically provision other nginx vhosts with wellknown data
All checks were successful
kunsi/bundlewrap/pipeline/head This commit looks good
All checks were successful
kunsi/bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
2f79f55da5
commit
407d84a8c6
2 changed files with 33 additions and 47 deletions
|
@ -67,19 +67,13 @@ defaults = {
|
|||
|
||||
|
||||
@metadata_reactor.provides(
|
||||
'nginx/vhosts/matrix-synapse',
|
||||
'nginx/vhosts',
|
||||
)
|
||||
def nginx(metadata):
|
||||
if not node.has_bundle('nginx'):
|
||||
raise DoNotRunAgain
|
||||
|
||||
locations = {
|
||||
'/_matrix': {
|
||||
'target': 'http://[::1]:20080',
|
||||
},
|
||||
'/_synapse': {
|
||||
'target': 'http://[::1]:20080',
|
||||
},
|
||||
wellknown = {
|
||||
'/.well-known/matrix/client': {
|
||||
'return': dumps({
|
||||
'm.homeserver': {
|
||||
|
@ -106,6 +100,16 @@ def nginx(metadata):
|
|||
},
|
||||
}
|
||||
|
||||
locations = {
|
||||
'/_matrix': {
|
||||
'target': 'http://[::1]:20080',
|
||||
},
|
||||
'/_synapse': {
|
||||
'target': 'http://[::1]:20080',
|
||||
},
|
||||
**wellknown,
|
||||
}
|
||||
|
||||
if node.has_bundle('matrix-media-repo'):
|
||||
locations['/_matrix/media'] = {
|
||||
'target': 'http://localhost:20090',
|
||||
|
@ -115,15 +119,22 @@ def nginx(metadata):
|
|||
'x_forwarded_host': metadata.get('matrix-synapse/server_name'),
|
||||
}
|
||||
|
||||
return {
|
||||
'nginx': {
|
||||
'vhosts': {
|
||||
'matrix-synapse': {
|
||||
'domain': metadata.get('matrix-synapse/baseurl'),
|
||||
'locations': locations,
|
||||
'website_check_path': '/_matrix/static/',
|
||||
'website_check_string': 'Synapse is running',
|
||||
},
|
||||
},
|
||||
vhosts = {
|
||||
'matrix-synapse': {
|
||||
'domain': metadata.get('matrix-synapse/baseurl'),
|
||||
'locations': locations,
|
||||
'website_check_path': '/_matrix/static/',
|
||||
'website_check_string': 'Synapse is running',
|
||||
},
|
||||
}
|
||||
|
||||
for vname in metadata.get('matrix-synapse/wellknown_also_on_vhosts', set()):
|
||||
vhosts[vname] = {
|
||||
'locations': wellknown,
|
||||
}
|
||||
|
||||
return {
|
||||
'nginx': {
|
||||
'vhosts': vhosts
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue