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
This commit is contained in:
Christian Adams
2019-05-24 16:30:06 -04:00
committed by Christian Adams
parent 04ab736f09
commit ec1e93cc69
27 changed files with 97 additions and 60 deletions

View File

@@ -157,7 +157,7 @@ If you start a second terminal session, you can take a look at the running conta
$ docker ps $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
aa4a75d6d77b gcr.io/ansible-tower-engineering/awx_devel:devel "/tini -- /bin/sh ..." 23 seconds ago Up 15 seconds 0.0.0.0:5555->5555/tcp, 0.0.0.0:6899-6999->6899-6999/tcp, 0.0.0.0:8013->8013/tcp, 0.0.0.0:8043->8043/tcp, 22/tcp, 0.0.0.0:8080->8080/tcp tools_awx_1 aa4a75d6d77b gcr.io/ansible-tower-engineering/awx_devel:devel "/tini -- /bin/sh ..." 23 seconds ago Up 15 seconds 0.0.0.0:5555->5555/tcp, 0.0.0.0:6899-6999->6899-6999/tcp, 0.0.0.0:8013->8013/tcp, 0.0.0.0:8043->8043/tcp, 22/tcp, 0.0.0.0:8080->8080/tcp tools_awx_1
e4c0afeb548c postgres:9.6 "docker-entrypoint..." 26 seconds ago Up 23 seconds 5432/tcp tools_postgres_1 e4c0afeb548c postgres:10 "docker-entrypoint..." 26 seconds ago Up 23 seconds 5432/tcp tools_postgres_1
0089699d5afd tools_logstash "/docker-entrypoin..." 26 seconds ago Up 25 seconds tools_logstash_1 0089699d5afd tools_logstash "/docker-entrypoin..." 26 seconds ago Up 25 seconds tools_logstash_1
4d4ff0ced266 memcached:alpine "docker-entrypoint..." 26 seconds ago Up 25 seconds 0.0.0.0:11211->11211/tcp tools_memcached_1 4d4ff0ced266 memcached:alpine "docker-entrypoint..." 26 seconds ago Up 25 seconds 0.0.0.0:11211->11211/tcp tools_memcached_1
92842acd64cd rabbitmq:3-management "docker-entrypoint..." 26 seconds ago Up 24 seconds 4369/tcp, 5671-5672/tcp, 15671/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp tools_rabbitmq_1 92842acd64cd rabbitmq:3-management "docker-entrypoint..." 26 seconds ago Up 24 seconds 4369/tcp, 5671-5672/tcp, 15671/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp tools_rabbitmq_1

View File

@@ -193,7 +193,7 @@ $ eval $(minishift docker-env)
By default, AWX will deploy a PostgreSQL pod inside of your cluster. You will need to create a [Persistent Volume Claim](https://docs.openshift.org/latest/dev_guide/persistent_volumes.html) which is named `postgresql` by default, and can be overridden by setting the `openshift_pg_pvc_name` variable. For testing and demo purposes, you may set `openshift_pg_emptydir=yes`. By default, AWX will deploy a PostgreSQL pod inside of your cluster. You will need to create a [Persistent Volume Claim](https://docs.openshift.org/latest/dev_guide/persistent_volumes.html) which is named `postgresql` by default, and can be overridden by setting the `openshift_pg_pvc_name` variable. For testing and demo purposes, you may set `openshift_pg_emptydir=yes`.
If you wish to use an external database, in the inventory file, set the value of `pg_hostname`, and update `pg_username`, `pg_password`, `pg_database`, and `pg_port` with the connection information. When setting `pg_hostname` the installer will assume you have configured the database in that location and will not launch the postgresql pod. If you wish to use an external database, in the inventory file, set the value of `pg_hostname`, and update `pg_username`, `pg_password`, `pg_admin_password`, `pg_database`, and `pg_port` with the connection information. When setting `pg_hostname` the installer will assume you have configured the database in that location and will not launch the postgresql pod.
### Start the build ### Start the build
@@ -503,7 +503,7 @@ If you wish to tag and push built images to a Docker registry, set the following
AWX requires access to a PostgreSQL database, and by default, one will be created and deployed in a container, and data will be persisted to a host volume. In this scenario, you must set the value of `postgres_data_dir` to a path that can be mounted to the container. When the container is stopped, the database files will still exist in the specified path. AWX requires access to a PostgreSQL database, and by default, one will be created and deployed in a container, and data will be persisted to a host volume. In this scenario, you must set the value of `postgres_data_dir` to a path that can be mounted to the container. When the container is stopped, the database files will still exist in the specified path.
If you wish to use an external database, in the inventory file, set the value of `pg_hostname`, and update `pg_username`, `pg_password`, `pg_database`, and `pg_port` with the connection information. If you wish to use an external database, in the inventory file, set the value of `pg_hostname`, and update `pg_username`, `pg_password`, `pg_admin_password`, `pg_database`, and `pg_port` with the connection information.
### Start the build ### Start the build

View File

@@ -272,31 +272,31 @@ supervisor:
@if [ "$(VENV_BASE)" ]; then \ @if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \ . $(VENV_BASE)/awx/bin/activate; \
fi; \ fi; \
supervisord --pidfile=/tmp/supervisor_pid -n /usr/bin/scl enable rh-postgresql10 'supervisord --pidfile=/tmp/supervisor_pid -n'
collectstatic: collectstatic:
@if [ "$(VENV_BASE)" ]; then \ @if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \ . $(VENV_BASE)/awx/bin/activate; \
fi; \ fi; \
mkdir -p awx/public/static && $(PYTHON) manage.py collectstatic --clear --noinput > /dev/null 2>&1 /usr/bin/scl enable rh-postgresql10 'mkdir -p awx/public/static && $(PYTHON) manage.py collectstatic --clear --noinput > /dev/null 2>&1'
uwsgi: collectstatic uwsgi: collectstatic
@if [ "$(VENV_BASE)" ]; then \ @if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \ . $(VENV_BASE)/awx/bin/activate; \
fi; \ fi; \
uwsgi -b 32768 --socket 127.0.0.1:8050 --module=awx.wsgi:application --home=/venv/awx --chdir=/awx_devel/ --vacuum --processes=5 --harakiri=120 --master --no-orphans --py-autoreload 1 --max-requests=1000 --stats /tmp/stats.socket --lazy-apps --logformat "%(addr) %(method) %(uri) - %(proto) %(status)" --hook-accepting1="exec:supervisorctl restart tower-processes:awx-dispatcher tower-processes:awx-receiver" /usr/bin/scl enable rh-postgresql10 'uwsgi -b 32768 --socket 127.0.0.1:8050 --module=awx.wsgi:application --home=/venv/awx --chdir=/awx_devel/ --vacuum --processes=5 --harakiri=120 --master --no-orphans --py-autoreload 1 --max-requests=1000 --stats /tmp/stats.socket --lazy-apps --logformat "%(addr) %(method) %(uri) - %(proto) %(status)" --hook-accepting1="exec:supervisorctl restart tower-processes:awx-dispatcher tower-processes:awx-receiver"'
daphne: daphne:
@if [ "$(VENV_BASE)" ]; then \ @if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \ . $(VENV_BASE)/awx/bin/activate; \
fi; \ fi; \
daphne -b 127.0.0.1 -p 8051 awx.asgi:channel_layer /usr/bin/scl enable rh-postgresql10 'daphne -b 127.0.0.1 -p 8051 awx.asgi:channel_layer'
runworker: runworker:
@if [ "$(VENV_BASE)" ]; then \ @if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \ . $(VENV_BASE)/awx/bin/activate; \
fi; \ fi; \
$(PYTHON) manage.py runworker --only-channels websocket.* /usr/bin/scl enable rh-postgresql10 '$(PYTHON) manage.py runworker --only-channels websocket.*'
# Run the built-in development webserver (by default on http://localhost:8013). # Run the built-in development webserver (by default on http://localhost:8013).
runserver: runserver:
@@ -310,7 +310,7 @@ dispatcher:
@if [ "$(VENV_BASE)" ]; then \ @if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \ . $(VENV_BASE)/awx/bin/activate; \
fi; \ fi; \
$(PYTHON) manage.py run_dispatcher /usr/bin/scl enable rh-postgresql10 '$(PYTHON) manage.py run_dispatcher'
# Run to start the zeromq callback receiver # Run to start the zeromq callback receiver
@@ -318,7 +318,7 @@ receiver:
@if [ "$(VENV_BASE)" ]; then \ @if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \ . $(VENV_BASE)/awx/bin/activate; \
fi; \ fi; \
$(PYTHON) manage.py run_callback_receiver /usr/bin/scl enable rh-postgresql10 '$(PYTHON) manage.py run_callback_receiver'
nginx: nginx:
nginx -g "daemon off;" nginx -g "daemon off;"
@@ -327,7 +327,7 @@ jupyter:
@if [ "$(VENV_BASE)" ]; then \ @if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \ . $(VENV_BASE)/awx/bin/activate; \
fi; \ fi; \
$(MANAGEMENT_COMMAND) shell_plus --notebook /usr/bin/scl enable rh-postgresql10 '$(MANAGEMENT_COMMAND) shell_plus --notebook'
reports: reports:
mkdir -p $@ mkdir -p $@
@@ -648,7 +648,7 @@ clean-elk:
docker rm tools_kibana_1 docker rm tools_kibana_1
psql-container: psql-container:
docker run -it --net tools_default --rm postgres:9.6 sh -c 'exec psql -h "postgres" -p "5432" -U postgres' docker run -it --net tools_default --rm postgres:10 sh -c 'exec psql -h "postgres" -p "5432" -U postgres'
VERSION: VERSION:
@echo "awx: $(VERSION)" @echo "awx: $(VERSION)"

Binary file not shown.

View File

@@ -1,5 +1,5 @@
psycopg2 and the LGPL psycopg2 and the LGPL
===================== ---------------------
psycopg2 is free software: you can redistribute it and/or modify it psycopg2 is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published under the terms of the GNU Lesser General Public License as published
@@ -25,19 +25,14 @@ statement from all source files in the program, then also delete it here.
You should have received a copy of the GNU Lesser General Public License You should have received a copy of the GNU Lesser General Public License
along with psycopg2 (see the doc/ directory.) along with psycopg2 (see the doc/ directory.)
If not, see <http://www.gnu.org/licenses/>. If not, see <https://www.gnu.org/licenses/>.
Alternative licenses Alternative licenses
==================== --------------------
If you prefer you can use the Zope Database Adapter ZPsycopgDA (i.e., The following BSD-like license applies (at your option) to the files following
every file inside the ZPsycopgDA directory) user the ZPL license as the pattern ``psycopg/adapter*.{h,c}`` and ``psycopg/microprotocol*.{h,c}``:
published on the Zope web site, http://www.zope.org/Resources/ZPL.
Also, the following BSD-like license applies (at your option) to the
files following the pattern psycopg/adapter*.{h,c} and
psycopg/microprotocol*.{h,c}:
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it including commercial applications, and to alter it and redistribute it
@@ -52,3 +47,4 @@ psycopg/microprotocol*.{h,c}:
be misrepresented as being the original software. be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.

View File

@@ -84,6 +84,7 @@ pg_username=awx
# pg_password should be random 10 character alphanumeric string, when postgresql is running on kubernetes # pg_password should be random 10 character alphanumeric string, when postgresql is running on kubernetes
# NB: it's a limitation of the "official" postgres helm chart # NB: it's a limitation of the "official" postgres helm chart
pg_password=awxpass pg_password=awxpass
pg_admin_password=postgrespass
pg_database=awx pg_database=awx
pg_port=5432 pg_port=5432
#pg_sslmode=require #pg_sslmode=require

View File

@@ -10,7 +10,8 @@ source /etc/tower/conf.d/environment.sh
ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=$DATABASE_HOST port=$DATABASE_PORT" all ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=$DATABASE_HOST port=$DATABASE_PORT" all
ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=$MEMCACHED_HOST port=$MEMCACHED_PORT" all ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=$MEMCACHED_HOST port=$MEMCACHED_PORT" all
ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=$RABBITMQ_HOST port=$RABBITMQ_PORT" all ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=$RABBITMQ_HOST port=$RABBITMQ_PORT" all
ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m postgresql_db --become-user $DATABASE_USER -a "name=$DATABASE_NAME owner=$DATABASE_USER login_user=$DATABASE_USER login_host=$DATABASE_HOST login_password=$DATABASE_PASSWORD port=$DATABASE_PORT" all ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m postgresql_user --become-user postgres -a "name=$DATABASE_NAME password=$DATABASE_PASSWORD encrypted=yes login_user=postgres login_password=$DATABASE_ADMIN_PASSWORD login_host=postgres" all
ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m postgresql_db --become-user postgres -a "name=$DATABASE_NAME owner=$DATABASE_USER login_user=postgres login_host=$DATABASE_HOST login_password=$DATABASE_ADMIN_PASSWORD port=$DATABASE_PORT" all
awx-manage collectstatic --noinput --clear awx-manage collectstatic --noinput --clear

View File

@@ -10,7 +10,7 @@ source /etc/tower/conf.d/environment.sh
ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=$DATABASE_HOST port=$DATABASE_PORT" all ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=$DATABASE_HOST port=$DATABASE_PORT" all
ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=$MEMCACHED_HOST port=$MEMCACHED_PORT" all ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=$MEMCACHED_HOST port=$MEMCACHED_PORT" all
ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=$RABBITMQ_HOST port=$RABBITMQ_PORT" all ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=$RABBITMQ_HOST port=$RABBITMQ_PORT" all
ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m postgresql_db --become-user $DATABASE_USER -a "name=$DATABASE_NAME owner=$DATABASE_USER login_user=$DATABASE_USER login_host=$DATABASE_HOST login_password=$DATABASE_PASSWORD port=$DATABASE_PORT" all ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m postgresql_db --become-user postgres -a "name=$DATABASE_NAME owner=$DATABASE_USER login_user=$DATABASE_USER login_host=$DATABASE_HOST login_password=$DATABASE_ADMIN_PASSWORD port=$DATABASE_PORT" all
if [ -z "$AWX_SKIP_MIGRATIONS" ]; then if [ -z "$AWX_SKIP_MIGRATIONS" ]; then
awx-manage migrate --noinput awx-manage migrate --noinput

View File

@@ -13,7 +13,7 @@ stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0
[program:uwsgi] [program:uwsgi]
command = /var/lib/awx/venv/awx/bin/uwsgi --socket 127.0.0.1:8050 --module=awx.wsgi:application --vacuum --processes=5 --harakiri=120 --no-orphans --master --max-requests=1000 --master-fifo=/var/lib/awx/awxfifo --lazy-apps -b 32768 command = /usr/bin/scl enable rh-postgresql10 '/var/lib/awx/venv/awx/bin/uwsgi --socket 127.0.0.1:8050 --module=awx.wsgi:application --vacuum --processes=5 --harakiri=120 --no-orphans --master --max-requests=1000 --master-fifo=/var/lib/awx/awxfifo --lazy-apps -b 32768'
directory = /var/lib/awx directory = /var/lib/awx
autostart = true autostart = true
autorestart = true autorestart = true
@@ -25,7 +25,7 @@ stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0
[program:daphne] [program:daphne]
command = /var/lib/awx/venv/awx/bin/daphne -b 127.0.0.1 -p 8051 --websocket_timeout -1 awx.asgi:channel_layer command = /usr/bin/scl enable rh-postgresql10 '/var/lib/awx/venv/awx/bin/daphne -b 127.0.0.1 -p 8051 --websocket_timeout -1 awx.asgi:channel_layer'
directory = /var/lib/awx directory = /var/lib/awx
autostart = true autostart = true
autorestart = true autorestart = true

View File

@@ -5,7 +5,12 @@ USER root
ADD ansible.repo /etc/yum.repos.d/ansible.repo ADD ansible.repo /etc/yum.repos.d/ansible.repo
ADD RPM-GPG-KEY-ansible-release /etc/pki/rpm-gpg/RPM-GPG-KEY-ansible-release ADD RPM-GPG-KEY-ansible-release /etc/pki/rpm-gpg/RPM-GPG-KEY-ansible-release
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 tools/docker-compose/Dockerfile # sync with tools/docker-compose/Dockerfile
RUN yum -y install acl \ RUN yum -y install acl \
@@ -35,7 +40,10 @@ RUN yum -y install acl \
nodejs \ nodejs \
openldap-devel \ openldap-devel \
openssh-server \ openssh-server \
postgresql-devel \ rh-postgresql10-postgresql-devel \
rh-postgresql10-postgresql-server-syspaths \
scl-utils-build \
scl-utils \
python-devel \ python-devel \
python-pip \ python-pip \
python-psutil \ python-psutil \
@@ -63,6 +71,8 @@ RUN chmod +x /tini
RUN python3 -m ensurepip && pip3 install virtualenv RUN python3 -m ensurepip && pip3 install virtualenv
RUN pip install supervisor RUN pip install supervisor
RUN find / -name pg_config
ADD Makefile /tmp/Makefile ADD Makefile /tmp/Makefile
RUN mkdir /tmp/requirements RUN mkdir /tmp/requirements
ADD requirements/requirements_ansible.txt \ ADD requirements/requirements_ansible.txt \
@@ -72,7 +82,7 @@ ADD requirements/requirements_ansible.txt \
requirements/requirements_tower_uninstall.txt \ requirements/requirements_tower_uninstall.txt \
requirements/requirements_git.txt \ requirements/requirements_git.txt \
/tmp/requirements/ /tmp/requirements/
RUN cd /tmp && VENV_BASE="/var/lib/awx/venv" make requirements RUN scl enable rh-postgresql10 """cd /tmp && VENV_BASE="/var/lib/awx/venv" make requirements"""
RUN yum -y remove cyrus-sasl-devel \ RUN yum -y remove cyrus-sasl-devel \
gcc \ gcc \
@@ -82,13 +92,16 @@ RUN yum -y remove cyrus-sasl-devel \
libxml2-devel \ libxml2-devel \
libxslt-devel \ libxslt-devel \
openldap-devel \ openldap-devel \
postgresql-devel \ rh-postgresql10-postgresql-devel \
python-devel \ python-devel \
python36-devel \ python36-devel \
nodejs \ nodejs \
xmlsec1-devel \ xmlsec1-devel \
xmlsec1-openssl-devel xmlsec1-openssl-devel
# makes postgres available for data migrations when upgrading
RUN export PATH=/usr/pgsql-10/bin:$PATH
RUN yum -y clean all RUN yum -y clean all
RUN rm -rf /root/.cache RUN rm -rf /root/.cache

View File

@@ -67,9 +67,9 @@
-e POSTGRESQL_MAX_CONNECTIONS={{ pg_max_connections|default(1024) }} \ -e POSTGRESQL_MAX_CONNECTIONS={{ pg_max_connections|default(1024) }} \
-e POSTGRESQL_USER={{ pg_username }} \ -e POSTGRESQL_USER={{ pg_username }} \
-e POSTGRESQL_PASSWORD={{ pg_password | quote }} \ -e POSTGRESQL_PASSWORD={{ pg_password | quote }} \
-e POSTGRESQL_ADMIN_PASSWORD={{ pg_password | quote }} \ -e POSTGRESQL_ADMIN_PASSWORD={{ pg_admin_password | quote }} \
-e POSTGRESQL_DATABASE={{ pg_database }} \ -e POSTGRESQL_DATABASE={{ pg_database }} \
-e POSTGRESQL_VERSION=9.6 \ -e POSTGRESQL_VERSION=10 \
-n {{ kubernetes_namespace }} -n {{ kubernetes_namespace }}
register: openshift_pg_activate register: openshift_pg_activate
no_log: yes no_log: yes

View File

@@ -2,7 +2,8 @@ DATABASE_USER={{ pg_username }}
DATABASE_NAME={{ pg_database }} DATABASE_NAME={{ pg_database }}
DATABASE_HOST={{ pg_hostname|default('postgresql') }} DATABASE_HOST={{ pg_hostname|default('postgresql') }}
DATABASE_PORT={{ pg_port|default('5432') }} DATABASE_PORT={{ pg_port|default('5432') }}
DATABASE_PASSWORD={{ pg_password | quote }} DATABASE_PASSWORD={{ pg_password|default('awxpass') }}
DATABASE_ADMIN_PASSWORD={{ pg_admin_password|default('postgrespass') }}
MEMCACHED_HOST={{ memcached_hostname|default('localhost') }} MEMCACHED_HOST={{ memcached_hostname|default('localhost') }}
MEMCACHED_PORT={{ memcached_port|default('11211') }} MEMCACHED_PORT={{ memcached_port|default('11211') }}
RABBITMQ_HOST={{ rabbitmq_hostname|default('localhost') }} RABBITMQ_HOST={{ rabbitmq_hostname|default('localhost') }}

View File

@@ -10,11 +10,11 @@ message: |-
Database Name: ${POSTGRESQL_DATABASE} Database Name: ${POSTGRESQL_DATABASE}
Connection URL: postgresql://${DATABASE_SERVICE_NAME}:5432/ Connection URL: postgresql://${DATABASE_SERVICE_NAME}:5432/
For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/blob/master/9.5. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/.
metadata: metadata:
annotations: annotations:
description: |- description: |-
PostgreSQL database service, with persistent storage. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/blob/master/9.5. PostgreSQL database service, with persistent storage. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/.
NOTE: Scaling to more than one replica is not supported. You must have persistent volumes available in your cluster to use this template. NOTE: Scaling to more than one replica is not supported. You must have persistent volumes available in your cluster to use this template.
iconClass: icon-postgresql iconClass: icon-postgresql

View File

@@ -10,7 +10,7 @@ rabbitmq_port: "5672"
rabbitmq_user: "guest" rabbitmq_user: "guest"
rabbitmq_password: "guest" rabbitmq_password: "guest"
postgresql_version: "10.7" postgresql_version: "10"
postgresql_image: "postgres:{{postgresql_version}}" postgresql_image: "postgres:{{postgresql_version}}"

View File

@@ -128,15 +128,16 @@ services:
{% if pg_hostname is not defined %} {% if pg_hostname is not defined %}
postgres: postgres:
image: postgres:10.7 image: centos/postgresql-10-centos7
container_name: awx_postgres container_name: awx_postgres
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- {{ postgres_data_dir }}:/var/lib/postgresql/data:Z - {{ postgres_data_dir }}:/var/lib/postgresql/data:Z
environment: environment:
POSTGRES_USER: {{ pg_username }} POSTGRES_USER: {{ pg_username }}
POSTGRES_PASSWORD: {{ pg_password | quote }} POSTGRES_PASSWORD: {{ pg_password }}
POSTGRES_DB: {{ pg_database }} POSTGRES_DB: {{ pg_database }}
POSTGRESQL_ADMIN_PASSWORD: 'postgrespass' # TODO: Remove This
PGDATA: /var/lib/postgresql/data/pgdata PGDATA: /var/lib/postgresql/data/pgdata
http_proxy: {{ http_proxy | default('') }} http_proxy: {{ http_proxy | default('') }}
https_proxy: {{ https_proxy | default('') }} https_proxy: {{ https_proxy | default('') }}

View File

@@ -2,7 +2,8 @@ DATABASE_USER={{ pg_username }}
DATABASE_NAME={{ pg_database }} DATABASE_NAME={{ pg_database }}
DATABASE_HOST={{ pg_hostname|default('postgres') }} DATABASE_HOST={{ pg_hostname|default('postgres') }}
DATABASE_PORT={{ pg_port|default('5432') }} DATABASE_PORT={{ pg_port|default('5432') }}
DATABASE_PASSWORD={{ pg_password | quote }} DATABASE_PASSWORD={{ pg_password|default('awxpass') }}
DATABASE_ADMIN_PASSWORD={{ pg_admin_password|default('postgrespass') }}
MEMCACHED_HOST={{ memcached_hostname|default('memcached') }} MEMCACHED_HOST={{ memcached_hostname|default('memcached') }}
MEMCACHED_PORT={{ memcached_port|default('11211') }} MEMCACHED_PORT={{ memcached_port|default('11211') }}
RABBITMQ_HOST={{ rabbitmq_hostname|default('rabbitmq') }} RABBITMQ_HOST={{ rabbitmq_hostname|default('rabbitmq') }}

View File

@@ -30,7 +30,7 @@ Markdown==2.6.11 # used for formatting API help
ordereddict==1.1 ordereddict==1.1
prometheus_client==0.6.0 prometheus_client==0.6.0
psutil==5.4.3 psutil==5.4.3
psycopg2==2.7.3.2 # problems with Segmentation faults / wheels on upgrade psycopg2==2.8.2
pygerduty==0.37.0 pygerduty==0.37.0
pyparsing==2.2.0 pyparsing==2.2.0
python-dateutil==2.7.2 # contains support for TZINFO= parsing python-dateutil==2.7.2 # contains support for TZINFO= parsing

View File

@@ -74,7 +74,7 @@ pexpect==4.6.0 # via ansible-runner
pkgconfig==1.5.1 # via xmlsec pkgconfig==1.5.1 # via xmlsec
prometheus_client==0.6.0 prometheus_client==0.6.0
psutil==5.4.3 psutil==5.4.3
psycopg2==2.7.3.2 psycopg2==2.8.2
ptyprocess==0.6.0 # via pexpect ptyprocess==0.6.0 # via pexpect
pyasn1-modules==0.2.5 # via python-ldap, service-identity pyasn1-modules==0.2.5 # via python-ldap, service-identity
pyasn1==0.4.5 # via pyasn1-modules, python-ldap, service-identity pyasn1==0.4.5 # via pyasn1-modules, python-ldap, service-identity

View File

@@ -85,7 +85,7 @@
shell: "oc apply -f /tmp/volumeclaim.yml && rm -rf /tmp/volumeclaim.yml" shell: "oc apply -f /tmp/volumeclaim.yml && rm -rf /tmp/volumeclaim.yml"
- name: Deploy and Activate Postgres - 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 when: postgres_svc_details is defined and postgres_svc_details.rc != 0
register: openshift_pg_activate register: openshift_pg_activate

View File

@@ -64,7 +64,7 @@ spec:
- name: awx-memcached - name: awx-memcached
image: memcached image: memcached
- name: postgres - name: postgres
image: postgres:9.6 image: postgres:10
volumes: volumes:
- name: localdev - name: localdev
persistentVolumeClaim: persistentVolumeClaim:

View File

@@ -90,8 +90,13 @@ services:
- CLUSTERED=true - CLUSTERED=true
- CLUSTER_WITH=rabbitmq_1 - CLUSTER_WITH=rabbitmq_1
postgres: postgres:
image: postgres:10.7 image: centos/postgresql-10-centos7
container_name: tools_postgres_1 container_name: tools_postgres_1
environment:
POSTGRESQL_USER: awx
POSTGRESQL_PASSWORD: awxpass
POSTGRESQL_DATABASE: awx
POSTGRESQL_ADMIN_PASSWORD: postgrespass
memcached: memcached:
image: memcached:alpine image: memcached:alpine
container_name: tools_memcached_1 container_name: tools_memcached_1

View File

@@ -39,10 +39,16 @@ services:
# build: # build:
# context: ./docker-compose # context: ./docker-compose
# dockerfile: Dockerfile-logstash # dockerfile: Dockerfile-logstash
# Postgres Database Container # Postgres Database Container
postgres: postgres:
image: postgres:10.7 image: centos/postgresql-10-centos7
container_name: tools_postgres_1 container_name: tools_postgres_1
environment:
POSTGRESQL_USER: awx
POSTGRESQL_PASSWORD: awxpass
POSTGRESQL_DATABASE: awx
POSTGRESQL_ADMIN_PASSWORD: postgrespass
ports: ports:
- "5432:5432" - "5432:5432"
memcached: memcached:

View File

@@ -5,7 +5,11 @@ ARG UID=0
# Add ansible-devel so that we get collections! # Add ansible-devel so that we get collections!
ADD tools/docker-compose/ansible_nightly.repo /etc/yum.repos.d/ansible_nightly.repo 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 # sync with installer/roles/image_build/templates/Dockerfile.j2
RUN yum -y install acl \ RUN yum -y install acl \
@@ -50,8 +54,10 @@ RUN yum -y install acl \
openldap-devel \ openldap-devel \
openssh-server \ openssh-server \
patch \ patch \
postgresql-contrib \ rh-postgresql10-postgresql-devel \
postgresql-devel \ rh-postgresql10-postgresql-server-syspaths \
scl-utils-build \
scl-utils \
python-devel \ python-devel \
python-pip \ python-pip \
python-psutil \ 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 /usr/bin/ssh-keygen -q -t rsa -N "" -f /root/.ssh/id_rsa
RUN mkdir -p /data/db 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.egg-link /tmp/awx.egg-link
ADD tools/docker-compose/awx-manage /usr/local/bin/awx-manage ADD tools/docker-compose/awx-manage /usr/local/bin/awx-manage
ADD tools/docker-compose/awx.egg-info /tmp/awx.egg-info ADD tools/docker-compose/awx.egg-info /tmp/awx.egg-info
@@ -105,7 +114,7 @@ ADD requirements/requirements.txt \
requirements/requirements_tower_uninstall.txt \ requirements/requirements_tower_uninstall.txt \
/tmp/requirements/ /tmp/requirements/
RUN mkdir -p /venv && chmod g+w /venv 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 # Use the distro provided npm to bootstrap our required version of node
RUN npm install -g n RUN npm install -g n
@@ -127,7 +136,7 @@ RUN yum -y remove cyrus-sasl-devel \
libxml2-devel \ libxml2-devel \
libxslt-devel \ libxslt-devel \
openldap-devel \ openldap-devel \
postgresql-devel \ rh-postgresql10-postgresql-devel \
python-devel \ python-devel \
python36-devel \ python36-devel \
nodejs \ nodejs \
@@ -138,6 +147,9 @@ RUN yum -y clean all
RUN rm -rf /root/.cache 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 RUN localedef -c -i en_US -f UTF-8 en_US.UTF-8
ENV LANG en_US.UTF-8 ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en ENV LANGUAGE en_US:en

View File

@@ -1,4 +1,4 @@
#!/venv/awx/bin/python #!/usr/bin/awx-python
# EASY-INSTALL-ENTRY-SCRIPT: 'awx','console_scripts','awx-manage' # EASY-INSTALL-ENTRY-SCRIPT: 'awx','console_scripts','awx-manage'
import sys import sys
from pkg_resources import load_entry_point from pkg_resources import load_entry_point

View File

@@ -10,9 +10,8 @@ ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=${RABBITMQ_HOST} port=5
# TODO: FIX # TODO: FIX
#/etc/init.d/ssh start #/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 encrypted=yes login_user=postgres login_password=postgrespass 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 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_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_host=postgres" all
# Move to the source directory so we can bootstrap # Move to the source directory so we can bootstrap
if [ -f "/awx_devel/manage.py" ]; then if [ -f "/awx_devel/manage.py" ]; then

View File

@@ -1,7 +1,6 @@
#!/bin/bash #!/usr/bin/env bash
# Enable needed Software Collections, if installed # 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 /etc/scl/prefixes/$scl ]; then
if [ -f `cat /etc/scl/prefixes/$scl`/$scl/enable ]; then if [ -f `cat /etc/scl/prefixes/$scl`/$scl/enable ]; then
. `cat /etc/scl/prefixes/$scl`/$scl/enable . `cat /etc/scl/prefixes/$scl`/$scl/enable
@@ -10,9 +9,11 @@ for scl in rh-python36; do
done done
# Enable Tower virtualenv # Enable Tower virtualenv
if [ -f /var/lib/awx/venv/awx/bin/activate ]; then for venv_path in /var/lib/awx/venv/awx /venv/awx; do
. /var/lib/awx/venv/awx/bin/activate if [ -f $venv_path/bin/activate ]; then
fi . $venv_path/bin/activate
fi
done
# Run the requested Python command, using the interpreter from the path # Run the requested Python command, using the interpreter from the path
exec python3 "$@" exec python3 "$@"