Remove scheduler api hostname and about path

This commit is contained in:
deflax 2025-01-29 13:15:33 +00:00
parent 4f7d14ff47
commit 14f8f9ea8a
5 changed files with 11 additions and 22 deletions

View file

@ -15,7 +15,7 @@ Multi channel stream setup with Flask REST API for scheduling channels.
5. Run the stack using `docker-compose up -d --build --remove-orphans` 5. Run the stack using `docker-compose up -d --build --remove-orphans`
6. Issue a certificate: 6. Issue a certificate:
`source variables.env; docker exec acme.sh --issue -d $BASE_URL -d $SCHEDULER_API_HOSTNAME -d $CORE_API_HOSTNAME --stateless` `source variables.env; docker exec acme.sh --issue -d $BASE_URL d $CORE_HOSTNAME --stateless`
7. Install the certificate: 7. Install the certificate:
`source variables.env; docker exec acme.sh --install-cert -d $BASE_URL --reloadcmd "cat \$CERT_KEY_PATH \$CERT_FULLCHAIN_PATH > /certificates/$BASE_URL.pem" `source variables.env; docker exec acme.sh --install-cert -d $BASE_URL --reloadcmd "cat \$CERT_KEY_PATH \$CERT_FULLCHAIN_PATH > /certificates/$BASE_URL.pem"

View file

@ -57,12 +57,10 @@ frontend web
# Router # Router
# ACL to match the sni hosts # ACL to match the sni hosts
acl is_base ssl_fc_sni -i "${BASE_URL}" acl is_base ssl_fc_sni -i "${BASE_URL}"
acl is_api ssl_fc_sni -i "api.${BASE_URL}"
acl is_stream ssl_fc_sni -i "stream.${BASE_URL}" acl is_stream ssl_fc_sni -i "stream.${BASE_URL}"
# Define the ACL conditions and corresponding actions # Define the ACL conditions and corresponding actions
use_backend backend_api if is_base use_backend backend_api if is_base
use_backend backend_api if is_api
use_backend backend_restreamer if is_stream use_backend backend_restreamer if is_stream
backend backend_api backend backend_api

View file

@ -25,11 +25,10 @@ logger_job.setLevel(log_level)
logger_content = logging.getLogger('content') logger_content = logging.getLogger('content')
# Variables # Variables
scheduler_hostname = os.environ.get('SCHEDULER_API_HOSTNAME', 'api.example.com')
core_sync_period = int(os.environ.get('CORE_SYNC_PERIOD', 15)) core_sync_period = int(os.environ.get('CORE_SYNC_PERIOD', 15))
api_hostname = os.environ.get('CORE_API_HOSTNAME', 'stream.example.com') core_hostname = os.environ.get('CORE_HOSTNAME', 'stream.example.com')
api_username = os.environ.get('CORE_API_AUTH_USERNAME', 'admin') core_username = os.environ.get('CORE_USERNAME', 'admin')
api_password = os.environ.get('CORE_API_AUTH_PASSWORD', 'pass') core_password = os.environ.get('CORE_PASSWORD', 'pass')
rec_path = "/recordings" rec_path = "/recordings"
enable_delay = 24 enable_delay = 24
@ -161,7 +160,6 @@ def update_playhead(stream_id, stream_name, stream_prio, stream_hls_url):
# Execute stream # Execute stream
def exec_stream(stream_id, stream_name, stream_prio, stream_hls_url): def exec_stream(stream_id, stream_name, stream_prio, stream_hls_url):
global prio global prio
logger_job.warning(f'Hello {stream_name}! :]')
if stream_prio > prio: if stream_prio > prio:
prio = stream_prio prio = stream_prio
logger_job.warning(f'Source priority is now set to: {prio}') logger_job.warning(f'Source priority is now set to: {prio}')
@ -278,7 +276,7 @@ def core_api_sync():
stream_name = meta['restreamer-ui']['meta']['name'] stream_name = meta['restreamer-ui']['meta']['name']
stream_description = meta['restreamer-ui']['meta']['description'] stream_description = meta['restreamer-ui']['meta']['description']
stream_storage_type = meta['restreamer-ui']['control']['hls']['storage'] stream_storage_type = meta['restreamer-ui']['control']['hls']['storage']
stream_hls_url = f'https://{api_hostname}/{stream_storage_type}/{stream_id}.m3u8' stream_hls_url = f'https://{core_hostname}/{stream_storage_type}/{stream_id}.m3u8'
if state.exec == "running": if state.exec == "running":
process_running_channel(database, scheduler, stream_id, stream_name, stream_description, stream_hls_url) process_running_channel(database, scheduler, stream_id, stream_name, stream_description, stream_hls_url)
@ -295,8 +293,8 @@ def core_api_sync():
# Datarhei CORE API login # Datarhei CORE API login
try: try:
client = Client(base_url='https://' + api_hostname, username=api_username, password=api_password) client = Client(base_url='https://' + core_hostname, username=core_username, password=core_password)
logger_api.warning('Logging in to Datarhei Core API ' + api_username + '@' + api_hostname) logger_api.warning('Logging in to Datarhei Core API ' + core_username + '@' + core_hostname)
client.login() client.login()
except Exception as err: except Exception as err:
logger_api.error('Client login error') logger_api.error('Client login error')
@ -330,12 +328,6 @@ def root_route():
return render_template('index.html', now=datetime.utcnow(), video_files=video_files, thumbnails=sorted_thumbnails) return render_template('index.html', now=datetime.utcnow(), video_files=video_files, thumbnails=sorted_thumbnails)
# API # API
@app.route('/about', methods=['GET'])
def about_route():
about_json = { 'about': 'DeflaxTV API' }
return jsonify(about_json)
# JSON data
@app.route('/playhead', methods=['GET']) @app.route('/playhead', methods=['GET'])
def playhead_route(): def playhead_route():
global playhead global playhead

View file

@ -71,7 +71,7 @@
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
const video = document.querySelector("video"); const video = document.querySelector("video");
const source = 'https://stream.deflax.net/memfs/f2844c7c-e86c-4f0a-afb6-a1b0e25a5071.m3u8'; const source = 'https://stream.deflax.net/memfs/f2844c7c-e86c-4f0a-afb6-a1b0e25a5071.m3u8';
const playhead_url = "https://api.deflax.net/playhead"; const playhead_url = "https://deflax.net/playhead";
// For more options, see: https://github.com/sampotts/plyr/#options // For more options, see: https://github.com/sampotts/plyr/#options
// captions.update is required for captions to work with hls.js // captions.update is required for captions to work with hls.js

View file

@ -1,11 +1,10 @@
BASE_URL=example.com BASE_URL=example.com
EMAIL=info@example.com EMAIL=info@example.com
CORE_LOG_LEVEL=warn CORE_LOG_LEVEL=warn
CORE_API_HOSTNAME=stream.example.com CORE_HOSTNAME=stream.example.com
CORE_API_AUTH_USERNAME=admin CORE_USERNAME=admin
CORE_API_AUTH_PASSWORD=changeme CORE_PASSWORD=changeme
SCHEDULER_LOG_LEVEL=warn SCHEDULER_LOG_LEVEL=warn
SCHEDULER_API_HOSTNAME=api.example.com
DISCORDBOT_TOKEN=changeme DISCORDBOT_TOKEN=changeme
DISCORDBOT_LIVE_CHANNEL_ID=0 DISCORDBOT_LIVE_CHANNEL_ID=0
DISCORDBOT_LIVE_CHANNEL_UPDATE=1440 DISCORDBOT_LIVE_CHANNEL_UPDATE=1440