diff options
27 files changed, 97 insertions, 60 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b85b990359..cc380e5dfd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/INSTALL.md b/INSTALL.md index 100ae05332..216b97bc0b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -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 @@ -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)" diff --git a/docs/licenses/psycopg2-2.7.3.2.tar.gz b/docs/licenses/psycopg2-2.7.3.2.tar.gz Binary files differdeleted file mode 100644 index 387fcb469a..0000000000 --- a/docs/licenses/psycopg2-2.7.3.2.tar.gz +++ /dev/null diff --git a/docs/licenses/psycopg2-2.8.2.tar.gz b/docs/licenses/psycopg2-2.8.2.tar.gz Binary files differnew file mode 100644 index 0000000000..52dcabea1e --- /dev/null +++ b/docs/licenses/psycopg2-2.8.2.tar.gz diff --git a/docs/licenses/psycopg2.txt b/docs/licenses/psycopg2.txt index 360a44f6b4..fdae2e416a 100644 --- a/docs/licenses/psycopg2.txt +++ b/docs/licenses/psycopg2.txt @@ -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. +
\ No newline at end of file diff --git a/installer/inventory b/installer/inventory index 96c5cef8a8..9213ba7f18 100644 --- a/installer/inventory +++ b/installer/inventory @@ -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 diff --git a/installer/roles/image_build/files/launch_awx.sh b/installer/roles/image_build/files/launch_awx.sh index 97909bc29b..e9a8cff18c 100755 --- a/installer/roles/image_build/files/launch_awx.sh +++ b/installer/roles/image_build/files/launch_awx.sh @@ -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 diff --git a/installer/roles/image_build/files/launch_awx_task.sh b/installer/roles/image_build/files/launch_awx_task.sh index 2c26e5ce63..48526c20ba 100755 --- a/installer/roles/image_build/files/launch_awx_task.sh +++ b/installer/roles/image_build/files/launch_awx_task.sh @@ -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 diff --git a/installer/roles/image_build/files/supervisor.conf b/installer/roles/image_build/files/supervisor.conf index 1409b8b2c2..cc198159b4 100644 --- a/installer/roles/image_build/files/supervisor.conf +++ b/installer/roles/image_build/files/supervisor.conf @@ -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 diff --git a/installer/roles/image_build/templates/Dockerfile.j2 b/installer/roles/image_build/templates/Dockerfile.j2 index 68bae23905..46aad50f8b 100644 --- a/installer/roles/image_build/templates/Dockerfile.j2 +++ b/installer/roles/image_build/templates/Dockerfile.j2 @@ -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 diff --git a/installer/roles/kubernetes/tasks/main.yml b/installer/roles/kubernetes/tasks/main.yml index 812f6b6715..221180424d 100644 --- a/installer/roles/kubernetes/tasks/main.yml +++ b/installer/roles/kubernetes/tasks/main.yml @@ -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 diff --git a/installer/roles/kubernetes/templates/environment.sh.j2 b/installer/roles/kubernetes/templates/environment.sh.j2 index 1c5497c922..cd1c34cb05 100644 --- a/installer/roles/kubernetes/templates/environment.sh.j2 +++ b/installer/roles/kubernetes/templates/environment.sh.j2 @@ -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') }} diff --git a/installer/roles/kubernetes/templates/postgresql-persistent.yml.j2 b/installer/roles/kubernetes/templates/postgresql-persistent.yml.j2 index 718479ec85..3bc82ae6f3 100644 --- a/installer/roles/kubernetes/templates/postgresql-persistent.yml.j2 +++ b/installer/roles/kubernetes/templates/postgresql-persistent.yml.j2 @@ -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 diff --git a/installer/roles/local_docker/defaults/main.yml b/installer/roles/local_docker/defaults/main.yml index af0064a7b8..86bc710cb4 100644 --- a/installer/roles/local_docker/defaults/main.yml +++ b/installer/roles/local_docker/defaults/main.yml @@ -10,7 +10,7 @@ rabbitmq_port: "5672" rabbitmq_user: "guest" rabbitmq_password: "guest" -postgresql_version: "10.7" +postgresql_version: "10" postgresql_image: "postgres:{{postgresql_version}}" diff --git a/installer/roles/local_docker/templates/docker-compose.yml.j2 b/installer/roles/local_docker/templates/docker-compose.yml.j2 index dcda12c4fc..97e98e3e55 100644 --- a/installer/roles/local_docker/templates/docker-compose.yml.j2 +++ b/installer/roles/local_docker/templates/docker-compose.yml.j2 @@ -128,15 +128,16 @@ services: {% if pg_hostname is not defined %} postgres: - image: postgres:10.7 + image: centos/postgresql-10-centos7 container_name: awx_postgres restart: unless-stopped volumes: - {{ postgres_data_dir }}:/var/lib/postgresql/data:Z environment: POSTGRES_USER: {{ pg_username }} - POSTGRES_PASSWORD: {{ pg_password | quote }} + POSTGRES_PASSWORD: {{ pg_password }} POSTGRES_DB: {{ pg_database }} + POSTGRESQL_ADMIN_PASSWORD: 'postgrespass' # TODO: Remove This PGDATA: /var/lib/postgresql/data/pgdata http_proxy: {{ http_proxy | default('') }} https_proxy: {{ https_proxy | default('') }} diff --git a/installer/roles/local_docker/templates/environment.sh.j2 b/installer/roles/local_docker/templates/environment.sh.j2 index 6bf747b0b0..7d78b8c96f 100644 --- a/installer/roles/local_docker/templates/environment.sh.j2 +++ b/installer/roles/local_docker/templates/environment.sh.j2 @@ -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') }} diff --git a/requirements/requirements.in b/requirements/requirements.in index 5adb3eae41..38514027a3 100644 --- a/requirements/requirements.in +++ b/requirements/requirements.in @@ -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 diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 5209b57126..d154eac148 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -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 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 "$@" |