summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorChristian Adams <rooftopcellist@gmail.com>2019-05-24 22:30:06 +0200
committerChristian Adams <chadams@redhat.com>2019-09-12 18:52:43 +0200
commitec1e93cc69a38e92f08c70d240ffac990ae9c983 (patch)
tree2cb8eca711effc709e5d1523d4849dc40118bc18 /tools
parent#3778 Upgrading postgresql to v10 (diff)
downloadawx-ec1e93cc69a38e92f08c70d240ffac990ae9c983.tar.xz
awx-ec1e93cc69a38e92f08c70d240ffac990ae9c983.zip
Upgrade to postgres 10.6
- use awx-python in shebang in dev env - scl enable where needed for rhel7 & container installs - use scram-sha-256 pg user hashing by default - ensure psycopg2 is using the correct PG_CONFIG at build time for the right libpq version
Diffstat (limited to 'tools')
-rw-r--r--tools/clusterdevel/roles/minishift/tasks/main.yml2
-rw-r--r--tools/clusterdevel/roles/minishift/templates/hostdev.yml.j22
-rw-r--r--tools/docker-compose-cluster.yml7
-rw-r--r--tools/docker-compose.yml8
-rw-r--r--tools/docker-compose/Dockerfile22
-rwxr-xr-xtools/docker-compose/awx-manage2
-rwxr-xr-xtools/docker-compose/bootstrap_development.sh5
-rwxr-xr-xtools/scripts/awx-python13
8 files changed, 42 insertions, 19 deletions
diff --git a/tools/clusterdevel/roles/minishift/tasks/main.yml b/tools/clusterdevel/roles/minishift/tasks/main.yml
index c27fe44f5d..e1033bb20a 100644
--- a/tools/clusterdevel/roles/minishift/tasks/main.yml
+++ b/tools/clusterdevel/roles/minishift/tasks/main.yml
@@ -85,7 +85,7 @@
shell: "oc apply -f /tmp/volumeclaim.yml && rm -rf /tmp/volumeclaim.yml"
- name: Deploy and Activate Postgres
- shell: "oc new-app --template=postgresql-persistent -e MEMORY_LIMIT={{ pg_memory_limit|default('512') }}Mi -e NAMESPACE=openshift -e DATABASE_SERVICE_NAME=postgresql -e POSTGRESQL_USER={{ pg_username|default('awx') }} -e POSTGRESQL_PASSWORD={{ pg_password|default('awx') }} -e POSTGRESQL_DATABASE={{ pg_database|default('awx') }} -e VOLUME_CAPACITY={{ pg_volume_capacity|default('5')}}Gi -e POSTGRESQL_VERSION=9.5 -n {{ awx_dev_project }}"
+ shell: "oc new-app --template=postgresql-persistent -e MEMORY_LIMIT={{ pg_memory_limit|default('512') }}Mi -e NAMESPACE=openshift -e DATABASE_SERVICE_NAME=postgresql -e POSTGRESQL_USER={{ pg_username|default('awx') }} -e POSTGRESQL_PASSWORD={{ pg_password|default('awx') }} -e POSTGRESQL_DATABASE={{ pg_database|default('awx') }} -e VOLUME_CAPACITY={{ pg_volume_capacity|default('5')}}Gi -e POSTGRESQL_VERSION=10 -n {{ awx_dev_project }}"
when: postgres_svc_details is defined and postgres_svc_details.rc != 0
register: openshift_pg_activate
diff --git a/tools/clusterdevel/roles/minishift/templates/hostdev.yml.j2 b/tools/clusterdevel/roles/minishift/templates/hostdev.yml.j2
index 3c7c0e24ec..77e5ec593f 100644
--- a/tools/clusterdevel/roles/minishift/templates/hostdev.yml.j2
+++ b/tools/clusterdevel/roles/minishift/templates/hostdev.yml.j2
@@ -64,7 +64,7 @@ spec:
- name: awx-memcached
image: memcached
- name: postgres
- image: postgres:9.6
+ image: postgres:10
volumes:
- name: localdev
persistentVolumeClaim:
diff --git a/tools/docker-compose-cluster.yml b/tools/docker-compose-cluster.yml
index d9750b5750..3975f35b2b 100644
--- a/tools/docker-compose-cluster.yml
+++ b/tools/docker-compose-cluster.yml
@@ -90,8 +90,13 @@ services:
- CLUSTERED=true
- CLUSTER_WITH=rabbitmq_1
postgres:
- image: postgres:10.7
+ image: centos/postgresql-10-centos7
container_name: tools_postgres_1
+ environment:
+ POSTGRESQL_USER: awx
+ POSTGRESQL_PASSWORD: awxpass
+ POSTGRESQL_DATABASE: awx
+ POSTGRESQL_ADMIN_PASSWORD: postgrespass
memcached:
image: memcached:alpine
container_name: tools_memcached_1
diff --git a/tools/docker-compose.yml b/tools/docker-compose.yml
index 46aea9227f..e09a7136e1 100644
--- a/tools/docker-compose.yml
+++ b/tools/docker-compose.yml
@@ -39,10 +39,16 @@ services:
# build:
# context: ./docker-compose
# dockerfile: Dockerfile-logstash
+
# Postgres Database Container
postgres:
- image: postgres:10.7
+ image: centos/postgresql-10-centos7
container_name: tools_postgres_1
+ environment:
+ POSTGRESQL_USER: awx
+ POSTGRESQL_PASSWORD: awxpass
+ POSTGRESQL_DATABASE: awx
+ POSTGRESQL_ADMIN_PASSWORD: postgrespass
ports:
- "5432:5432"
memcached:
diff --git a/tools/docker-compose/Dockerfile b/tools/docker-compose/Dockerfile
index 43b6e9d2c8..14d64c4f0a 100644
--- a/tools/docker-compose/Dockerfile
+++ b/tools/docker-compose/Dockerfile
@@ -5,7 +5,11 @@ ARG UID=0
# Add ansible-devel so that we get collections!
ADD tools/docker-compose/ansible_nightly.repo /etc/yum.repos.d/ansible_nightly.repo
-RUN yum -y update && yum -y install epel-release && yum -y install https://centos7.iuscommunity.org/ius-release.rpm
+# add rhscl repo for rh-postgresql-devel
+RUN yum -y install centos-release-scl
+RUN yum-config-manager --enable rhel-server-rhscl-7-rpms
+
+RUN yum -y update && yum -y install epel-release && yum -y install https://centos7.iuscommunity.org/ius-release.rpm
# sync with installer/roles/image_build/templates/Dockerfile.j2
RUN yum -y install acl \
@@ -50,8 +54,10 @@ RUN yum -y install acl \
openldap-devel \
openssh-server \
patch \
- postgresql-contrib \
- postgresql-devel \
+ rh-postgresql10-postgresql-devel \
+ rh-postgresql10-postgresql-server-syspaths \
+ scl-utils-build \
+ scl-utils \
python-devel \
python-pip \
python-psutil \
@@ -84,6 +90,9 @@ RUN yum install -y https://github.com/krallin/tini/releases/download/v0.18.0/tin
RUN /usr/bin/ssh-keygen -q -t rsa -N "" -f /root/.ssh/id_rsa
RUN mkdir -p /data/db
+# symlink python interpreter
+RUN ln -s /awx_devel/tools/scripts/awx-python /usr/bin/awx-python
+
ADD tools/docker-compose/awx.egg-link /tmp/awx.egg-link
ADD tools/docker-compose/awx-manage /usr/local/bin/awx-manage
ADD tools/docker-compose/awx.egg-info /tmp/awx.egg-info
@@ -105,7 +114,7 @@ ADD requirements/requirements.txt \
requirements/requirements_tower_uninstall.txt \
/tmp/requirements/
RUN mkdir -p /venv && chmod g+w /venv
-RUN cd /tmp && VENV_BASE="/venv" make requirements_dev
+RUN scl enable rh-postgresql10 """cd /tmp && VENV_BASE="/venv" make requirements_dev"""
# Use the distro provided npm to bootstrap our required version of node
RUN npm install -g n
@@ -127,7 +136,7 @@ RUN yum -y remove cyrus-sasl-devel \
libxml2-devel \
libxslt-devel \
openldap-devel \
- postgresql-devel \
+ rh-postgresql10-postgresql-devel \
python-devel \
python36-devel \
nodejs \
@@ -138,6 +147,9 @@ RUN yum -y clean all
RUN rm -rf /root/.cache
+# makes postgres available for data migrations when upgrading
+RUN export PATH=/usr/pgsql-10/bin:$PATH
+
RUN localedef -c -i en_US -f UTF-8 en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
diff --git a/tools/docker-compose/awx-manage b/tools/docker-compose/awx-manage
index 65d10accf7..d29bfdc359 100755
--- a/tools/docker-compose/awx-manage
+++ b/tools/docker-compose/awx-manage
@@ -1,4 +1,4 @@
-#!/venv/awx/bin/python
+#!/usr/bin/awx-python
# EASY-INSTALL-ENTRY-SCRIPT: 'awx','console_scripts','awx-manage'
import sys
from pkg_resources import load_entry_point
diff --git a/tools/docker-compose/bootstrap_development.sh b/tools/docker-compose/bootstrap_development.sh
index 3909ffdd4e..dfcbe11420 100755
--- a/tools/docker-compose/bootstrap_development.sh
+++ b/tools/docker-compose/bootstrap_development.sh
@@ -10,9 +10,8 @@ ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=${RABBITMQ_HOST} port=5
# TODO: FIX
#/etc/init.d/ssh start
-
-ansible -i "127.0.0.1," -c local -v -m postgresql_user --become-user postgres -a "name=awx-dev password=AWXsome1 login_user=postgres login_host=postgres" all
-ansible -i "127.0.0.1," -c local -v -m postgresql_db --become-user postgres -a "name=awx-dev owner=awx-dev login_user=postgres login_host=postgres" all
+ansible -i "127.0.0.1," -c local -v -m postgresql_user --become-user postgres -a "name=awx-dev password=AWXsome1 encrypted=yes login_user=postgres login_password=postgrespass login_host=postgres" all
+ansible -i "127.0.0.1," -c local -v -m postgresql_db --become-user postgres -a "name=awx-dev owner=awx-dev login_user=postgres login_password=postgrespass login_host=postgres" all
# Move to the source directory so we can bootstrap
if [ -f "/awx_devel/manage.py" ]; then
diff --git a/tools/scripts/awx-python b/tools/scripts/awx-python
index b92f3c5b2a..f95357d4a7 100755
--- a/tools/scripts/awx-python
+++ b/tools/scripts/awx-python
@@ -1,7 +1,6 @@
-#!/bin/bash
-
+#!/usr/bin/env bash
# Enable needed Software Collections, if installed
-for scl in rh-python36; do
+for scl in rh-python36 rh-postgresql10; do
if [ -f /etc/scl/prefixes/$scl ]; then
if [ -f `cat /etc/scl/prefixes/$scl`/$scl/enable ]; then
. `cat /etc/scl/prefixes/$scl`/$scl/enable
@@ -10,9 +9,11 @@ for scl in rh-python36; do
done
# Enable Tower virtualenv
-if [ -f /var/lib/awx/venv/awx/bin/activate ]; then
- . /var/lib/awx/venv/awx/bin/activate
-fi
+for venv_path in /var/lib/awx/venv/awx /venv/awx; do
+ if [ -f $venv_path/bin/activate ]; then
+ . $venv_path/bin/activate
+ fi
+done
# Run the requested Python command, using the interpreter from the path
exec python3 "$@"