xoxys.droneci/templates/services/droneci-compose.yml.j2

92 lines
3.5 KiB
Plaintext
Raw Normal View History

2018-12-13 22:09:22 +00:00
#jinja2:lstrip_blocks: True
# {{ ansible_managed }}
version: '2'
services:
droneserver:
2019-05-18 23:44:23 +00:00
container_name: {{ droneci_server_container_name }}
2018-12-13 22:09:22 +00:00
image: {{ droneci_server_image }}
ports:
2019-01-11 20:27:47 +00:00
- {{ droneci_server_exposed_ip + ':' if droneci_server_exposed_ip is defined else '' }}{{ droneci_server_exposed_port }}:80
2018-12-13 22:09:22 +00:00
volumes:
2019-01-11 21:48:24 +00:00
{% if not droneci_postgres_enabled %}
2018-12-13 22:09:22 +00:00
- droneserver-data:/var/lib/drone/
2019-01-11 21:48:24 +00:00
{% endif %}
2019-01-11 21:32:22 +00:00
{% if droneci_license_key is defined %}
- {{ droneci_license_key }}:/etc/drone.key
{% endif %}
2018-12-14 00:23:33 +00:00
{% if droneci_server_extra_hosts | default([]) %}
2018-12-14 00:27:46 +00:00
extra_hosts:
2018-12-14 00:29:31 +00:00
{% for host in droneci_server_extra_hosts %}
2018-12-14 00:32:39 +00:00
- {{ '"' + host + '"' }}
2018-12-14 00:27:46 +00:00
{% endfor %}
2018-12-14 00:23:33 +00:00
{% endif %}
{% if droneci_server_privileged %}
privileged: true
{% endif %}
2018-12-13 22:09:22 +00:00
environment:
2019-01-11 20:27:47 +00:00
- DRONE_SERVER_HOST={{ droneci_host | urlsplit('hostname') }}
- DRONE_SERVER_PROTO={{ droneci_host | urlsplit('scheme') }}
- DRONE_AGENTS_ENABLED=true
2019-01-11 20:27:47 +00:00
- DRONE_RPC_SECRET={{ droneci_secret }}
2019-05-11 12:41:00 +00:00
- DRONE_USER_CREATE=username:{{ droneci_admin }},admin:true
2019-01-11 20:27:47 +00:00
- DRONE_LOGS_COLOR=true
- DRONE_LOGS_PRETTY=true
- DRONE_TLS_AUTOCERT=false
2018-12-13 23:22:15 +00:00
{% if droneci_postgres_enabled %}
2018-12-13 22:09:22 +00:00
- DRONE_DATABASE_DRIVER=postgres
2018-12-13 23:52:18 +00:00
- DRONE_DATABASE_DATASOURCE=postgres://{{ droneci_postgres_user.name }}:{{ droneci_postgres_user.password }}@{{ droneci_postgres_server }}/{{ droneci_postgres_db.name }}?sslmode={{ droneci_postgres_ssl_mode }}
2018-12-13 22:09:22 +00:00
{% endif %}
{% if droneci_gitea_enabled %}
2019-01-11 20:27:47 +00:00
- DRONE_GITEA_SERVER={{ droneci_gitea_server }}
2019-05-18 23:44:23 +00:00
- DRONE_GITEA_SKIP_VERIFY={{ droneci_gitea_skip_verify | lower }}
{% if droneci_gitea_oauth_client_id is defined and droneci_gitea_oauth_client_secret is defined %}
2019-05-19 00:04:31 +00:00
- DRONE_GITEA_CLIENT_ID={{ droneci_gitea_oauth_client_id }}
- DRONE_GITEA_CLIENT_SECRET={{ droneci_gitea_oauth_client_secret }}
2019-05-18 23:44:23 +00:00
{% endif %}
2018-12-13 22:09:22 +00:00
{% endif %}
{% if droneci_http_proxy is defined %}
- HTTP_PROXY={{ droneci_http_proxy | join(',') }}
- http_proxy={{ droneci_http_proxy | join(',') }}
{% endif %}
{% if droneci_https_proxy is defined %}
- HTTPS_PROXY={{ droneci_https_proxy | join(',') }}
- https_proxy={{ droneci_https_proxy | join(',') }}
{% endif %}
- NO_PROXY={{ droneci_no_proxy | join(',') }}
- no_proxy={{ droneci_no_proxy | join(',') }}
2018-12-16 16:33:11 +00:00
{% if droneci_server_memory_limit is defined %}
2018-12-16 16:49:41 +00:00
mem_limit: {{ droneci_server_memory_limit }}
2018-12-16 16:22:49 +00:00
{% endif %}
{% if droneci_server_memory_reservation is defined %}
mem_reservation: {{ droneci_server_memory_reservation }}
{% endif %}
2018-12-13 22:09:22 +00:00
droneagent:
2019-05-18 23:44:23 +00:00
container_name: {{ droneci_agent_container_name }}
2018-12-13 22:09:22 +00:00
image: {{ droneci_agent_image }}
depends_on:
- droneserver
volumes:
- {{ droneci_docker_socket_path }}:/var/run/docker.sock
{% if droneci_agent_privileged %}
privileged: true
{% endif %}
2018-12-13 22:09:22 +00:00
environment:
2019-01-11 20:27:47 +00:00
- DRONE_RPC_SERVER=http://droneserver
- DRONE_RPC_SECRET={{ droneci_secret }}
2019-05-18 23:44:23 +00:00
- DRONE_RUNNER_CAPACITY={{ droneci_agent_capacity }}
2018-12-13 22:09:22 +00:00
# TODO: temp static value, needs to be replaced by a custom fact
- DOCKER_API_VERSION=1.26
2018-12-16 16:33:11 +00:00
{% if droneci_agent_memory_limit is defined %}
2018-12-16 16:22:49 +00:00
mem_limit: {{ droneci_agent_memory_limit }}
{% endif %}
{% if droneci_agent_memory_reservation is defined %}
mem_reservation: {{ droneci_agent_memory_reservation }}
{% endif %}
2018-12-13 22:09:22 +00:00
2018-12-13 23:22:15 +00:00
{% if not droneci_postgres_enabled %}
2018-12-13 22:09:22 +00:00
volumes:
droneserver-data:
{% endif %}