xoxys.droneci/templates/services/droneci_compose.yml.j2

101 lines
3.8 KiB
Django/Jinja
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#jinja2:lstrip_blocks: True
{{ ansible_managed | comment }}
version: "2.4"
services:
droneci:
container_name: {{ droneci_container_name }}
image: {{ droneci_image }}
restart: {{ droneci_restart_policy }}
{% if droneci_exposed_ports | default([]) %}
ports:
{% for port in droneci_exposed_ports %}
- {{ port | quote }}
{% endfor %}
{% endif %}
{% if droneci_volumes | default([]) %}
volumes:
{% for volume in droneci_volumes %}
- "{{ volume.name }}:{{ volume.dest }}"
{% endfor %}
{% endif %}
{% if droneci_networks_applied | default([]) %}
networks:
{% for network in droneci_networks_applied %}
- {{ network }}
{% endfor %}
{% endif %}
{% if droneci_extra_hosts | default([]) %}
extra_hosts:
{% for host in droneci_extra_hosts %}
- {{ host | quote }}
{% endfor %}
{% endif %}
privileged: {{ droneci_privileged | bool | lower }}
environment:
- DRONE_SERVER_HOST={{ droneci_host | urlsplit('hostname') }}
- DRONE_SERVER_PROTO={{ droneci_host | urlsplit('scheme') }}
- DRONE_AGENTS_ENABLED=true
- DRONE_RPC_SECRET={{ droneci_secret }}
- DRONE_USER_CREATE=username:{{ droneci_admin_user }},admin:true
{% if droneci_user_filter is defined and droneci_user_filter | length > 0 %}
- DRONE_USER_FILTER={{ droneci_user_filter | join(",") }}
{% endif %}
{% if droneci_repository_filter is defined and droneci_repository_filter | length > 0 %}
- DRONE_REPOSITORY_FILTER={{ droneci_repository_filter | join(",") }}
{% endif %}
- DRONE_LOGS_COLOR=true
- DRONE_LOGS_PRETTY=true
- DRONE_TLS_AUTOCERT=false
- DRONE_DATADOG_ENABLED=false
- DRONE_DATADOG_ENDPOINT=dummy
- DRONE_DATADOG_TOKEN=dummy
- DRONE_PROMETHEUS_ANONYMOUS_ACCESS={{ droneci_prometheus_anonymous_access | bool | lower }}
{% if droneci_db_secret is defined %}
- DRONE_DATABASE_SECRET={{ droneci_db_secret }}
{% endif %}
{% if droneci_db_type == "pgsql" %}
- DRONE_DATABASE_DRIVER=postgres
- DRONE_DATABASE_DATASOURCE=postgres://{{ droneci_db_user }}:{{ droneci_db_password }}@{{ droneci_db_server }}/{{ droneci_db_name }}?sslmode={{ droneci_db_ssl_mode }}
{% endif %}
{% if droneci_scm_provider | lower == "gitea" %}
- DRONE_GITEA_SERVER={{ droneci_gitea_server }}
- DRONE_GITEA_SKIP_VERIFY={{ droneci_gitea_skip_verify | lower }}
- DRONE_GITEA_CLIENT_ID={{ droneci_gitea_oauth_client_id }}
- DRONE_GITEA_CLIENT_SECRET={{ droneci_gitea_oauth_client_secret }}
{% elif droneci_scm_provider | lower == "github" %}
- DRONE_GITHUB_CLIENT_ID={{ droneci_github_client_id }}
- DRONE_GITHUB_CLIENT_SECRET={{ droneci_github_client_secret }}
{% 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(',') }}
{% if droneci_memory_limit is defined %}
mem_limit: {{ droneci_memory_limit }}
{% endif %}
{% if droneci_memory_reservation is defined %}
mem_reservation: {{ droneci_memory_reservation }}
{% endif %}
{% if droneci_volumes | default([]) | rejectattr("bind") | list | length > 0 %}
volumes:
{% for volume in droneci_volumes | rejectattr("bind") %}
{{ volume.name }}:
{% endfor %}
{% endif %}
{% if droneci_networks | default([]) | length > 0 %}
networks:
{% for network in droneci_networks %}
{{ network.name }}:
driver: {{ network.backend | default("bridge") }}
{% endfor %}
{% endif %}