castcaster 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/castcaster +7 -0
- data/lib/castcaster/channel.rb +91 -0
- data/lib/castcaster/channel_cli.rb +105 -0
- data/lib/castcaster/cli.rb +104 -0
- data/lib/castcaster/config.rb +60 -0
- data/lib/castcaster/deploy/compose.rb +76 -0
- data/lib/castcaster/deploy/ffmpeg_services.rb +73 -0
- data/lib/castcaster/deploy/k8s.rb +91 -0
- data/lib/castcaster/deploy/swarm.rb +57 -0
- data/lib/castcaster/deploy/traefik.rb +80 -0
- data/lib/castcaster/deploy.rb +10 -0
- data/lib/castcaster/engines/base.rb +55 -0
- data/lib/castcaster/engines/nginx_rtmp.rb +23 -0
- data/lib/castcaster/engines.rb +17 -0
- data/lib/castcaster/ffmpeg_profiles.rb +16 -0
- data/lib/castcaster/version.rb +3 -0
- data/lib/castcaster.rb +17 -0
- data/templates/deploy/docker-compose.yml.erb +18 -0
- data/templates/deploy/docker-compose.yml.tera +16 -0
- data/templates/deploy/docker-stack.yml.erb +29 -0
- data/templates/deploy/docker-stack.yml.tera +26 -0
- data/templates/deploy/k8s/configmap.yaml.erb +6 -0
- data/templates/deploy/k8s/configmap.yaml.tera +6 -0
- data/templates/deploy/k8s/deployment.yaml.erb +77 -0
- data/templates/deploy/k8s/deployment.yaml.tera +77 -0
- data/templates/deploy/k8s/ingress.yaml.erb +35 -0
- data/templates/deploy/k8s/ingress.yaml.tera +35 -0
- data/templates/deploy/k8s/pvc.yaml.erb +14 -0
- data/templates/deploy/k8s/pvc.yaml.tera +14 -0
- data/templates/deploy/k8s/service.yaml.erb +37 -0
- data/templates/deploy/k8s/service.yaml.tera +37 -0
- data/templates/nginx-rtmp/nginx.conf.erb +110 -0
- metadata +91 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Generated by castcaster
|
|
2
|
+
|
|
3
|
+
user nginx;
|
|
4
|
+
worker_processes auto;
|
|
5
|
+
worker_rlimit_nofile 16384;
|
|
6
|
+
pcre_jit on;
|
|
7
|
+
error_log /var/log/nginx/error.log warn;
|
|
8
|
+
include /etc/nginx/modules/*.conf;
|
|
9
|
+
|
|
10
|
+
events {
|
|
11
|
+
worker_connections 10240;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
rtmp {
|
|
15
|
+
server {
|
|
16
|
+
listen 1935;
|
|
17
|
+
chunk_size 4096;
|
|
18
|
+
|
|
19
|
+
access_log /var/log/nginx/rtmp-access.log;
|
|
20
|
+
|
|
21
|
+
application live {
|
|
22
|
+
live on;
|
|
23
|
+
drop_idle_publisher 35s;
|
|
24
|
+
wait_key on;
|
|
25
|
+
publish_notify on;
|
|
26
|
+
sync 40ms;
|
|
27
|
+
wait_video on;
|
|
28
|
+
record off;
|
|
29
|
+
|
|
30
|
+
hls on;
|
|
31
|
+
hls_path <%= hls_dir %>/live;
|
|
32
|
+
hls_fragment 6s;
|
|
33
|
+
hls_playlist_length 60s;
|
|
34
|
+
|
|
35
|
+
allow publish all;
|
|
36
|
+
allow play all;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
<% channels.each do |ch| %>
|
|
40
|
+
application <%= ch['name'] %> {
|
|
41
|
+
live on;
|
|
42
|
+
drop_idle_publisher 25s;
|
|
43
|
+
hls on;
|
|
44
|
+
hls_path <%= hls_dir %>/<%= ch['name'] %>;
|
|
45
|
+
hls_fragment <%= ch.dig('hls', 'fragment') || 6 %>;
|
|
46
|
+
hls_playlist_length <%= ch.dig('hls', 'playlist_length') || 60 %>;
|
|
47
|
+
allow publish all;
|
|
48
|
+
allow play all;
|
|
49
|
+
}
|
|
50
|
+
<% end %>
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
http {
|
|
55
|
+
include /etc/nginx/mime.types;
|
|
56
|
+
default_type application/octet-stream;
|
|
57
|
+
sendfile on;
|
|
58
|
+
tcp_nopush on;
|
|
59
|
+
keepalive_timeout 65;
|
|
60
|
+
|
|
61
|
+
access_log /var/log/nginx/access.log;
|
|
62
|
+
error_log /var/log/nginx/error.log warn;
|
|
63
|
+
|
|
64
|
+
add_header 'Access-Control-Allow-Origin' '*' always;
|
|
65
|
+
add_header 'Access-Control-Expose-Headers' 'Content-Length' always;
|
|
66
|
+
|
|
67
|
+
<% domain = config['domain'] || '' -%>
|
|
68
|
+
<% if !domain.empty? -%>
|
|
69
|
+
map $http_referer $allow_hls {
|
|
70
|
+
default 0;
|
|
71
|
+
"" 1;
|
|
72
|
+
"~^https?://localhost([/:].*)?$" 1;
|
|
73
|
+
"~^https?://127\.0\.0\.1([/:].*)?$" 1;
|
|
74
|
+
"~^https?://<%= domain.gsub('/', '\/').gsub('.', '\.') %>([/:].*)?$" 1;
|
|
75
|
+
"~^https?://[a-z0-9-]+\.<%= domain.gsub('.', '\.') %>([/:].*)?$" 1;
|
|
76
|
+
}
|
|
77
|
+
<% end -%>
|
|
78
|
+
|
|
79
|
+
server {
|
|
80
|
+
listen 8080;
|
|
81
|
+
|
|
82
|
+
# HLS static files — nginx serves directly
|
|
83
|
+
location /hls/ {
|
|
84
|
+
alias <%= hls_dir %>/;
|
|
85
|
+
|
|
86
|
+
location ~* \.m3u8$ {
|
|
87
|
+
<% if !domain.empty? -%>
|
|
88
|
+
if ($allow_hls = 0) { return 403; }
|
|
89
|
+
<% end -%>
|
|
90
|
+
add_header 'Cache-Control' 'no-cache';
|
|
91
|
+
}
|
|
92
|
+
location ~* \.ts$ {
|
|
93
|
+
<% if !domain.empty? -%>
|
|
94
|
+
if ($allow_hls = 0) { return 403; }
|
|
95
|
+
<% end -%>
|
|
96
|
+
add_header 'Cache-Control' 'public, max-age=120';
|
|
97
|
+
expires 2m;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
# WebUI (API + pages) — proxy to Ruby
|
|
102
|
+
location / {
|
|
103
|
+
proxy_pass http://webui:8081;
|
|
104
|
+
proxy_http_version 1.1;
|
|
105
|
+
proxy_set_header Host $host;
|
|
106
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
107
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
metadata
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: castcaster
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Lax
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: thor
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '1.3'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '1.3'
|
|
26
|
+
description: Manage RTMP/HLS streaming with Nginx-RTMP engine, per-channel FFmpeg
|
|
27
|
+
tasks, and Docker-based deployment
|
|
28
|
+
email:
|
|
29
|
+
- liulantao@gmail.com
|
|
30
|
+
executables:
|
|
31
|
+
- castcaster
|
|
32
|
+
extensions: []
|
|
33
|
+
extra_rdoc_files: []
|
|
34
|
+
files:
|
|
35
|
+
- bin/castcaster
|
|
36
|
+
- lib/castcaster.rb
|
|
37
|
+
- lib/castcaster/channel.rb
|
|
38
|
+
- lib/castcaster/channel_cli.rb
|
|
39
|
+
- lib/castcaster/cli.rb
|
|
40
|
+
- lib/castcaster/config.rb
|
|
41
|
+
- lib/castcaster/deploy.rb
|
|
42
|
+
- lib/castcaster/deploy/compose.rb
|
|
43
|
+
- lib/castcaster/deploy/ffmpeg_services.rb
|
|
44
|
+
- lib/castcaster/deploy/k8s.rb
|
|
45
|
+
- lib/castcaster/deploy/swarm.rb
|
|
46
|
+
- lib/castcaster/deploy/traefik.rb
|
|
47
|
+
- lib/castcaster/engines.rb
|
|
48
|
+
- lib/castcaster/engines/base.rb
|
|
49
|
+
- lib/castcaster/engines/nginx_rtmp.rb
|
|
50
|
+
- lib/castcaster/ffmpeg_profiles.rb
|
|
51
|
+
- lib/castcaster/version.rb
|
|
52
|
+
- templates/deploy/docker-compose.yml.erb
|
|
53
|
+
- templates/deploy/docker-compose.yml.tera
|
|
54
|
+
- templates/deploy/docker-stack.yml.erb
|
|
55
|
+
- templates/deploy/docker-stack.yml.tera
|
|
56
|
+
- templates/deploy/k8s/configmap.yaml.erb
|
|
57
|
+
- templates/deploy/k8s/configmap.yaml.tera
|
|
58
|
+
- templates/deploy/k8s/deployment.yaml.erb
|
|
59
|
+
- templates/deploy/k8s/deployment.yaml.tera
|
|
60
|
+
- templates/deploy/k8s/ingress.yaml.erb
|
|
61
|
+
- templates/deploy/k8s/ingress.yaml.tera
|
|
62
|
+
- templates/deploy/k8s/pvc.yaml.erb
|
|
63
|
+
- templates/deploy/k8s/pvc.yaml.tera
|
|
64
|
+
- templates/deploy/k8s/service.yaml.erb
|
|
65
|
+
- templates/deploy/k8s/service.yaml.tera
|
|
66
|
+
- templates/nginx-rtmp/nginx.conf.erb
|
|
67
|
+
homepage: https://liulantao.com/castcaster
|
|
68
|
+
licenses:
|
|
69
|
+
- MIT
|
|
70
|
+
metadata:
|
|
71
|
+
source_code_uri: https://github.com/Lax/castcaster
|
|
72
|
+
changelog_uri: https://github.com/Lax/castcaster/releases
|
|
73
|
+
bug_tracker_uri: https://github.com/Lax/castcaster/issues
|
|
74
|
+
rdoc_options: []
|
|
75
|
+
require_paths:
|
|
76
|
+
- lib
|
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '3.0'
|
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
|
+
requirements:
|
|
84
|
+
- - ">="
|
|
85
|
+
- !ruby/object:Gem::Version
|
|
86
|
+
version: '0'
|
|
87
|
+
requirements: []
|
|
88
|
+
rubygems_version: 3.6.9
|
|
89
|
+
specification_version: 4
|
|
90
|
+
summary: Unified live streaming management platform
|
|
91
|
+
test_files: []
|