~cadence/oven-setup

984d475ea38a761b097dfcb1a051a9d022dd4ea9 — Cadence Ember 11 months ago eb097ec
add OvenMediaEngine service and config volumes
A OvenMediaEngine/ovenmediaengine.service => OvenMediaEngine/ovenmediaengine.service +50 -0
@@ 0,0 1,50 @@
# This is a systemd user service to run OvenMediaEngine as your user on boot.
# Be sure to place the config directories in the correct place on the host
# so they can be used with the -v bind mount arguments.
# Then, place this file in ~/.config/systemd/user/ and use systemctl to control it.
# You'll need to run loginctl enable-linger as root once to allow this to start on boot.

# container-ovenmediaengine.service
# autogenerated by Podman 4.5.1
# Wed Jun 21 10:20:05 UTC 2023

[Unit]
Description=Podman container-ovenmediaengine.service
Documentation=man:podman-generate-systemd(1)
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
TimeoutStopSec=70
ExecStart=/usr/bin/podman run \
	--cidfile=%t/%n.ctr-id \
	--cgroups=no-conmon \
	--rm \
	--sdnotify=conmon \
	--replace \
	-d \
	-p 1935:1935 \
	-p 3333:3333 \
	-p 3334:3334 \
	-p 3478:3478 \
	-p 9000:9000 \
	-p 9999:9999/udp \
	-p 4000:4000/udp \
	-v ~/oven-setup/OvenMediaEngine/volumes/origin_conf:/opt/ovenmediaengine/bin/origin_conf:Z \
	-v ~/oven-setup/OvenMediaEngine/volumes/edge_conf:/opt/ovenmediaengine/bin/edge_conf:Z \
	--name ovenmediaengine localhost/airensoft/ovenmediaengine:0.14.8
ExecStop=/usr/bin/podman stop \
	--ignore -t 10 \
	--cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm \
	-f \
	--ignore -t 10 \
	--cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all

[Install]
WantedBy=default.target

A OvenMediaEngine/volumes/edge_conf/Logger.xml => OvenMediaEngine/volumes/edge_conf/Logger.xml +14 -0
@@ 0,0 1,14 @@
<?xml version="1.0" encoding="UTF-8"?>

<Logger version="2">
	<!-- Log file location -->
	<Path>/var/log/ovenmediaengine</Path>

	<!-- Disable some SRT internal logs -->
	<Tag name="SRT" level="critical" />
	<Tag name="HttpServer" level="warn" />
	<Tag name=".*\.Stat" level="warn" />

	<!-- Log level: [debug, info, warn, error, critical] -->
	<Tag name=".*" level="info" />
</Logger>

A OvenMediaEngine/volumes/edge_conf/Server.xml => OvenMediaEngine/volumes/edge_conf/Server.xml +226 -0
@@ 0,0 1,226 @@
<?xml version="1.0" encoding="UTF-8"?>

<Server version="8">
	<Name>OvenMediaEngine</Name>
	<!-- Host type (origin/edge) -->
	<Type>edge</Type>
	<!-- Specify IP address to bind (* means all IPs) -->
	<IP>*</IP>
	<PrivacyProtection>false</PrivacyProtection>

	<!-- 
	To get the public IP address(mapped address of stun) of the local server. 
	This is useful when OME cannot obtain a public IP from an interface, such as AWS or docker environment. 
	If this is successful, you can use ${PublicIP} in your settings.
	-->
	<StunServer>stun.l.google.com:19302</StunServer>

	<Modules>
		<!-- 
		Currently OME only supports h2 like all browsers do. Therefore, HTTP/2 only works on TLS ports.			
		-->
		<HTTP2>
			<Enable>true</Enable>
		</HTTP2>

		<LLHLS>
			<Enable>true</Enable>
		</LLHLS>

		<!-- P2P works only in WebRTC and is experiment feature -->
		<P2P>
			<!-- disabled by default -->
			<Enable>false</Enable>
			<MaxClientPeersPerHostPeer>2</MaxClientPeersPerHostPeer>
		</P2P>
	</Modules>

	<!-- Settings for the ports to bind -->
	<Bind>
		<!-- Enable this configuration if you want to use API Server -->
		<!--
		<Managers>
			<API>
				<Port>${env:OME_API_PORT:8081}</Port>
				<WorkerCount>1</WorkerCount>
			</API>
		</Managers>
		-->
		<Providers>
			<!-- Pull providers -->
			<OVT>
				<WorkerCount>1</WorkerCount>
			</OVT>
		</Providers>

		<Publishers>
			<LLHLS>
				<!-- 
				OME only supports h2, so LLHLS works over HTTP/1.1 on non-TLS port. 
				Note that LLHLS runs higher performance over HTTP/2.
				Therefore, it is recommended to use TLS Port.
				-->
				<Port>${env:OME_LLHLS_STREAM_PORT:3333}</Port>
				<TLSPort>${env:OME_LLHLS_STREAM_TLS_PORT:3334}</TLSPort>
				<WorkerCount>1</WorkerCount>
			</LLHLS>
			<WebRTC>
				<Signalling>
					<Port>${env:OME_SIGNALLING_PORT:3333}</Port>
					<TLSPort>${env:OME_SIGNALLING_TLS_PORT:3334}</TLSPort>
					<WorkerCount>1</WorkerCount>
				</Signalling>
				<IceCandidates>
					<IceCandidate>*:10000-10005/udp</IceCandidate>
					<TcpRelay>${env:OME_TCP_RELAY_ADDRESS:*:3478}</TcpRelay>
					<TcpForce>true</TcpForce>
					<TcpRelayWorkerCount>1</TcpRelayWorkerCount>
				</IceCandidates>
			</WebRTC>
		</Publishers>
	</Bind>

	<!-- P2P works only in WebRTC -->
	<!--
	<P2P>
		<MaxClientPeersPerHostPeer>2</MaxClientPeersPerHostPeer>
	</P2P>
	-->

	<VirtualHosts>
		<!-- You can use wildcard like this to include multiple XMLs -->
		<VirtualHost include="VHost*.xml" />
		<VirtualHost>
			<Name>default</Name>
			<!--Distribution is a value that can be used when grouping the same vhost distributed across multiple servers. This value is output to the events log, so you can use it to aggregate statistics. -->
			<Distribution>ovenmediaengine.com</Distribution>

			<!-- Settings for multi ip/domain and TLS -->
			<Host>
				<Names>
					<!-- Host names
						<Name>stream1.airensoft.com</Name>
						<Name>stream2.airensoft.com</Name>
						<Name>*.sub.airensoft.com</Name>
						<Name>192.168.0.1</Name>
					-->
					<Name>*</Name>
				</Names>
				<!--
				<TLS>
					<CertPath>path/to/file.crt</CertPath>
					<KeyPath>path/to/file.key</KeyPath>
					<ChainCertPath>path/to/file.crt</ChainCertPath>
				</TLS>
				-->
			</Host>

			<!-- Refer https://airensoft.gitbook.io/ovenmediaengine/signedpolicy

			<SignedPolicy>
				<PolicyQueryKeyName>${env:SIGNED_POLICY_POLICY_QUERY_KEY:policy}</PolicyQueryKeyName>
				<SignatureQueryKeyName>${env:SIGNED_POLICY_SIGNATURE_QUERY_KEY:signature}</SignatureQueryKeyName>
				<SecretKey>${env:SIGNED_URL_CRYPTO_KEY:aKq#1kj}</SecretKey>

				<Enables>
					<Providers>rtmp,webrtc,srt</Providers>
					<Publishers>webrtc,hls,llhls,dash,lldash</Publishers>
				</Enables>
			</SignedPolicy>
			-->

			<!-- Settings for ProxyPass (It can specify origin for each path) -->
			<Origins>
				<Properties>
					<NoInputFailoverTimeout>3000</NoInputFailoverTimeout>
					<UnusedStreamDeletionTimeout>60000</UnusedStreamDeletionTimeout>
				</Properties>
				<!--
					<Origin>
					<Location>/app/stream</Location>
					<Pass>
						<Scheme>ovt</Scheme>
						<Urls>
							<Url>origin.com:9000/app/stream_720p</Url>
						</Urls>
					</Pass>
				</Origin>
				<Origin>
					<Location>/app/</Location>
					<Pass>
						<Scheme>ovt</Scheme>
						<Urls>
							<Url>origin.com:9000/app/</Url>
						</Urls>
					</Pass>
				</Origin>
				-->
				<Origin>
					<Location>/</Location>
					<Pass>
						<Scheme>ovt</Scheme>
						<Urls>
							<Url>${env:DEFAULT_ORIGIN_SERVER:}:${env:DEFAULT_ORIGIN_PORT:9000}/</Url>
						</Urls>
						<!-- 
							Whether to pass the query string to the origin server in the URL the user requested to play (used by some RTSP servers) 
							default : true
						-->
						<ForwardQueryParams>true</ForwardQueryParams>
					</Pass>
				</Origin>
			</Origins>

			<!--
				Apply the following settings for /app/<stream_name> requests.

				This demonstrates setting <OutputProfiles>/<Providers>/<Pubishers> for a specific application.

				(https://github.com/AirenSoft/OvenMediaEngine/issues/621#issuecomment-1026892776)
			-->
			<!--
			<Applications>
				<Application>
					<Name>app</Name>
					<Type>live</Type>
					<OutputProfiles>
						<OutputProfile>
							<Name>passthrough</Name>
							<OutputStreamName>${OriginStreamName}</OutputStreamName>
							<Encodes>
								<Video>
									<Bypass>true</Bypass>
								</Video>
								<Audio>
									<Bypass>true</Bypass>
								</Audio>
							</Encodes>
						</OutputProfile>
					</OutputProfiles>
					<Providers>
						<OVT />
					</Providers>
					<Publishers>
						<AppWorkerCount>1</AppWorkerCount>
						<StreamWorkerCount>8</StreamWorkerCount>
						<WebRTC>
							<Timeout>30000</Timeout>
							<Rtx>false</Rtx>
							<Ulpfec>false</Ulpfec>
							<JitterBuffer>false</JitterBuffer>
						</WebRTC>
						<LLHLS>
							<ChunkDuration>0.5</ChunkDuration>
							<SegmentDuration>6</SegmentDuration>
							<SegmentCount>10</SegmentCount>
							<CrossDomains>
								<Url>*</Url>
							</CrossDomains>
						</LLHLS>
					</Publishers>
				</Application>
			</Applications>
			-->
		</VirtualHost>
	</VirtualHosts>
</Server>
\ No newline at end of file

A OvenMediaEngine/volumes/origin_conf/Logger.xml => OvenMediaEngine/volumes/origin_conf/Logger.xml +14 -0
@@ 0,0 1,14 @@
<?xml version="1.0" encoding="UTF-8"?>

<Logger version="2">
	<!-- Log file location -->
	<Path>/var/log/ovenmediaengine</Path>

	<!-- Disable some SRT internal logs -->
	<Tag name="SRT" level="critical" />
	<Tag name="HttpServer" level="warn" />
	<Tag name=".*\.Stat" level="warn" />

	<!-- Log level: [debug, info, warn, error, critical] -->
	<Tag name=".*" level="info" />
</Logger>

A OvenMediaEngine/volumes/origin_conf/Server.id => OvenMediaEngine/volumes/origin_conf/Server.id +1 -0
@@ 0,0 1,1 @@
5516f896-e45b-4e73-80af-7fbba29004a5
\ No newline at end of file

A OvenMediaEngine/volumes/origin_conf/Server.xml => OvenMediaEngine/volumes/origin_conf/Server.xml +261 -0
@@ 0,0 1,261 @@
<?xml version="1.0" encoding="UTF-8" ?>

<Server version="8">
	<Name>OvenMediaEngine</Name>
	<!-- Host type (origin/edge) -->
	<Type>origin</Type>
	<!-- Specify IP address to bind (* means all IPs) -->
	<IP>*</IP>
	<PrivacyProtection>true</PrivacyProtection>
	<!-- 
	To get the public IP address(mapped address of stun) of the local server. 
	This is useful when OME cannot obtain a public IP from an interface, such as AWS or docker environment. 
	If this is successful, you can use ${PublicIP} in your settings.
	-->
	<StunServer>stun.l.google.com:19302</StunServer>

	<Modules>
		<!-- 
		Currently OME only supports h2 like all browsers do. Therefore, HTTP/2 only works on TLS ports.			
		-->
		<HTTP2>
			<Enable>true</Enable>
		</HTTP2>

		<LLHLS>
			<Enable>true</Enable>
		</LLHLS>

		<!-- P2P works only in WebRTC and is experiment feature -->
		<P2P>
			<!-- disabled by default -->
			<Enable>false</Enable>
			<MaxClientPeersPerHostPeer>2</MaxClientPeersPerHostPeer>
		</P2P>
	</Modules>

	<!-- Settings for the ports to bind -->
	<Bind>
		<!-- Enable this configuration if you want to use API Server -->
		<!--
		<Managers>
			<API>
				<Port>${env:OME_API_PORT:8081}</Port>
				<WorkerCount>1</WorkerCount>
			</API>
		</Managers>
		-->
		<Providers>
			<!-- Pull providers -->
			<RTSPC>
				<WorkerCount>1</WorkerCount>
			</RTSPC>
			<OVT>
				<WorkerCount>1</WorkerCount>
			</OVT>
			<!-- Push providers -->
			<RTMP>
				<Port>${env:OME_RTMP_PROV_PORT:1935}</Port>
				<WorkerCount>1</WorkerCount>
			</RTMP>
			<SRT>
				<Port>${env:OME_SRT_PROV_PORT:9999}</Port>
				<WorkerCount>1</WorkerCount>
			</SRT>
			<MPEGTS>
				<!--
					Listen on port 4000
					This is just a demonstration to show that you can configure the port in several ways
					<Port>${env:OME_MPEGTS_PROV_PORT:4000-4001,4004,4005/udp}</Port>
				-->
				<Port>${env:OME_MPEGTS_PROV_PORT:4000/udp}</Port>
			</MPEGTS>
			<WebRTC>
				<Signalling>
					<Port>${env:OME_WEBRTC_SIGNALLING_PORT:3333}</Port>
					<TLSPort>${env:OME_WEBRTC_SIGNALLING_TLS_PORT:3334}</TLSPort>
					<WorkerCount>1</WorkerCount>
				</Signalling>
				<IceCandidates>
					<TcpRelay>${env:OME_WEBRTC_TCP_RELAY_ADDRESS:*:3478}</TcpRelay>
					<TcpForce>true</TcpForce>
					<TcpRelayWorkerCount>1</TcpRelayWorkerCount>
					<IceCandidate>*:10006/udp</IceCandidate>
				</IceCandidates>
			</WebRTC>
		</Providers>

		<Publishers>
			<!-- The OVT is protocol for ORIGIN-EDGE -->
			<OVT>
				<Port>${env:OME_ORIGIN_PORT:9000}</Port>
				<WorkerCount>1</WorkerCount>
			</OVT>
			<LLHLS>
				<!-- 
				OME only supports h2, so LLHLS works over HTTP/1.1 on non-TLS port. 
				Note that LLHLS runs higher performance over HTTP/2.
				Therefore, it is recommended to use TLS Port.
				-->
				<Port>${env:OME_LLHLS_STREAM_PORT:3333}</Port>
				<TLSPort>${env:OME_LLHLS_STREAM_TLS_PORT:3334}</TLSPort>
				<WorkerCount>1</WorkerCount>
			</LLHLS>
			<WebRTC>
				<Signalling>
					<Port>${env:OME_WEBRTC_SIGNALLING_PORT:3333}</Port>
					<TLSPort>${env:OME_WEBRTC_SIGNALLING_TLS_PORT:3334}</TLSPort>
					<WorkerCount>1</WorkerCount>
				</Signalling>
				<IceCandidates>
					<IceCandidate>*:10000-10005/udp</IceCandidate>
					<TcpRelay>${env:OME_WEBRTC_TCP_RELAY_ADDRESS:*:3478}</TcpRelay>
					<TcpForce>true</TcpForce>
					<TcpRelayWorkerCount>1</TcpRelayWorkerCount>
				</IceCandidates>
			</WebRTC>
		</Publishers>
	</Bind>

	<VirtualHosts>
		<!--
			You can include multiple XML files by doing the following:
			<VirtualHost include="sites-enabled/*.xml" />
		-->
		<VirtualHost include="VHost*.xml" />
		<VirtualHost>
			<Name>default</Name>
			<!--Distribution is a value that can be used when grouping the same vhost distributed across multiple servers. This value is output to the events log, so you can use it to aggregate statistics. -->
			<Distribution>ovenmediaengine.com</Distribution>
			
			<!-- Settings for multi ip/domain and TLS -->
			<Host>
				<Names>
					<!-- Host names
						<Name>stream1.airensoft.com</Name>
						<Name>stream2.airensoft.com</Name>
						<Name>*.sub.airensoft.com</Name>
						<Name>192.168.0.1</Name>
					-->
					<Name>*</Name>
				</Names>
				<!--
				<TLS>
					<CertPath>path/to/file.crt</CertPath>
					<KeyPath>path/to/file.key</KeyPath>
					<ChainCertPath>path/to/file.crt</ChainCertPath>
				</TLS>
				-->
			</Host>

			<!-- Refer https://airensoft.gitbook.io/ovenmediaengine/signedpolicy
			<SignedPolicy>
				<PolicyQueryKeyName>policy</PolicyQueryKeyName>
				<SignatureQueryKeyName>signature</SignatureQueryKeyName>
				<SecretKey>aKq#1kj</SecretKey>

				<Enables>
					<Providers>rtmp,webrtc,srt</Providers>
					<Publishers>webrtc,hls,llhls,dash,lldash</Publishers>
				</Enables>
			</SignedPolicy>
			-->

			<!-- Settings for applications -->
			<Applications>
				<Application>
					<Name>app</Name>
					<!-- Application type (live/vod) -->
					<Type>live</Type>
					<OutputProfiles>
						<OutputProfile>
							<Name>bypass_stream</Name>
							<OutputStreamName>${OriginStreamName}</OutputStreamName>

							<!-- 
							You can provide ABR with Renditions. Currently, ABR is only supported in LLHLS.
							
							<Renditions>
								<Rendition>
									<Name>Bypass</Name>
									<Video>bypass_video</Video>
									<Audio>bypass_audio</Audio>
								</Rendition>
								<Rendition>
									<Name>FHD</Name>
									<Video>video_1280</Video>
									<Audio>bypass_audio</Audio>
								</Rendition>
								<Rendition>
									<Name>HD</Name>
									<Video>video_720</Video>
									<Audio>bypass_audio</Audio>
								</Rendition>
							</Renditions> 
							-->

							<Encodes>
								<Audio>
									<Name>bypass_audio</Name>
									<Bypass>true</Bypass>
								</Audio>
								<Video>
									<Name>bypass_video</Name>
									<Bypass>true</Bypass>
								</Video>
								<Audio>
									<Codec>opus</Codec>
									<Bitrate>128000</Bitrate>
									<Samplerate>48000</Samplerate>
									<Channel>2</Channel>
								</Audio>
								<!-- 							
								<Video>
									<Name>video_1280</Name>
									<Codec>h264</Codec>
									<Bitrate>5024000</Bitrate>
									<Framerate>30</Framerate>
									<Width>1920</Width>
									<Height>1280</Height>
									<Preset>faster</Preset>
								</Video>
								<Video>
									<Name>video_720</Name>
									<Codec>h264</Codec>
									<Bitrate>2024000</Bitrate>
									<Framerate>30</Framerate>
									<Width>1280</Width>
									<Height>720</Height>
									<Preset>faster</Preset>
								</Video>
								-->
							</Encodes>
						</OutputProfile>
					</OutputProfiles>
					<Providers>
						<RTMP />
						<SRT />
					</Providers>
					<Publishers>
						<AppWorkerCount>1</AppWorkerCount>
						<StreamWorkerCount>8</StreamWorkerCount>
						<WebRTC>
							<Timeout>30000</Timeout>
							<Rtx>false</Rtx>
							<Ulpfec>false</Ulpfec>
							<JitterBuffer>false</JitterBuffer>
						</WebRTC>
						<LLHLS>
							<ChunkDuration>0.5</ChunkDuration>
							<SegmentDuration>6</SegmentDuration>
							<SegmentCount>10</SegmentCount>
							<CrossDomains>
								<Url>*</Url>
							</CrossDomains>
						</LLHLS>
					</Publishers>
				</Application>
			</Applications>
		</VirtualHost>
	</VirtualHosts>
</Server>