Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

scripts: Add a start-server as well.

Alex Vandiverec12a6128a3a
diff --git a/scripts/restart-server b/scripts/restart-server
index ae5ce3db0bf..fe685bd9683 100755
--- a/scripts/restart-server
+++ b/scripts/restart-server
@@ -19,8 +19,13 @@ from scripts.lib.zulip_tools import (
overwrite_symlink,
)
+action = "restart"
+if not sys.argv[0].endswith("restart-server"):
+ action = "start"
+verbing = action.title() + "ing"
+
logging.Formatter.converter = time.gmtime
-logging.basicConfig(format="%(asctime)s restart-server: %(message)s", level=logging.INFO)
+logging.basicConfig(format=f"%(asctime)s {action}-server: %(message)s", level=logging.INFO)
parser = argparse.ArgumentParser()
parser.add_argument("--fill-cache", action="store_true", help="Fill the memcached caches")
@@ -67,17 +72,18 @@ if len(tornado_ports) > 1:
# restarts. This also avoids behavior with restarting a whole
# supervisord group where if any individual process is slow to
# stop, the whole bundle stays stopped for an extended time.
- logging.info("Restarting Tornado process on port %s", p)
- subprocess.check_call(["supervisorctl", "restart", f"zulip-tornado:zulip-tornado-port-{p}"])
+ logging.info("%s Tornado process on port %s", verbing, p)
+ subprocess.check_call(["supervisorctl", action, f"zulip-tornado:zulip-tornado-port-{p}"])
else:
- logging.info("Restarting Tornado process")
- subprocess.check_call(["supervisorctl", "restart", "zulip-tornado", "zulip-tornado:*"])
+ logging.info("%s Tornado process", verbing)
+ subprocess.check_call(["supervisorctl", action, "zulip-tornado", "zulip-tornado:*"])
# Restart the uWSGI and related processes via supervisorctl.
-logging.info("Stopping workers")
-subprocess.check_call(["supervisorctl", "stop", "zulip-workers:*"])
-logging.info("Stopping server core")
-subprocess.check_call(["supervisorctl", "stop", *core_server_services])
+if action == "restart":
+ logging.info("Stopping workers")
+ subprocess.check_call(["supervisorctl", "stop", "zulip-workers:*"])
+ logging.info("Stopping server core")
+ subprocess.check_call(["supervisorctl", "stop", *core_server_services])
logging.info("Starting server core")
subprocess.check_call(["supervisorctl", "start", *reversed(core_server_services)])
@@ -90,10 +96,10 @@ if using_sso.strip() == b"True":
subprocess.check_call(["pkill", "-f", "apache2", "-u", "zulip"])
if os.path.exists("/etc/supervisor/conf.d/zulip/zulip_db.conf"):
- subprocess.check_call(["supervisorctl", "restart", "process-fts-updates"])
+ subprocess.check_call(["supervisorctl", action, "process-fts-updates"])
logging.info("Done!")
-print(OKGREEN + "Zulip restarted successfully!" + ENDC)
+print(OKGREEN + f"Zulip {action}ed successfully!" + ENDC)
if change_symlink and "PWD" in os.environ:
for symlink in [last_symlink, current_symlink]:
diff --git a/scripts/start-server b/scripts/start-server
new file mode 120000
index 00000000000..ef44b79f25e
--- /dev/null
+++ b/scripts/start-server
@@ -0,0 +1 @@
+restart-server
\ No newline at end of file
diff --git a/templates/zerver/help/import-from-gitter.md b/templates/zerver/help/import-from-gitter.md
index 01e61f45607..946b452a39f 100644
--- a/templates/zerver/help/import-from-gitter.md
+++ b/templates/zerver/help/import-from-gitter.md
@@ -52,7 +52,7 @@ cd /home/zulip/deployments/current
./scripts/stop-server
./manage.py convert_gitter_data gitter_data.json --output converted_gitter_data
./manage.py import '' converted_gitter_data
-./scripts/restart-server
+./scripts/start-server
```
This could take several minutes to run, depending on how much data
diff --git a/templates/zerver/help/import-from-mattermost.md b/templates/zerver/help/import-from-mattermost.md
index bfe109196fd..6a532a59d32 100644
--- a/templates/zerver/help/import-from-mattermost.md
+++ b/templates/zerver/help/import-from-mattermost.md
@@ -152,7 +152,7 @@ cd /home/zulip/deployments/current
./scripts/stop-server
./manage.py convert_mattermost_data /home/zulip/mattermost --output /home/zulip/converted_mattermost_data
./manage.py import "" /home/zulip/converted_mattermost_data/<team-name>
-./scripts/restart-server
+./scripts/start-server
```
This could take several minutes to run, depending on how much data
diff --git a/templates/zerver/help/import-from-slack.md b/templates/zerver/help/import-from-slack.md
index bb385cbd479..b679836e849 100644
--- a/templates/zerver/help/import-from-slack.md
+++ b/templates/zerver/help/import-from-slack.md
@@ -82,7 +82,7 @@ cd /home/zulip/deployments/current
./scripts/stop-server
./manage.py convert_slack_data slack_data.zip --token <token> --output converted_slack_data
./manage.py import '' converted_slack_data
-./scripts/restart-server
+./scripts/start-server
```
This could take several minutes to run, depending on how much data
diff --git a/tools/ci/production-upgrade-pg b/tools/ci/production-upgrade-pg
index 91234a10f77..9f9693545ac 100755
--- a/tools/ci/production-upgrade-pg
+++ b/tools/ci/production-upgrade-pg
@@ -7,7 +7,7 @@ cd /home/github/zulip
su zulip -c ./scripts/stop-server
./scripts/setup/upgrade-postgresql
-supervisorctl start all
+su zulip -c ./scripts/start-server
echo "Upgrade of PostgreSQL complete!"
exit 0