Deploy python3 virtualenvs only.
This commit is contained in:
@@ -46,7 +46,7 @@ class DEBPackage(Package):
|
||||
def install_many(self, names):
|
||||
"""Install many packages."""
|
||||
self.update()
|
||||
utils.exec_cmd("apt-get install --quiet --assume-yes {}".format(
|
||||
return utils.exec_cmd("apt-get install --quiet --assume-yes {}".format(
|
||||
" ".join(names)))
|
||||
|
||||
def get_installed_version(self, name):
|
||||
@@ -76,7 +76,7 @@ class RPMPackage(Package):
|
||||
|
||||
def install_many(self, names):
|
||||
"""Install many packages."""
|
||||
utils.exec_cmd("yum install -y --quiet {}".format(" ".join(names)))
|
||||
return utils.exec_cmd("yum install -y --quiet {}".format(" ".join(names)))
|
||||
|
||||
def get_installed_version(self, name):
|
||||
"""Get installed package version."""
|
||||
|
||||
@@ -60,8 +60,8 @@ def setup_virtualenv(path, sudo_user=None, python_version=2):
|
||||
packages.append("virtualenv")
|
||||
else:
|
||||
if utils.dist_name().startswith("centos"):
|
||||
python_binary = "python36"
|
||||
packages = ["python36"]
|
||||
python_binary = "python3"
|
||||
packages = ["python3"]
|
||||
else:
|
||||
python_binary = "python3"
|
||||
packages = ["python3-venv"]
|
||||
|
||||
@@ -55,7 +55,8 @@ class Automx(base.Installer):
|
||||
|
||||
def _setup_venv(self):
|
||||
"""Prepare a python virtualenv."""
|
||||
python.setup_virtualenv(self.venv_path, sudo_user=self.user)
|
||||
python.setup_virtualenv(
|
||||
self.venv_path, sudo_user=self.user, python_version=3)
|
||||
packages = [
|
||||
"future", "lxml", "ipaddress", "sqlalchemy", "python-memcached",
|
||||
"python-dateutil", "configparser"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Base classes."""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from .. import database
|
||||
from .. import package
|
||||
@@ -107,7 +108,10 @@ class Installer(object):
|
||||
packages = self.get_packages()
|
||||
if not packages:
|
||||
return
|
||||
package.backend.install_many(packages)
|
||||
exitcode, output = package.backend.install_many(packages)
|
||||
if exitcode:
|
||||
utils.printcolor("Failed to install dependencies", utils.RED)
|
||||
sys.exit(1)
|
||||
|
||||
def get_config_files(self):
|
||||
"""Return the list of configuration files to copy."""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[uwsgi]
|
||||
uid = %app_user
|
||||
gid = %app_user
|
||||
plugins = python
|
||||
plugins = %uwsgi_plugin
|
||||
home = %app_venv_path
|
||||
chdir = %app_instance_path
|
||||
module = automx_wsgi
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[uwsgi]
|
||||
uid = %app_user
|
||||
gid = %app_user
|
||||
plugins = python
|
||||
plugins = %uwsgi_plugin
|
||||
home = %app_venv_path
|
||||
chdir = %app_instance_path
|
||||
module = instance.wsgi:application
|
||||
@@ -12,3 +12,4 @@ no-default-app = true
|
||||
socket = %uwsgi_socket_path
|
||||
chmod-socket = 660
|
||||
vacuum = true
|
||||
single-interpreter = True
|
||||
|
||||
@@ -22,12 +22,12 @@ class Modoboa(base.Installer):
|
||||
no_daemon = True
|
||||
packages = {
|
||||
"deb": [
|
||||
"build-essential", "python-dev", "libxml2-dev", "libxslt-dev",
|
||||
"build-essential", "python3-dev", "libxml2-dev", "libxslt-dev",
|
||||
"libjpeg-dev", "librrd-dev", "rrdtool", "libffi-dev", "cron",
|
||||
"libssl-dev"
|
||||
],
|
||||
"rpm": [
|
||||
"gcc", "gcc-c++", "python-devel", "libxml2-devel", "libxslt-devel",
|
||||
"gcc", "gcc-c++", "python3-devel", "libxml2-devel", "libxslt-devel",
|
||||
"libjpeg-turbo-devel", "rrdtool-devel", "rrdtool", "libffi-devel",
|
||||
]
|
||||
}
|
||||
@@ -67,7 +67,8 @@ class Modoboa(base.Installer):
|
||||
|
||||
def _setup_venv(self):
|
||||
"""Prepare a dedicated virtualenv."""
|
||||
python.setup_virtualenv(self.venv_path, sudo_user=self.user)
|
||||
python.setup_virtualenv(
|
||||
self.venv_path, sudo_user=self.user, python_version=3)
|
||||
packages = ["rrdtool"]
|
||||
version = self.config.get("modoboa", "version")
|
||||
if version == "latest":
|
||||
|
||||
@@ -16,8 +16,8 @@ class Uwsgi(base.Installer):
|
||||
|
||||
appname = "uwsgi"
|
||||
packages = {
|
||||
"deb": ["uwsgi", "uwsgi-plugin-python"],
|
||||
"rpm": ["uwsgi", "uwsgi-plugin-python2"],
|
||||
"deb": ["uwsgi", "uwsgi-plugin-python3"],
|
||||
"rpm": ["uwsgi", "uwsgi-plugin-python36"],
|
||||
}
|
||||
|
||||
def get_socket_path(self, app):
|
||||
@@ -29,12 +29,17 @@ class Uwsgi(base.Installer):
|
||||
def get_template_context(self, app):
|
||||
"""Additionnal variables."""
|
||||
context = super(Uwsgi, self).get_template_context()
|
||||
if package.backend.FORMAT == "deb":
|
||||
uwsgi_plugin = "python3"
|
||||
else:
|
||||
uwsgi_plugin = "python36"
|
||||
context.update({
|
||||
"app_user": self.config.get(app, "user"),
|
||||
"app_venv_path": self.config.get(app, "venv_path"),
|
||||
"app_instance_path": (
|
||||
self.config.get(app, "instance_path")),
|
||||
"uwsgi_socket_path": self.get_socket_path(app),
|
||||
"uwsgi_plugin": uwsgi_plugin,
|
||||
})
|
||||
return context
|
||||
|
||||
|
||||
Reference in New Issue
Block a user