Commit 71edd4ea authored by Daniel Dehennin's avatar Daniel Dehennin

Merge branch 'feature/optional-docker-vendor-repo' into 'master'

feat(docker): permit to use the vendor repository

See merge request la-crise/discourse-formula!5
parents c6ae12ec e97f1f24
......@@ -2,5 +2,6 @@
# vim: ft=sls
include:
- .repo
- .package
- .service
# -*- coding: utf-8 -*-
# vim: ft=sls
discourse-docker-package-install-pkg-installed:
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot | path_join("map.jinja") import discourse with context %}
{% if discourse | traverse('docker:repo:use_vendor_repo', False) | to_bool %}
{%- set sls_docker_repo_install = tplroot ~ '.docker.repo.install' %}
{%- set sls_depends = [{'sls': sls_docker_repo_install}] %}
{%- set packages = discourse | traverse('docker:packages:vendor', []) %}
include:
- {{ sls_docker_repo_install }}
{%- else %}
{%- set sls_depends = [] %}
{%- set packages = discourse | traverse('docker:packages:distrib', []) %}
{%- endif %}
{%- for package in packages %}
discourse-docker-package-install-{{ package }}-pkg-installed:
pkg.installed:
- name: docker.io
- name: {{ package }}
- require: {{ sls_depends }}
{%- endfor %}
{%- set compose = discourse | traverse('docker:compose') %}
discourse-docker-package-install-docker-compose-file-managed:
file.managed:
- name: {{ compose.name }}
- source: {{ compose.source }}
- source_hash: {{ compose.source_hash }}
- owner: {{ compose.owner }}
- group: {{ compose.group }}
- mode: {{ compose.mode }}
# -*- coding: utf-8 -*-
# vim: ft=sls
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot | path_join("map.jinja") import discourse with context %}
include:
- .install
# -*- coding: utf-8 -*-
# vim: ft=sls
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot | path_join("map.jinja") import discourse with context %}
{% if discourse | traverse('docker:repo:use_vendor_repo', False) | to_bool %}
{%- set docker = discourse | traverse('docker', {}) %}
{%- set dependencies = discourse | traverse('docker:repo:dependencies', []) %}
{%- set url = 'https://download.docker.com/linux/' ~ grains["os"]|lower ~ ' ' ~ grains["oscodename"]|lower ~ ' stable' %}
{%- set key_url = 'https://download.docker.com/linux/' ~ grains["os"]|lower ~ '/gpg' %}
{%- for dependency in dependencies %}
discourse-docker-repo-install-dependency-{{ dependency }}-pkg-installed:
pkg.installed:
- name: {{ dependency }}
{%- endfor %}
discourse-docker-repo-repo-managed:
pkgrepo.managed:
- humanname: {{ grains["os"] }} {{ grains["oscodename"]|capitalize }} Docker Package Repository
- name: deb [arch={{ grains["osarch"] }}] {{ url }}
- file: /etc/apt/sources.list.d/docker.list
- key_url: {{ key_url }}
- refresh: True
{%- endif %}
......@@ -55,4 +55,27 @@ values:
cleanup_cmd: './launcher cleanup app'
destroy_cmd: './launcher destroy app'
run_cmd: 'docker exec app /bin/bash -c'
docker:
compose:
name: '/usr/local/bin/docker-compose'
source: 'https://github.com/docker/compose/releases/download/1.25.4/run.sh'
source_hash: '94fcfe951f24f6a0d803b5159c21377c719b6fc0d483f81418a79d87f622610f'
owner: 'root'
group: 'root'
mode: '755'
repo:
use_vendor_repo: False
dependencies:
- 'apt-transport-https'
- 'ca-certificates'
- 'curl'
- 'gnupg'
- 'gnupg-agent'
packages:
vendor:
- 'docker-ce'
- 'docker-ce-cli'
- 'containerd.io'
distrib:
- 'docker.io'
...
......@@ -50,6 +50,10 @@ discourse:
email: 'william.shakespears@example.net'
enabled: true
admin: true
docker:
repo:
# do not use the distribution package
use_vendor_repo: True
tofs:
# The files_switch key serves as a selector for alternative
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment