ansible/roles/awx/templates/docker-compose.yml.j2
2021-06-10 14:41:21 +02:00

103 lines
3.8 KiB
Django/Jinja

---
version: '2.1'
services:
{% for i in range(cluster_node_count|default(1)|int) %}
{% set container_postfix = loop.index %}
{% set awx_sdb_port_start = sdb_port_base|int + (loop.index0*1000) | int %}
{% set awx_sdb_port_end = sdb_port_base|int +100 + (loop.index0*1000) | int %}
# Primary AWX Development Container
awx_{{ container_postfix }}:
user: "{{ user_id }}"
image: "{{ awx_image }}:{{ awx_image_tag }}"
container_name: {{ awx_prefix }}_awx_{{ container_postfix }}
hostname: awx_{{ container_postfix }}
command: launch_awx.sh
environment:
OS: "{{ os_info.stdout }}"
SDB_HOST: 0.0.0.0
SDB_PORT: {{ awx_sdb_port_start }}
AWX_GROUP_QUEUES: tower
RECEPTORCTL_SOCKET: /var/run/receptor/receptor.sock
{% if loop.index == 1 %}
RUN_MIGRATIONS: 1
{% endif %}
links:
- postgres
- redis_{{ container_postfix }}
working_dir: "/awx_devel"
volumes:
- "{{ awx_basedir }}/{{ awx_version }}:/awx_devel"
- "{{ awx_composedir }}/supervisor.conf:/etc/supervisord.conf"
- "{{ awx_composedir }}//database.py:/etc/tower/conf.d/database.py"
- "{{ awx_composedir }}//websocket_secret.py:/etc/tower/conf.d/websocket_secret.py"
- "{{ awx_composedir }}//local_settings.py:/etc/tower/conf.d/local_settings.py"
- "{{ awx_composedir }}//SECRET_KEY:/etc/tower/SECRET_KEY"
- "{{ awx_composedir }}/receptor.conf:/etc/receptor/receptor.conf"
- "/sys/fs/cgroup:/sys/fs/cgroup"
- "~/.kube/config:/var/lib/awx/.kube/config"
- "redis_socket_{{ container_postfix }}:/var/run/redis/:rw"
- "receptor_{{ container_postfix }}:/var/run/receptor/"
privileged: true
tty: true
ports:
- "{{ awx_sdb_port_start }}-{{ awx_sdb_port_end }}:{{ awx_sdb_port_start }}-{{ awx_sdb_port_end }}" # sdb-listen
{% if cluster_node_count|default(1)|int == 1 %}
#- "6899:6899"
#- "8080:8080" # unused but mapped for debugging
#- "8888:8888" # jupyter notebook
- "{{ http_port }}:8013" # http
- "{{ https_port }}:8043" # https
{% endif %}
redis_{{ container_postfix }}:
image: redis:latest
container_name: {{ awx_prefix }}_redis_{{ container_postfix }}
volumes:
- "{{ awx_composedir }}/redis/redis.conf:/usr/local/etc/redis/redis.conf"
- "redis_socket_{{ container_postfix }}:/var/run/redis/:rw"
entrypoint: ["redis-server"]
command: ["/usr/local/etc/redis/redis.conf"]
{% endfor %}
{% if cluster_node_count|default(1)|int > 1 %}
haproxy:
user: "{{ user_id }}"
image: haproxy
container_name: {{ awx_prefix }}_haproxy_1
volumes:
- "{{ awx_composedir }}/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg"
ports:
- "{{ http_port }}:8013"
- "{{ https_port }}:8043"
- "1936:1936"
depends_on:
{% for i in range(cluster_node_count|default(1)|int) -%}
{% set container_postfix = loop.index %}
- "awx_{{ container_postfix }}"
{% endfor %}
{% endif %}
# A useful container that simply passes through log messages to the console
# helpful for testing awx/tower logging
# logstash:
# build:
# context: ./docker-compose
# dockerfile: Dockerfile-logstash
postgres:
image: postgres:12
container_name: {{ awx_prefix }}_postgres_1
environment:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_USER: {{ pg_username }}
POSTGRES_DB: {{ pg_database }}
POSTGRES_PASSWORD: {{ pg_password }}
volumes:
- "awx_db:/var/lib/postgresql/data"
volumes:
awx_db:
name: {{ awx_prefix }}_awx_db
{% for i in range(cluster_node_count|default(1)|int) -%}
{% set container_postfix = loop.index %}
receptor_{{ container_postfix }}:
name: {{ awx_prefix }}_receptor_{{ container_postfix }}
redis_socket_{{ container_postfix }}:
name: {{ awx_prefix }}_redis_socket_{{ container_postfix }}
{% endfor -%}