mirror of
https://github.com/zulip/zulip.git
synced 2025-11-08 16:01:58 +00:00
provision: Add RHEL 7 support.
This commit is contained in:
@@ -3,9 +3,20 @@ set -x
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
is_centos=false
|
is_centos=false
|
||||||
|
is_rhel=false
|
||||||
|
is_rhel_registered=false
|
||||||
if [ -e /etc/centos-release ]; then
|
if [ -e /etc/centos-release ]; then
|
||||||
is_centos=true
|
is_centos=true
|
||||||
yum install -y epel-release
|
yum install -y epel-release
|
||||||
|
elif grep -q "Red Hat" /etc/redhat-release; then
|
||||||
|
is_rhel=true
|
||||||
|
yum localinstall -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
||||||
|
if subscription-manager status; then
|
||||||
|
# See https://access.redhat.com/discussions/2217891#comment-1032701
|
||||||
|
is_rhel_registered=true
|
||||||
|
# libmemcached-devel can be installed directly if the machine is registered
|
||||||
|
subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
yum update -y
|
yum update -y
|
||||||
|
|
||||||
@@ -22,6 +33,13 @@ if [ "$is_centos" = true ]; then
|
|||||||
# PGroonga
|
# PGroonga
|
||||||
# https://pgroonga.github.io/install/centos.html
|
# https://pgroonga.github.io/install/centos.html
|
||||||
yum localinstall -y https://packages.groonga.org/centos/groonga-release-latest.noarch.rpm
|
yum localinstall -y https://packages.groonga.org/centos/groonga-release-latest.noarch.rpm
|
||||||
|
elif [ "$is_rhel" = true ]; then
|
||||||
|
if [ "$is_rhel_registered" = false ]; then
|
||||||
|
echo "This machine is unregistered; installing libmemcached-devel from a CentOS mirror ..."
|
||||||
|
yum localinstall -y http://mirror.centos.org/centos/7/os/x86_64/Packages/libmemcached-devel-1.0.16-5.el7.x86_64.rpm
|
||||||
|
fi
|
||||||
|
yum localinstall -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-latest-x86_64/pgdg-redhat10-10-2.noarch.rpm
|
||||||
|
yum localinstall -y https://packages.groonga.org/centos/groonga-release-latest.noarch.rpm
|
||||||
else
|
else
|
||||||
# TODO only fedora29 for now
|
# TODO only fedora29 for now
|
||||||
dnf install -y "https://download.postgresql.org/pub/repos/yum/$PGVER/fedora/fedora-29-x86_64/pgdg-fedora$PGVER-$PGVER-4.noarch.rpm"
|
dnf install -y "https://download.postgresql.org/pub/repos/yum/$PGVER/fedora/fedora-29-x86_64/pgdg-fedora$PGVER-$PGVER-4.noarch.rpm"
|
||||||
|
|||||||
@@ -329,12 +329,16 @@ def parse_lsb_release():
|
|||||||
with open('/etc/redhat-release', 'r') as fp:
|
with open('/etc/redhat-release', 'r') as fp:
|
||||||
info = fp.read().strip().split(' ')
|
info = fp.read().strip().split(' ')
|
||||||
vendor = info[0]
|
vendor = info[0]
|
||||||
if os.path.exists("/etc/centos-release"):
|
if vendor == 'Centos':
|
||||||
# E.g. "CentOS Linux release 7.5.1804 (Core)"
|
# E.g. "CentOS Linux release 7.5.1804 (Core)"
|
||||||
codename = vendor.lower() + info[3][0]
|
codename = vendor.lower() + info[3][0]
|
||||||
else:
|
elif vendor == 'Fedora':
|
||||||
# E.g. "Fedora release 29 (Twenty Nine)"
|
# E.g. "Fedora release 29 (Twenty Nine)"
|
||||||
codename = vendor.lower() + info[2]
|
codename = vendor.lower() + info[2]
|
||||||
|
elif vendor == 'Red':
|
||||||
|
# E.g. "Red Hat Enterprise Linux Server release 7.6 (Maipo)"
|
||||||
|
vendor = 'RedHat'
|
||||||
|
codename = 'rhel' + info[6][0] # 7
|
||||||
distro_info = dict(
|
distro_info = dict(
|
||||||
DISTRIB_CODENAME=codename,
|
DISTRIB_CODENAME=codename,
|
||||||
DISTRIB_ID=vendor
|
DISTRIB_ID=vendor
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ SUPPORTED_PLATFORMS = {
|
|||||||
],
|
],
|
||||||
"Fedora": [
|
"Fedora": [
|
||||||
"fedora29",
|
"fedora29",
|
||||||
|
],
|
||||||
|
"RedHat": [
|
||||||
|
"rhel7",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +119,7 @@ if (not is_rhel_based) and (not os.path.exists("/usr/bin/lsb_release")):
|
|||||||
distro_info = parse_lsb_release()
|
distro_info = parse_lsb_release()
|
||||||
vendor = distro_info['DISTRIB_ID']
|
vendor = distro_info['DISTRIB_ID']
|
||||||
codename = distro_info['DISTRIB_CODENAME']
|
codename = distro_info['DISTRIB_CODENAME']
|
||||||
family = 'redhat' if vendor in ['CentOS', 'Fedora'] else 'debian'
|
family = 'redhat' if vendor in ['CentOS', 'Fedora', 'RedHat'] else 'debian'
|
||||||
if not (vendor in SUPPORTED_PLATFORMS and codename in SUPPORTED_PLATFORMS[vendor]):
|
if not (vendor in SUPPORTED_PLATFORMS and codename in SUPPORTED_PLATFORMS[vendor]):
|
||||||
logging.critical("Unsupported platform: {} {}".format(vendor, codename))
|
logging.critical("Unsupported platform: {} {}".format(vendor, codename))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@@ -128,6 +131,7 @@ POSTGRES_VERSION_MAP = {
|
|||||||
"bionic": "10",
|
"bionic": "10",
|
||||||
"centos7": "10",
|
"centos7": "10",
|
||||||
"fedora29": "10",
|
"fedora29": "10",
|
||||||
|
"rhel7": "10",
|
||||||
}
|
}
|
||||||
POSTGRES_VERSION = POSTGRES_VERSION_MAP[codename]
|
POSTGRES_VERSION = POSTGRES_VERSION_MAP[codename]
|
||||||
|
|
||||||
@@ -175,7 +179,7 @@ if vendor in ["Ubuntu", "Debian"]:
|
|||||||
"postgresql-{0}-pgroonga",
|
"postgresql-{0}-pgroonga",
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
elif vendor == "CentOS":
|
elif vendor in ["CentOS", "RedHat"]:
|
||||||
SYSTEM_DEPENDENCIES = COMMON_YUM_DEPENDENCIES + [
|
SYSTEM_DEPENDENCIES = COMMON_YUM_DEPENDENCIES + [
|
||||||
pkg.format(POSTGRES_VERSION) for pkg in [
|
pkg.format(POSTGRES_VERSION) for pkg in [
|
||||||
"postgresql{0}-server",
|
"postgresql{0}-server",
|
||||||
@@ -265,7 +269,26 @@ def install_yum_deps(deps_to_install, retry=False):
|
|||||||
# type: (List[str], bool) -> None
|
# type: (List[str], bool) -> None
|
||||||
print(WARNING + "RedHat support is still experimental.")
|
print(WARNING + "RedHat support is still experimental.")
|
||||||
run(["sudo", "./scripts/lib/setup-yum-repo"])
|
run(["sudo", "./scripts/lib/setup-yum-repo"])
|
||||||
run(["sudo", "yum", "install", "-y"] + deps_to_install)
|
|
||||||
|
# Hack specific to unregistered RHEL system. The moreutils
|
||||||
|
# package requires a perl module package, which isn't available in
|
||||||
|
# the unregistered RHEL repositories.
|
||||||
|
#
|
||||||
|
# Error: Package: moreutils-0.49-2.el7.x86_64 (epel)
|
||||||
|
# Requires: perl(IPC::Run)
|
||||||
|
yum_extra_flags = [] # type: List[str]
|
||||||
|
if vendor == 'RedHat':
|
||||||
|
exitcode, subs_status = subprocess.getstatusoutput("sudo subscription-manager status")
|
||||||
|
if exitcode == 1:
|
||||||
|
# TODO this might overkill since `subscription-manager` is already
|
||||||
|
# called in setup-yum-repo
|
||||||
|
if 'Status' in subs_status:
|
||||||
|
# The output is well-formed
|
||||||
|
yum_extra_flags = ["--skip-broken"]
|
||||||
|
else:
|
||||||
|
print("Unrecognized output. `subscription-manager` might not be available")
|
||||||
|
|
||||||
|
run(["sudo", "yum", "install", "-y"] + yum_extra_flags + deps_to_install)
|
||||||
postgres_dir = 'pgsql-%s' % (POSTGRES_VERSION,)
|
postgres_dir = 'pgsql-%s' % (POSTGRES_VERSION,)
|
||||||
for cmd in ['pg_config', 'pg_isready', 'psql']:
|
for cmd in ['pg_config', 'pg_isready', 'psql']:
|
||||||
# Our tooling expects these postgres scripts to be at
|
# Our tooling expects these postgres scripts to be at
|
||||||
|
|||||||
Reference in New Issue
Block a user