From 07d8698dde10d57e58c464f0472b244ec78b8254 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Sat, 26 Nov 2022 18:55:10 -0500 Subject: remove extra /emacsconf/ from mounts --- roles/stream/defaults/main.yml | 2 +- roles/stream/tasks/main.yml | 2 +- roles/stream/templates/emacsconf.nginx.conf | 19 +++++++++++++++++-- roles/stream/templates/icecast.xml | 8 ++++---- roles/stream/templates/on-connect | 1 - roles/stream/templates/on-disconnect | 1 - 6 files changed, 23 insertions(+), 10 deletions(-) (limited to 'roles/stream') diff --git a/roles/stream/defaults/main.yml b/roles/stream/defaults/main.yml index f013dba..aa06ef3 100644 --- a/roles/stream/defaults/main.yml +++ b/roles/stream/defaults/main.yml @@ -4,4 +4,4 @@ icecast_lowres_scale: "854:480" icecast_user: icecast2 icecast_group: icecast icecast_restream_dir: /etc/icecast2/restream -icecast_save_dump: false + diff --git a/roles/stream/tasks/main.yml b/roles/stream/tasks/main.yml index b2bbc69..9c35f69 100644 --- a/roles/stream/tasks/main.yml +++ b/roles/stream/tasks/main.yml @@ -28,13 +28,13 @@ dest: /etc/init.d/emacsconf mode: 0755 - name: Set up nginx config + tags: wip, stream-nginx become: true template: src: emacsconf.nginx.conf dest: /etc/nginx/emacsconf.nginx.conf mode: 0644 - name: Include emacsconf in nginx config - tags: wip become: true lineinfile: line: include /etc/nginx/emacsconf.nginx.conf; diff --git a/roles/stream/templates/emacsconf.nginx.conf b/roles/stream/templates/emacsconf.nginx.conf index f814f31..277c833 100644 --- a/roles/stream/templates/emacsconf.nginx.conf +++ b/roles/stream/templates/emacsconf.nginx.conf @@ -1,5 +1,20 @@ -location /emacsconf/ { - proxy_pass http://localhost:{{ icecast_port }}; +location ~ ^/((gen|dev)(-480p)?.webm)$ { + proxy_pass http://127.0.0.1:{{ icecast_port }}/$1; + proxy_http_version 1.1; + proxy_buffering off; + proxy_request_buffering off; + proxy_set_header Host $http_host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Server $host; + proxy_set_header X-Real-IP $remote_addr; +} + +location ~ ^/emacsconf/(.*)$ { + proxy_pass http://127.0.0.1:{{ icecast_port }}/$1; proxy_http_version 1.1; proxy_buffering off; proxy_request_buffering off; diff --git a/roles/stream/templates/icecast.xml b/roles/stream/templates/icecast.xml index 37e1a0a..d97a515 100644 --- a/roles/stream/templates/icecast.xml +++ b/roles/stream/templates/icecast.xml @@ -189,10 +189,10 @@ --> {% for track in emacsconf_tracks %} - /{{ emacsconf_id }}/{{ track.id }}.webm + /{{ track.id }}.webm {{ icecast_emacsconf_user }} {{ icecast_emacsconf_password }} - {% if icecast_save_dump %}/data/{{ emacsconf_id }}-{{ emacsconf_year }}-{{ track.id }}_%Y-%m-%d_%H-%M-%S.webm{% endif %} + {% if not test_mode %}/data/{{ emacsconf_id }}-{{ emacsconf_year }}-{{ track.id }}_%Y-%m-%d_%H-%M-%S.webm{% endif %} {{ emacsconf_name }} {{ emacsconf_year }} - {{ track.name }} track The livestream for the {{ track.name }} track of {{ emacsconf_name }} {{ emacsconf_year }} {{ track.watch }} @@ -202,7 +202,7 @@ /usr/local/bin/{{ emacsconf_id }}-lowres-{{ track.id }}-on-disconnect - /{{ emacsconf_id }}/{{ track.id }}-host.webm + /{{ track.id }}-host.webm {{ icecast_emacsconf_user }} {{ icecast_emacsconf_password }} EmacsConf {{ emacsconf_year }} - {{ track.name }} track @@ -213,7 +213,7 @@ 1 - /{{ emacsconf_id }}/{{ track.id }}-480p.webm + /{{ track.id }}-480p.webm {{ icecast_emacsconf_user }} {{ icecast_emacsconf_password }} {{ emacsconf_name }} {{ emacsconf_year }} - {{ track.name }} track (480p) diff --git a/roles/stream/templates/on-connect b/roles/stream/templates/on-connect index 0f613bf..cd9deb6 100755 --- a/roles/stream/templates/on-connect +++ b/roles/stream/templates/on-connect @@ -2,7 +2,6 @@ set -e PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" PIDFILE="{{ icecast_restream_dir }}/{{ emacsconf_id }}-lowres-{{ item.id }}.pid" -echo $(date) " on connect {{ item.id }} $*" >> {{ icecast_restream_dir }}/restream.log . /lib/lsb/init-functions diff --git a/roles/stream/templates/on-disconnect b/roles/stream/templates/on-disconnect index 5847356..15ae31b 100755 --- a/roles/stream/templates/on-disconnect +++ b/roles/stream/templates/on-disconnect @@ -2,7 +2,6 @@ set -e PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" PIDFILE="{{ icecast_restream_dir }}/{{ emacsconf_id }}-lowres-{{ item.id }}.pid" -echo $(date) " on disconnect {{ item.id }} $*" >> {{ icecast_restream_dir }}/restream.log . /lib/lsb/init-functions -- cgit v1.2.3