mirror of https://github.com/zulip/zulip.git
scripts: Add a start-server as well.
In general, `./scripts/restart-server` will already work in any circumstance where the server is already stopped and needs to be started. However, it will output a couple minor warnings, and it is not readily obvious that it *will* work correctly. Add an alias for `restart-server` named `start-server`, for parallelism with `stop-server`, which omits the steps of `restart-server` which would stop the server first.
This commit is contained in:
parent
476524c0c1
commit
ec12a6128a
|
@ -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]:
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
restart-server
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue