Merge pull request #4058 from rooftopcellist/pg10

Postgres 10 Upgrade

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-09-12 18:58:34 +00:00 committed by GitHub
commit 70057bc0f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 150 additions and 64 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
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
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
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

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`.
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
@ -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.
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

View File

@ -272,31 +272,31 @@ supervisor:
@if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \
fi; \
supervisord --pidfile=/tmp/supervisor_pid -n
/usr/bin/scl enable rh-postgresql10 'supervisord --pidfile=/tmp/supervisor_pid -n'
collectstatic:
@if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \
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
@if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \
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:
@if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \
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:
@if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \
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).
runserver:
@ -310,7 +310,7 @@ dispatcher:
@if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \
fi; \
$(PYTHON) manage.py run_dispatcher
/usr/bin/scl enable rh-postgresql10 '$(PYTHON) manage.py run_dispatcher'
# Run to start the zeromq callback receiver
@ -318,7 +318,7 @@ receiver:
@if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \
fi; \
$(PYTHON) manage.py run_callback_receiver
/usr/bin/scl enable rh-postgresql10 '$(PYTHON) manage.py run_callback_receiver'
nginx:
nginx -g "daemon off;"
@ -327,7 +327,7 @@ jupyter:
@if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \
fi; \
$(MANAGEMENT_COMMAND) shell_plus --notebook
/usr/bin/scl enable rh-postgresql10 '$(MANAGEMENT_COMMAND) shell_plus --notebook'
reports:
mkdir -p $@
@ -648,7 +648,7 @@ clean-elk:
docker rm tools_kibana_1
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:
@echo "awx: $(VERSION)"

Binary file not shown.

View File

@ -1,5 +1,5 @@
psycopg2 and the LGPL
=====================
---------------------
psycopg2 is free software: you can redistribute it and/or modify it
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
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
====================
--------------------
If you prefer you can use the Zope Database Adapter ZPsycopgDA (i.e.,
every file inside the ZPsycopgDA directory) user the ZPL license as
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}:
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,
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.
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
# NB: it's a limitation of the "official" postgres helm chart
pg_password=awxpass
pg_admin_password=postgrespass
pg_database=awx
pg_port=5432
#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=$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 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

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=$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 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
awx-manage migrate --noinput

View File

@ -13,7 +13,7 @@ stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[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
autostart = true
autorestart = true
@ -25,7 +25,7 @@ stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[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
autostart = true
autorestart = true

View File

@ -5,7 +5,12 @@ USER root
ADD ansible.repo /etc/yum.repos.d/ansible.repo
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
RUN yum -y install acl \
@ -35,7 +40,10 @@ RUN yum -y install acl \
nodejs \
openldap-devel \
openssh-server \
postgresql-devel \
rh-postgresql10-postgresql-devel \
rh-postgresql10-postgresql-server-syspaths \
scl-utils-build \
scl-utils \
python-devel \
python-pip \
python-psutil \
@ -63,6 +71,8 @@ RUN chmod +x /tini
RUN python3 -m ensurepip && pip3 install virtualenv
RUN pip install supervisor
RUN find / -name pg_config
ADD Makefile /tmp/Makefile
RUN mkdir /tmp/requirements
ADD requirements/requirements_ansible.txt \
@ -72,7 +82,7 @@ ADD requirements/requirements_ansible.txt \
requirements/requirements_tower_uninstall.txt \
requirements/requirements_git.txt \
/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 \
gcc \
@ -82,13 +92,16 @@ RUN yum -y remove cyrus-sasl-devel \
libxml2-devel \
libxslt-devel \
openldap-devel \
postgresql-devel \
rh-postgresql10-postgresql-devel \
python-devel \
python36-devel \
nodejs \
xmlsec1-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 rm -rf /root/.cache

View File

@ -67,9 +67,9 @@
-e POSTGRESQL_MAX_CONNECTIONS={{ pg_max_connections|default(1024) }} \
-e POSTGRESQL_USER={{ pg_username }} \
-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_VERSION=9.6 \
-e POSTGRESQL_VERSION=10 \
-n {{ kubernetes_namespace }}
register: openshift_pg_activate
no_log: yes

View File

@ -2,7 +2,8 @@ DATABASE_USER={{ pg_username }}
DATABASE_NAME={{ pg_database }}
DATABASE_HOST={{ pg_hostname|default('postgresql') }}
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_PORT={{ memcached_port|default('11211') }}
RABBITMQ_HOST={{ rabbitmq_hostname|default('localhost') }}

View File

@ -10,11 +10,11 @@ message: |-
Database Name: ${POSTGRESQL_DATABASE}
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:
annotations:
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.
iconClass: icon-postgresql
@ -104,7 +104,7 @@ objects:
name: ${DATABASE_SERVICE_NAME}
- name: POSTGRESQL_MAX_CONNECTIONS
value: ${POSTGRESQL_MAX_CONNECTIONS}
image: registry.access.redhat.com/rhscl/postgresql-96-rhel7
image: registry.access.redhat.com/rhscl/postgresql-10-rhel7
imagePullPolicy: IfNotPresent
livenessProbe:
initialDelaySeconds: 30

View File

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

View File

@ -1,2 +1,52 @@
---
- name: Check for existing Postgres data
stat:
path: "{{ postgres_data_dir }}/pgdata/PG_VERSION"
register: pg_version_file
- name: Record Postgres version
set_fact:
old_pg_version: "{{ lookup('file', postgres_data_dir + '/pgdata/PG_VERSION') }}"
when: pg_version_file.stat.exists
- name: Determine whether to upgrade postgres
set_fact:
upgrade_postgres: "{{ old_pg_version is defined and old_pg_version == '9.6' }}"
- name: Set up new postgres paths pre-upgrade
file:
state: directory
path: "{{ item }}"
recurse: yes
when: upgrade_postgres | bool
with_items:
- "{{ postgres_data_dir }}/10/data"
- name: Stop AWX before upgrading postgres
docker_service:
project_src: "{{ docker_compose_dir }}"
stopped: yes
when: upgrade_postgres | bool
- name: Upgrade Postgres
shell: |
docker run --rm \
-v {{ postgres_data_dir }}/pgdata:/var/lib/postgresql/9.6/data \
-v {{ postgres_data_dir }}/10/data:/var/lib/postgresql/10/data \
-e PGUSER={{ pg_username }} -e POSTGRES_INITDB_ARGS="-U {{ pg_username }}" \
tianon/postgres-upgrade:9.6-to-10 --username={{ pg_username }}
when: upgrade_postgres | bool
- name: Copy old pg_hba.conf
copy:
src: "{{ postgres_data_dir + '/pgdata/pg_hba.conf' }}"
dest: "{{ postgres_data_dir + '/10/data/' }}"
when: upgrade_postgres | bool
- name: Remove old data directory
file:
path: "{{ postgres_data_dir + '/pgdata' }}"
state: absent
- import_tasks: set_image.yml
- import_tasks: compose.yml

View File

@ -128,14 +128,14 @@ services:
{% if pg_hostname is not defined %}
postgres:
image: postgres:9.6
image: postgres:10
container_name: awx_postgres
restart: unless-stopped
volumes:
- {{ postgres_data_dir }}:/var/lib/postgresql/data:Z
- {{ postgres_data_dir }}/10/data/:/var/lib/postgresql/data/pgdata:Z
environment:
POSTGRES_USER: {{ pg_username }}
POSTGRES_PASSWORD: {{ pg_password | quote }}
POSTGRES_PASSWORD: {{ pg_password }}
POSTGRES_DB: {{ pg_database }}
PGDATA: /var/lib/postgresql/data/pgdata
http_proxy: {{ http_proxy | default('') }}

View File

@ -2,7 +2,8 @@ DATABASE_USER={{ pg_username }}
DATABASE_NAME={{ pg_database }}
DATABASE_HOST={{ pg_hostname|default('postgres') }}
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_PORT={{ memcached_port|default('11211') }}
RABBITMQ_HOST={{ rabbitmq_hostname|default('rabbitmq') }}

View File

@ -30,7 +30,7 @@ Markdown==2.6.11 # used for formatting API help
ordereddict==1.1
prometheus_client==0.6.0
psutil==5.4.3
psycopg2==2.7.3.2 # problems with Segmentation faults / wheels on upgrade
psycopg2==2.8.2
pygerduty==0.37.0
pyparsing==2.2.0
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
prometheus_client==0.6.0
psutil==5.4.3
psycopg2==2.7.3.2
psycopg2==2.8.2
ptyprocess==0.6.0 # via pexpect
pyasn1-modules==0.2.5 # via 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"
- 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

View File

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

View File

@ -90,8 +90,13 @@ services:
- CLUSTERED=true
- CLUSTER_WITH=rabbitmq_1
postgres:
image: postgres:9.6
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

View File

@ -39,10 +39,16 @@ services:
# build:
# context: ./docker-compose
# dockerfile: Dockerfile-logstash
# Postgres Database Container
postgres:
image: postgres:9.6
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:

View File

@ -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

View File

@ -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

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
#/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

View File

@ -11,4 +11,4 @@ EOF
rm /tmp/passwd
fi
exec $@
exec scl enable rh-postgresql10 "$@"

View File

@ -8,4 +8,4 @@ sed -i "s/placeholder/$(cat /awx_devel/VERSION)/" /awx_devel/awx.egg-info/PKG-IN
cp /tmp/awx.egg-link /venv/awx/lib/python3.6/site-packages/awx.egg-link
cp awx/settings/local_settings.py.docker_compose awx/settings/local_settings.py
make "${1:-test}"
scl enable rh-postgresql10 "make \"${1:-test}\""

View File

@ -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 "$@"