From 66577c3c8262847e46a5269e2d96c47f61f2d7cc Mon Sep 17 00:00:00 2001 From: Mauro Torrez Date: Sun, 28 Apr 2019 00:34:43 -0300 Subject: [PATCH] commit inicial --- defaults/main.yml | 3 ++ files/Caddyfile | 13 +++++++ files/Dockerfile | 24 +++++++++++++ tasks/main.yml | 90 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 130 insertions(+) create mode 100644 defaults/main.yml create mode 100644 files/Caddyfile create mode 100644 files/Dockerfile create mode 100644 tasks/main.yml diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..a286c43 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,3 @@ +--- +kanboard_image_name: i-kanboard +kanboard_container_name: c-kanboard diff --git a/files/Caddyfile b/files/Caddyfile new file mode 100644 index 0000000..a3d6203 --- /dev/null +++ b/files/Caddyfile @@ -0,0 +1,13 @@ +0.0.0.0 +root /srv/app/ +gzip +fastcgi /kanboard 127.0.0.1:9000 php +rewrite { + regexp .* + ext /kanboard + to /index.php?{query} +} + +log stdout +errors stdout +on startup php-fpm --nodaemonize diff --git a/files/Dockerfile b/files/Dockerfile new file mode 100644 index 0000000..729b69d --- /dev/null +++ b/files/Dockerfile @@ -0,0 +1,24 @@ +FROM php:7.1-fpm +LABEL maintainer="Mauro Torrez " + +VOLUME /srv/app/data +VOLUME /srv/app/plugins + +# Install application dependencies +RUN curl --silent --show-error --fail --location \ + --header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \ + "https://caddyserver.com/download/linux/amd64?plugins=http.expires,http.realip&license=personal" \ + | tar --no-same-owner -C /usr/bin/ -xz caddy \ + && chmod 0755 /usr/bin/caddy \ + && /usr/bin/caddy -version \ + && docker-php-ext-install phar curl json zlib xml dom ctype opcache zip iconv \ + pdo pdo_mysql pdo_sqlite pdo_pgsql mbstring session bcmath \ + gd mcrypt openssl sockets posix ldap simplexml + +ADD src /srv/app +ADD docker/Caddyfile /etc/Caddyfile + +WORKDIR /srv/app/ +RUN chown -R www-data:www-data /srv/app + +CMD ["/usr/bin/caddy", "--conf", "/etc/Caddyfile", "--log", "stdout"] diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..fdf69de --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,90 @@ +--- +# - name: install git in host +# apt: name=git state=present + +# - name: checkout kanboard source +# git: +# repo: https://github.com/kanboard/kanboard.git +# dest: /tmp/kanboard-source + +# - name: find latest tag +# command: git describe --abbrev=0 +# args: +# chdir: /tmp/kanboard-source +# register: kb_ver + +# - name: checkout kanboard source tag {{ kb_ver.stdout }} +# git: +# repo: https://github.com/kanboard/kanboard.git +# dest: /tmp/kanboard-source +# version: "{{ kb_ver.stdout }}" + +- name: find latest release + uri: + url: https://api.github.com/repos/kanboard/kanboard/releases/latest + return_content: yes + register: latest + +- name: download latest release + unarchive: + src: "{{ latest.tarball_url }}" + dest: /tmp/build.kanboard/src + register: dl + +- name: copy build files + copy: src={{ item }} dest=/tmp/build.kanboard/ + loop: + - Dockerfile + - Caddyfile + register: cp + +- name: build image + docker_image: + path: /tmp/build.kanboard + name: "{{ kanboard_image_name }}" + tag: "{{ latest.json.tag_name }}" + force: "{{ dl is changed or cp is changed }}" + register: b_img + +- name: start container + docker_container: + image: "{{ kanboard_image_name }}:{{ latest.json.tag_name }}" + name: "{{ kanboard_container_name }}" + ports: + - "10080:80" + - "10443:443" + volumes: + - kanboard_data:/srv/app/data + - kanboard_plugins:/srv/app/plugins + env: + networks: + - name: "{{ docker_network_name }}" + +# - name: copy frontend config +# copy: +# content: | +# location ^~ {{ kanboard_context_root }} { +# {% if kanboard_listen_protocol == 'uwsgi' %} +# uwsgi_pass {{ kanboard_container_name }}:{{ kanboard_listen_port }}; +# include uwsgi_params; +# {% else %} +# proxy_set_header Host $http_host; +# proxy_pass http://{{ kanboard_container_name }}:{{ kanboard_listen_port }}; +# {% endif %} +# } +# dest: "{{ frontend_config_root }}/available/kanboard.conf" + +# - name: enable frontend config +# file: +# src: "../available/kanboard.conf" +# path: "{{ frontend_config_root }}/enabled-{{ item }}/kanboard.conf" +# state: "link" +# loop: +# - https +# register: fe_config + +# - name: restart frontend +# docker_container: +# name: "{{ frontend_container_name }}" +# restart: yes +# when: fe_config is changed