AWX nginxをHTTPとHTTPS両方起動する構成を構築したメモ

### docker containerのcommit
```
docker commit <ID#1> ansible/awx_web_https:7.0.0   <- HTTPS用
docker commit <ID#2> ansible/awx_web_http:7.0.0   <- HTTP用
```

docker imagesの確認

```
[root@awx awx]# docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
ansible/awx_web_https   7.0.0               e29aeea4c05f        About an hour ago   1.67GB
ansible/awx_web_http    7.0.0               5dbff71f831b        2 hours ago         1.67GB
postgres                9.6                 61c59b9a763f        4 days ago          230MB
ansible/awx_task        7.0.0               dc5983bbaf55        12 days ago         1.68GB
ansible/awx_web         7.0.0               6a942a0c5461        12 days ago         1.65GB
memcached               alpine              61705502e804        2 weeks ago         9.01MB
ansible/awx_rabbitmq    3.7.4               e08fe791079e        17 months ago       85.6MB
```


### docker-compose.ymlの変更
デフォルトの/var/lib/awx/docker-compose.yml

```
version: '2'
services:

  web:
    image: ansible/awx_web:7.0.0
    container_name: awx_web
    depends_on:
      - rabbitmq
      - memcached
      - postgres
    ports:
      - "443:8052"
    hostname: awxweb
    user: root
    restart: unless-stopped
    volumes:
      - "/var/lib/awx/SECRET_KEY:/etc/tower/SECRET_KEY"
      - "/var/lib/awx/environment.sh:/etc/tower/conf.d/environment.sh"
      - "/var/lib/awx/credentials.py:/etc/tower/conf.d/credentials.py"
      - "/var/lib/awx/projects:/var/lib/awx/projects:rw"
    environment:
      http_proxy:
      https_proxy:
      no_proxy:

  task:
    image: ansible/awx_task:7.0.0
    container_name: awx_task
    depends_on:
      - rabbitmq
      - memcached
      - web
      - postgres
    hostname: awx
    user: root
    restart: unless-stopped
    volumes:
      - "/var/lib/awx/SECRET_KEY:/etc/tower/SECRET_KEY"
      - "/var/lib/awx/environment.sh:/etc/tower/conf.d/environment.sh"
      - "/var/lib/awx/credentials.py:/etc/tower/conf.d/credentials.py"
      - "/var/lib/awx/projects:/var/lib/awx/projects:rw"
    environment:
      http_proxy:
      https_proxy:
      no_proxy:
　　　　　　　　　　　　　(略)
```

変更後の/var/lib/awx/docker-compose.yml

```
version: '2'
services:

  web1:
    image: ansible/awx_web_https:7.0.0
    container_name: awx_https
    depends_on:
      - rabbitmq
      - memcached
      - postgres
    ports:
      - "443:8052"
    hostname: awxweb
    user: root
    restart: unless-stopped
    volumes:
      - "/var/lib/awx/SECRET_KEY:/etc/tower/SECRET_KEY"
      - "/var/lib/awx/environment.sh:/etc/tower/conf.d/environment.sh"
      - "/var/lib/awx/credentials.py:/etc/tower/conf.d/credentials.py"
      - "/var/lib/awx/projects:/var/lib/awx/projects:rw"
    environment:
      http_proxy:
      https_proxy:
      no_proxy:

  web2:
    image: ansible/awx_web_http:7.0.0
    container_name: awx_http
    depends_on:
      - rabbitmq
      - memcached
      - postgres
    ports:
      - "80:8052"
    hostname: awxweb
    user: root
    restart: unless-stopped
    volumes:
      - "/var/lib/awx/SECRET_KEY:/etc/tower/SECRET_KEY"
      - "/var/lib/awx/environment.sh:/etc/tower/conf.d/environment.sh"
      - "/var/lib/awx/credentials.py:/etc/tower/conf.d/credentials.py"
      - "/var/lib/awx/projects:/var/lib/awx/projects:rw"
    environment:
      http_proxy:
      https_proxy:
      no_proxy:

  task:
    image: ansible/awx_task:7.0.0
    container_name: awx_task
    depends_on:
      - rabbitmq
      - memcached
      - web1
      - web2
      - postgres
    hostname: awx
    user: root
    restart: unless-stopped
    volumes:
      - "/var/lib/awx/SECRET_KEY:/etc/tower/SECRET_KEY"
      - "/var/lib/awx/environment.sh:/etc/tower/conf.d/environment.sh"
      - "/var/lib/awx/credentials.py:/etc/tower/conf.d/credentials.py"
      - "/var/lib/awx/projects:/var/lib/awx/projects:rw"
    environment:
      http_proxy:
      https_proxy:
      no_proxy:
　　　　　　　　　　　　　　　　　　　　　(略)
```
AWX起動

```
[root@awx awx]# docker-compose up -d
Starting awx_rabbitmq  ... done
Starting awx_memcached ... done
Starting awx_postgres  ... done
Starting awx_https     ... done
Starting awx_http      ... done
Starting awx_task      ... done
[root@awx awx]# docker-compose ps
    Name                   Command               State                               Ports
----------------------------------------------------------------------------------------------------------------------
awx_http        /tini -- /bin/sh -c /usr/b ...   Up      0.0.0.0:80->8052/tcp
awx_https       /tini -- /bin/sh -c /usr/b ...   Up      0.0.0.0:443->8052/tcp
awx_memcached   docker-entrypoint.sh memcached   Up      11211/tcp
awx_postgres    docker-entrypoint.sh postgres    Up      5432/tcp
awx_rabbitmq    docker-entrypoint.sh /bin/ ...   Up      15671/tcp, 15672/tcp, 25672/tcp, 4369/tcp, 5671/tcp, 5672/tcp
awx_task        /tini -- /bin/sh -c /usr/b ...   Up      8052/tcp
```