castcaster 0.0.1 → 0.0.2
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 +4 -4
- data/lib/castcaster/channel.rb +4 -1
- data/lib/castcaster/cli.rb +1 -5
- data/lib/castcaster/config.rb +1 -2
- data/lib/castcaster/deploy/compose.rb +2 -2
- data/lib/castcaster/deploy/ffmpeg_services.rb +1 -1
- data/lib/castcaster/deploy/k8s.rb +3 -3
- data/lib/castcaster/deploy/swarm.rb +2 -2
- data/lib/castcaster/deploy.rb +1 -0
- data/lib/castcaster/engines/nginx_rtmp.rb +2 -2
- data/lib/castcaster/version.rb +1 -1
- data/lib/castcaster.rb +6 -0
- data/templates/deploy/k8s/deployment.yaml.erb +5 -1
- data/templates/deploy/k8s/deployment.yaml.tera +5 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aeeeab55c758c6bf640166c74e55d6009d1f989d2cd9c180389eebfcd151cc95
|
|
4
|
+
data.tar.gz: ea2cb64b68c93fa92c52410e2670b7a04209c319c49cf30b017755d5e2c19973
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 926b2539b225dde8414027650ff6a560818b080149592df3ca4ebc1107af806e1159945be0ab619817b8bc09b0b662e517c9a705fd76f406414212b1cfdaaf24
|
|
7
|
+
data.tar.gz: b411a61134433e9ea1d7469cf4bbf39133fdb6293db92ea5c41014a97fc5018efd07dcf24343e1aad87a55fc8fbdb8f88ed10a52e4204cce8e6788a303d2811c
|
data/lib/castcaster/channel.rb
CHANGED
|
@@ -75,12 +75,15 @@ module CastCaster
|
|
|
75
75
|
def from_file(path)
|
|
76
76
|
data = YAML.safe_load(File.read(path))
|
|
77
77
|
unless data
|
|
78
|
-
warn "Warning:
|
|
78
|
+
warn "Warning: empty channel file: #{path}"
|
|
79
79
|
return nil
|
|
80
80
|
end
|
|
81
81
|
ch = new(data['name'], data)
|
|
82
82
|
ch.path = path
|
|
83
83
|
ch
|
|
84
|
+
rescue => e
|
|
85
|
+
warn "Warning: failed to parse channel file #{path}: #{e.message}"
|
|
86
|
+
nil
|
|
84
87
|
end
|
|
85
88
|
end
|
|
86
89
|
|
data/lib/castcaster/cli.rb
CHANGED
|
@@ -61,11 +61,7 @@ module CastCaster
|
|
|
61
61
|
say_status :created, path
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
IMAGES =
|
|
65
|
-
'nginx' => 'ghcr.io/lax/castcaster-nginx',
|
|
66
|
-
'ffmpeg' => 'ghcr.io/lax/castcaster-ffmpeg',
|
|
67
|
-
'webui' => 'ghcr.io/lax/castcaster-webui'
|
|
68
|
-
}.freeze
|
|
64
|
+
IMAGES = CastCaster::IMAGES
|
|
69
65
|
|
|
70
66
|
desc 'doctor', 'Check system environment'
|
|
71
67
|
def doctor
|
data/lib/castcaster/config.rb
CHANGED
|
@@ -40,8 +40,7 @@ module CastCaster
|
|
|
40
40
|
path = File.join(Dir.pwd, 'castcaster.token')
|
|
41
41
|
return File.read(path).strip if File.exist?(path)
|
|
42
42
|
token = SecureRandom.hex(32)
|
|
43
|
-
File.
|
|
44
|
-
File.chmod(0600, path)
|
|
43
|
+
File.open(path, 'w', 0600) { |f| f.write(token) }
|
|
45
44
|
token
|
|
46
45
|
end
|
|
47
46
|
|
|
@@ -33,7 +33,7 @@ module CastCaster
|
|
|
33
33
|
|
|
34
34
|
all = {
|
|
35
35
|
'nginx' => {
|
|
36
|
-
'image' => '
|
|
36
|
+
'image' => CastCaster::IMAGES['nginx'],
|
|
37
37
|
'restart' => 'unless-stopped',
|
|
38
38
|
'ports' => nginx_ports,
|
|
39
39
|
'volumes' => [
|
|
@@ -42,7 +42,7 @@ module CastCaster
|
|
|
42
42
|
]
|
|
43
43
|
},
|
|
44
44
|
'webui' => {
|
|
45
|
-
'image' => '
|
|
45
|
+
'image' => CastCaster::IMAGES['webui'],
|
|
46
46
|
'restart' => 'unless-stopped',
|
|
47
47
|
'volumes' => ["./channels:/channels:rw", "./hls:/var/lib/castcaster/hls:ro"],
|
|
48
48
|
'depends_on' => ['nginx'],
|
|
@@ -12,7 +12,7 @@ module CastCaster
|
|
|
12
12
|
name = ch.name
|
|
13
13
|
label = { 'castcaster/channel' => name }
|
|
14
14
|
common = {
|
|
15
|
-
'image' => '
|
|
15
|
+
'image' => CastCaster::IMAGES['ffmpeg'],
|
|
16
16
|
'restart' => 'unless-stopped',
|
|
17
17
|
'volumes' => ["#{hls_dir}:/var/lib/castcaster/hls"],
|
|
18
18
|
'depends_on' => ['nginx'],
|
|
@@ -34,9 +34,9 @@ module CastCaster
|
|
|
34
34
|
erb = ERB.new(tpl, trim_mode: '-')
|
|
35
35
|
ctx = TemplateContext.new(
|
|
36
36
|
app: 'castcaster',
|
|
37
|
-
engine_image: '
|
|
38
|
-
webui_image: '
|
|
39
|
-
ffmpeg_image: '
|
|
37
|
+
engine_image: CastCaster::IMAGES['nginx'],
|
|
38
|
+
webui_image: CastCaster::IMAGES['webui'],
|
|
39
|
+
ffmpeg_image: CastCaster::IMAGES['ffmpeg'],
|
|
40
40
|
engine_name: @engine.name,
|
|
41
41
|
channels_dir: File.join(@cfg.fetch('project_dir', Dir.pwd), 'channels'),
|
|
42
42
|
hls_dir: @cfg.fetch('hls_dir', '/var/lib/castcaster/hls'),
|
|
@@ -28,13 +28,13 @@ module CastCaster
|
|
|
28
28
|
def render
|
|
29
29
|
all = {
|
|
30
30
|
'nginx' => {
|
|
31
|
-
'image' => '
|
|
31
|
+
'image' => CastCaster::IMAGES['nginx'],
|
|
32
32
|
'restart' => 'unless-stopped',
|
|
33
33
|
'ports' => ['1935:1935', '8080:8080'],
|
|
34
34
|
'volumes' => ["./nginx/nginx.conf:/etc/nginx/nginx.conf:ro", "./hls:/var/lib/castcaster/hls"]
|
|
35
35
|
},
|
|
36
36
|
'webui' => {
|
|
37
|
-
'image' => '
|
|
37
|
+
'image' => CastCaster::IMAGES['webui'],
|
|
38
38
|
'restart' => 'unless-stopped',
|
|
39
39
|
'volumes' => ["./channels:/channels:rw"],
|
|
40
40
|
'environment' => {'HLS_DIR' => '/var/lib/castcaster/hls', 'CHANNELS_DIR' => '/channels'}
|
data/lib/castcaster/deploy.rb
CHANGED
data/lib/castcaster/version.rb
CHANGED
data/lib/castcaster.rb
CHANGED
|
@@ -6,6 +6,12 @@ require 'securerandom'
|
|
|
6
6
|
module CastCaster
|
|
7
7
|
class Error < StandardError; end
|
|
8
8
|
|
|
9
|
+
IMAGES = {
|
|
10
|
+
'nginx' => 'ghcr.io/lax/castcaster-nginx',
|
|
11
|
+
'ffmpeg' => 'ghcr.io/lax/castcaster-ffmpeg',
|
|
12
|
+
'webui' => 'ghcr.io/lax/castcaster-webui'
|
|
13
|
+
}.freeze
|
|
14
|
+
|
|
9
15
|
autoload :CLI, 'castcaster/cli'
|
|
10
16
|
autoload :Channel, 'castcaster/channel'
|
|
11
17
|
autoload :ChannelCLI, 'castcaster/channel_cli'
|
|
@@ -62,12 +62,16 @@ spec:
|
|
|
62
62
|
- name: webui
|
|
63
63
|
image: <%= webui_image %>
|
|
64
64
|
ports:
|
|
65
|
-
- containerPort:
|
|
65
|
+
- containerPort: 8081
|
|
66
66
|
env:
|
|
67
67
|
- name: STREAM_ENGINE
|
|
68
68
|
value: "<%= engine_name %>"
|
|
69
69
|
- name: STREAM_ENGINE_URL
|
|
70
70
|
value: "http://<%= app %>-stream:80"
|
|
71
|
+
- name: HLS_DIR
|
|
72
|
+
value: "<%= hls_dir || '/var/lib/castcaster/hls' %>"
|
|
73
|
+
- name: CHANNELS_DIR
|
|
74
|
+
value: "/channels"
|
|
71
75
|
volumeMounts:
|
|
72
76
|
- name: channels
|
|
73
77
|
mountPath: /channels
|
|
@@ -62,12 +62,16 @@ spec:
|
|
|
62
62
|
- name: webui
|
|
63
63
|
image: {{ webui_image }}
|
|
64
64
|
ports:
|
|
65
|
-
- containerPort:
|
|
65
|
+
- containerPort: 8081
|
|
66
66
|
env:
|
|
67
67
|
- name: STREAM_ENGINE
|
|
68
68
|
value: "{{ engine_name }}"
|
|
69
69
|
- name: STREAM_ENGINE_URL
|
|
70
70
|
value: "http://{{ app }}-stream:80"
|
|
71
|
+
- name: HLS_DIR
|
|
72
|
+
value: "{{ hls_dir | default(value="/var/lib/castcaster/hls") }}"
|
|
73
|
+
- name: CHANNELS_DIR
|
|
74
|
+
value: "/channels"
|
|
71
75
|
volumeMounts:
|
|
72
76
|
- name: channels
|
|
73
77
|
mountPath: /channels
|