mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 10:57:58 +00:00
Create a virtualenv when installing/upgrading production instances.
This commit is contained in:
committed by
Tim Abbott
parent
bbd24168b6
commit
64affb83f9
23
scripts/lib/create-production-venv
Executable file
23
scripts/lib/create-production-venv
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import os
|
||||||
|
import argparse
|
||||||
|
from os.path import dirname, abspath
|
||||||
|
import sys
|
||||||
|
|
||||||
|
ZULIP_PATH = dirname(dirname(dirname(abspath(__file__))))
|
||||||
|
if ZULIP_PATH not in sys.path:
|
||||||
|
sys.path.append(ZULIP_PATH)
|
||||||
|
|
||||||
|
from zulip_tools import run
|
||||||
|
from scripts.lib.setup_venv import setup_virtualenv, VENV_DEPENDENCIES
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description="Create a production virtualenv with caching")
|
||||||
|
parser.add_argument("target")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
# install dependencies for setting up the virtualenv
|
||||||
|
run(["apt-get", "-y", "install"] + VENV_DEPENDENCIES)
|
||||||
|
|
||||||
|
cached_venv_path = setup_virtualenv(args.target, os.path.join(ZULIP_PATH, "requirements", "prod.txt"))
|
||||||
|
# Now the virtualenv has been activated
|
||||||
@@ -25,6 +25,10 @@ apt-get update
|
|||||||
apt-get -y dist-upgrade $APT_OPTIONS
|
apt-get -y dist-upgrade $APT_OPTIONS
|
||||||
apt-get install -y puppet git python python-six $ADDITIONAL_PACKAGES
|
apt-get install -y puppet git python python-six $ADDITIONAL_PACKAGES
|
||||||
|
|
||||||
|
# Create and activate a virtualenv
|
||||||
|
/root/zulip/scripts/lib/create-production-venv /root/zulip/zulip-venv
|
||||||
|
|
||||||
|
# puppet apply
|
||||||
mkdir -p /etc/zulip
|
mkdir -p /etc/zulip
|
||||||
echo -e "[machine]\npuppet_classes = $PUPPET_CLASSES\ndeploy_type = $DEPLOYMENT_TYPE" > /etc/zulip/zulip.conf
|
echo -e "[machine]\npuppet_classes = $PUPPET_CLASSES\ndeploy_type = $DEPLOYMENT_TYPE" > /etc/zulip/zulip.conf
|
||||||
/root/zulip/scripts/zulip-puppet-apply -f
|
/root/zulip/scripts/zulip-puppet-apply -f
|
||||||
|
|||||||
@@ -30,7 +30,10 @@ deploy_path = sys.argv[1]
|
|||||||
|
|
||||||
logging.info("Upgrading system packages...")
|
logging.info("Upgrading system packages...")
|
||||||
subprocess.check_call(["apt-get", "update"])
|
subprocess.check_call(["apt-get", "update"])
|
||||||
subprocess.check_call(["apt-get", "upgrade"])
|
subprocess.check_call(["apt-get", "-y", "upgrade"])
|
||||||
|
|
||||||
|
subprocess.check_call([os.path.join(deploy_path, "scripts", "lib", "create-production-venv"),
|
||||||
|
os.path.join(deploy_path, "zulip-venv")])
|
||||||
|
|
||||||
if os.path.exists("/etc/supervisor/conf.d/zulip_db.conf"):
|
if os.path.exists("/etc/supervisor/conf.d/zulip_db.conf"):
|
||||||
subprocess.check_call(["supervisorctl", "stop", "process-fts-updates"], preexec_fn=su_to_zulip)
|
subprocess.check_call(["supervisorctl", "stop", "process-fts-updates"], preexec_fn=su_to_zulip)
|
||||||
|
|||||||
Reference in New Issue
Block a user