-
Notifications
You must be signed in to change notification settings - Fork 29
Ansible Deployment
Isaac edited this page Sep 14, 2020
·
1 revision
Two files are required, an Ansible playbook and a Caddyfile.
Caddy will not issue SSL certificates unless the two "A" records are created before the container is ran.
The Caddyfile should look like this, replace the example domain with yours.
radium.example.com {
reverse_proxy radium:3000
}
content.example.com {
reverse_proxy rtmp:7080
}
The Ansible playbook looks like this, be sure to update the BASE_URL environment variable when using this playbook.
---
- hosts: all
become: true
tasks:
- name: Create caddy folder
file:
path: /etc/caddy
state: directory
mode: '0755'
- name: Upload local Caddyfile to remote
copy:
src: ./Caddyfile
dest: /etc/caddy/Caddyfile
mode: '0644'
- name: Create Radium Container
docker_container:
name: radium
image: zibbp/radium:latest
state: started
env:
BASE_URL: "https://radium.example.com"
ADMIN_TOKEN: "12345"
- name: Create RTMP Container
docker_container:
name: rtmp
image: zibbp/nginx-rtmp-hls:latest
state: started
ports:
- "1935:1935"
volumes:
- /root/static:/www/static
- name: Create Caddy Container
docker_container:
name: caddy
image: caddy:latest
state: started
ports:
- "80:80"
- "443:443"
links:
- "radium:radium"
- "rtmp:rtmp"
volumes:
- /etc/caddy/Caddyfile:/etc/caddy/Caddyfile
Execute the playbook and after a few seconds all three containers should be deployed on your remote server.
ansible-playbook radium.yml