diff options
author | Jorik Schellekens <joriks@matrix.org> | 2019-08-08 18:20:03 +0100 |
---|---|---|
committer | Jorik Schellekens <joriks@matrix.org> | 2019-08-28 15:59:53 +0100 |
commit | 1c9c8186b10f88d7f58021c06c3e47534ade2855 (patch) | |
tree | 90417b15f654242b70b779981a0af1db27c8ba85 | |
parent | Write out the yaml to synapse (diff) | |
download | synapse-1c9c8186b10f88d7f58021c06c3e47534ade2855.tar.xz |
First try at starting synapse
-rw-r--r-- | synapse_topology/config_dir/homeserver.yaml | 20 | ||||
-rw-r--r-- | synapse_topology/controller/server/server.py | 9 | ||||
-rw-r--r-- | synapse_topology/view/webui/js/actions/index.js | 3 | ||||
-rw-r--r-- | synapse_topology/view/webui/js/api/constants.js | 3 | ||||
-rw-r--r-- | synapse_topology/view/webui/js/api/index.js | 3 |
5 files changed, 36 insertions, 2 deletions
diff --git a/synapse_topology/config_dir/homeserver.yaml b/synapse_topology/config_dir/homeserver.yaml index e69de29bb2..4769e776d5 100644 --- a/synapse_topology/config_dir/homeserver.yaml +++ b/synapse_topology/config_dir/homeserver.yaml @@ -0,0 +1,20 @@ +database: + args: /home/jorik/Dev/synapse/synapse_topology/config_dir/data/homeserver.db + name: psycopg2 +listeners: +- port: 8008 + resources: + - names: + - federation + - client + tls: true + type: http +log_config: /home/jorik/Dev/synapse/synapse_topology/config_dir/undefined.log.config +media_store_path: /home/jorik/Dev/synapse/synapse_topology/config_dir/data/media_store +pid_file: /home/jorik/Dev/synapse/synapse_topology/config_dir/data/homeserver.pid +report_stats: true +server_config_in_use: true +server_name: myserver.net +tls_certificate_path: /home/jorik/Dev/synapse/synapse_topology/config_dir/undefined.tls.cert +tls_private_key_path: /home/jorik/Dev/synapse/synapse_topology/config_dir/undefined.tls.key +uploads_path: /home/jorik/Dev/synapse/synapse_topology/config_dir/data/uploads diff --git a/synapse_topology/controller/server/server.py b/synapse_topology/controller/server/server.py index 2240fb5b0d..5932193e90 100644 --- a/synapse_topology/controller/server/server.py +++ b/synapse_topology/controller/server/server.py @@ -19,6 +19,9 @@ from .utils import validate_schema, log_body_if_fail from . import app +import subprocess +import sys + @app.route("/topology_webui/", branch=True) def server_webui(request): @@ -106,3 +109,9 @@ def check_ports(request, body): results.append(port_checker(port)) return json.dumps({"ports": results}) + +@app.route("/start", methods=["POST"]) +def start_synapse(): + print("Start") + subprocess.Popen("synctl", "start", "-c", model.get_config_dir(), "homeserver.yaml") + sys.exit() diff --git a/synapse_topology/view/webui/js/actions/index.js b/synapse_topology/view/webui/js/actions/index.js index 44b9fe885b..0ea23b7d39 100644 --- a/synapse_topology/view/webui/js/actions/index.js +++ b/synapse_topology/view/webui/js/actions/index.js @@ -33,6 +33,7 @@ import { post_certs, test_ports, post_config, + start_synapse, } from '../api'; import { CONFIG_LOCK, CONFIG_DIR } from '../api/constants'; import { base_config_to_synapse_config } from '../utils/yaml'; @@ -249,6 +250,6 @@ export const set_database = database => ({ export const write_config = (config, sub_config_name) => { return (dispatch, getState) => { post_config(base_config_to_synapse_config(getState().base_config), sub_config_name) - .then(res => console.log(res), error => dispatch(fail(error))) + .then(res => start_synapse(), error => dispatch(fail(error))) } } \ No newline at end of file diff --git a/synapse_topology/view/webui/js/api/constants.js b/synapse_topology/view/webui/js/api/constants.js index acd9702672..89f8996d39 100644 --- a/synapse_topology/view/webui/js/api/constants.js +++ b/synapse_topology/view/webui/js/api/constants.js @@ -7,4 +7,5 @@ export const SETUP_CHECK = "/setup"; export const CERT_PATHS = "/testcertpaths"; export const TEST_PORTS = "/ports"; export const CONFIG_LOCK = "server_config_in_use"; -export const CONFIG_DIR = "config_dir"; \ No newline at end of file +export const CONFIG_DIR = "config_dir"; +export const START = "/start"; \ No newline at end of file diff --git a/synapse_topology/view/webui/js/api/index.js b/synapse_topology/view/webui/js/api/index.js index c3fd808768..cfe57fef00 100644 --- a/synapse_topology/view/webui/js/api/index.js +++ b/synapse_topology/view/webui/js/api/index.js @@ -7,6 +7,7 @@ import { SETUP_CHECK, CERT_PATHS, TEST_PORTS, + START, } from './constants'; const fetchAbs = fetchAbsolute(fetch)(API_URL) @@ -84,3 +85,5 @@ export const post_config = (config, sub_config_name) => // Checks if the server's base config has been setup. export const get_server_setup = () => fetchAbs(SETUP_CHECK) .then(res => res.json()) + +export const start_synapse = () => fetchAbs(START) \ No newline at end of file |