Fix docker-compose installs

In a series of unfortunate events, my patch yesterday didnt actually work. This fixes that.
This commit is contained in:
Shane McDonald 2019-03-27 12:01:10 -04:00
parent 055e7b4974
commit c3ba851908
8 changed files with 29 additions and 44 deletions

View File

@ -27,7 +27,7 @@ This document provides a guide for installing AWX.
- [Start the build](#start-the-build-1)
- [Accessing AWX](#accessing-awx-1)
- [SSL Termination](#ssl-termination)
- [Docker or Docker Compose](#docker-or-docker-compose)
- [Docker Compose](#docker-compose)
- [Prerequisites](#prerequisites-3)
- [Pre-build steps](#pre-build-steps-2)
- [Deploying to a remote host](#deploying-to-a-remote-host)
@ -88,7 +88,7 @@ The [installer](./installer) directory contains an [inventory](./installer/inven
In the sections below, you'll find deployment details and instructions for each platform:
- [OpenShift](#openshift)
- [Kubernetes](#kubernetes)
- [Docker or Docker Compose](#docker-or-docker-compose).
- [Docker Compose](#docker-compose).
### Official vs Building Images
@ -391,14 +391,13 @@ If your provider is able to allocate an IP Address from the Ingress controller t
Unlike Openshift's `Route` the Kubernetes `Ingress` doesn't yet handle SSL termination. As such the default configuration will only expose AWX through HTTP on port 80. You are responsible for configuring SSL support until support is added (either to Kubernetes or AWX itself).
## Docker or Docker-Compose
## Docker-Compose
### Prerequisites
- [Docker](https://docs.docker.com/engine/installation/) on the host where AWX will be deployed. After installing Docker, the Docker service must be started (depending on your OS, you may have to add the local user that uses Docker to the ``docker`` group, refer to the documentation for details)
- [docker-py](https://github.com/docker/docker-py) Python module.
If you're installing using Docker Compose, you'll need [Docker Compose](https://docs.docker.com/compose/install/).
- [Docker Compose](https://docs.docker.com/compose/install/).
### Pre-build steps
@ -445,13 +444,9 @@ Before starting the build process, review the [inventory](./installer/inventory)
> Optionally, provide the path to a file that contains a certificate and its private key.
*use_docker_compose*
> Switch to ``true`` to use Docker Compose instead of the standalone Docker install.
*docker_compose_dir*
When using docker-compose, the `docker-compose.yml` file will be created there (default `/var/lib/awx`).
When using docker-compose, the `docker-compose.yml` file will be created there (default `/tmp/awxcompose`).
*ca_trust_dir*

View File

@ -1 +1 @@
3.0.1
4.0.0

View File

@ -6,9 +6,10 @@ rabbitmq_image: "ansible/awx_rabbitmq:{{rabbitmq_version}}"
rabbitmq_default_vhost: "awx"
rabbitmq_erlang_cookie: "cookiemonster"
rabbitmq_port: "5672"
rabbitmq_default_username: "guest"
rabbitmq_default_password: "guest"
rabbitmq_user: "guest"
rabbitmq_password: "guest"
postgresql_version: "9.6"
postgresql_image: "postgres:{{postgresql_version}}"
docker_compose_dir: "/tmp/awxcompose"

View File

@ -1,37 +1,20 @@
---
- include_vars: '{{ item }}'
with_first_found:
- files:
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml' # CentOS-7
- '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml' # RedHat-7
- '{{ ansible_distribution }}.yml' # CentOS
- '{{ ansible_os_family }}.yml' # RedHat
- 'default.yml'
- name: Create {{ docker_compose_dir }} directory
file:
path: "{{ docker_compose_dir }}"
state: directory
- name: Create docker-compose.yml file
- name: Create Docker Compose Configuration
template:
src: docker-compose.yml.j2
dest: "{{ docker_compose_dir }}/docker-compose.yml"
src: "{{ item }}.j2"
dest: "{{ docker_compose_dir }}/{{ item }}"
mode: 0600
with_items:
- environment.sh
- credentials.py
- docker-compose.yml
register: awx_compose_config
- name: Render secrets file
template:
src: environment.sh.j2
dest: "{{ docker_compose_dir }}/environment.sh"
mode: 0600
- name: Render application credentials
template:
src: credentials.py.j2
dest: "{{ docker_compose_dir }}/credentials.py"
mode: 0600
- name: Render SECRET_KEY file
copy:
content: "{{ secret_key }}"
@ -44,9 +27,9 @@
register: awx_compose_start
- name: Update CA trust in awx_web container
command: docker exec awx_web_1 '/usr/bin/update-ca-trust'
command: docker exec awx_web '/usr/bin/update-ca-trust'
when: awx_compose_config.changed or awx_compose_start.changed
- name: Update CA trust in awx_task container
command: docker exec awx_task_1 '/usr/bin/update-ca-trust'
command: docker exec awx_task '/usr/bin/update-ca-trust'
when: awx_compose_config.changed or awx_compose_start.changed

View File

@ -12,9 +12,10 @@ DATABASES = {
BROKER_URL = 'amqp://{}:{}@{}:{}/{}'.format(
"{{ rabbitmq_user }}",
"{{ rabbitmq_password }}",
"localhost",
"rabbitmq",
"5672",
"awx")
CHANNEL_LAYERS = {
'default': {'BACKEND': 'asgi_amqp.AMQPChannelLayer',
'ROUTING': 'awx.main.routing.channel_routing',

View File

@ -4,6 +4,7 @@ services:
web:
image: {{ awx_web_docker_actual_image }}
container_name: awx_web
depends_on:
- rabbitmq
- memcached
@ -50,6 +51,7 @@ services:
task:
image: {{ awx_task_docker_actual_image }}
container_name: awx_task
depends_on:
- rabbitmq
- memcached
@ -95,18 +97,23 @@ services:
rabbitmq:
image: {{ rabbitmq_image }}
container_name: awx_rabbitmq
restart: unless-stopped
environment:
RABBITMQ_DEFAULT_VHOST: awx
RABBITMQ_ERLANG_COOKIE: cookiemonster
RABBITMQ_DEFAULT_VHOST: "{{ rabbitmq_default_vhost }}"
RABBITMQ_DEFAULT_USER: "{{ rabbitmq_user }}"
RABBITMQ_DEFAULT_PASS: "{{ rabbitmq_password }}"
RABBITMQ_ERLANG_COOKIE: {{ rabbitmq_erlang_cookie }}
memcached:
image: memcached:alpine
container_name: awx_memcached
restart: unless-stopped
{% if pg_hostname is not defined %}
postgres:
image: postgres:9.6
container_name: awx_postgres
restart: unless-stopped
volumes:
- {{ postgres_data_dir }}:/var/lib/postgresql/data:Z

View File

@ -1 +0,0 @@
docker_compose_dir: "/usr/local/var/lib/awx"

View File

@ -1 +0,0 @@
docker_compose_dir: "/var/lib/awx"