Deploy a dokku

This commit is contained in:
Jake Howard
2023-10-01 16:25:20 +01:00
parent b02be4e77a
commit a54a91ea44
14 changed files with 149 additions and 0 deletions

View File

@ -0,0 +1,29 @@
worker_processes auto;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
# Block requests which don't have an explicit handler
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
access_log off;
return 418;
}
# Load configuration files for the default server block.
include /etc/nginx/conf.d/*.conf;
}

View File

@ -0,0 +1,5 @@
- name: restart nginx
service:
name: nginx
state: restarted
become: true

View File

@ -0,0 +1,53 @@
# HACK: Fake include some tasks from `ansible_dokku`, so its library plugins can be used below
- name: Run role without running any tasks
include_role:
name: dokku_bot.ansible_dokku
tasks_from: init.yml
apply:
when: false
- name: Install Dokku
package:
name: dokku
become: true
- name: List dokku plugins
command: dokku plugin:list
changed_when: false
register: installed_dokku_plugins
- name: Install Dokku plugins
command: dokku plugin:install {{ item.url }} --name {{ item.name }}
when: installed_dokku_plugins.stdout.find(item.name) == -1
loop: "{{ dokku_plugins }}"
loop_control:
label: "{{ item.name }}"
become: true
- name: Automatically update Dokku plugins
cron:
name: "dokku plugin:update {{ item.name }}"
minute: "0"
hour: "12"
user: "root"
job: "/usr/bin/chronic /usr/bin/dokku plugin:update {{ item.name }}"
cron_file: "dokku-plugin-update-{{ item.name }}"
loop: "{{ dokku_plugins }}"
loop_control:
label: "{{ item.name }}"
become: true
- name: Set up global domain
dokku_domains:
global: true
domains: d.theorangeone.net
become: true
- name: Install custom nginx config
template:
src: files/nginx.conf
dest: /etc/nginx/nginx.conf
validate: nginx -t -c %s
mode: "644"
notify: restart nginx
become: true

View File

@ -0,0 +1,9 @@
dokku_plugins:
- name: postgres
url: https://github.com/dokku/dokku-postgres.git
- name: redis
url: https://github.com/dokku/dokku-redis.git
- name: redirect
url: https://github.com/dokku/dokku-redirect.git
- name: http-auth
url: https://github.com/dokku/dokku-http-auth.git