Repository navigation
Expand file tree
/
Copy pathconfig.py.example
More file actions
178 lines (158 loc) · 9 KB
/
Copy pathconfig.py.example
File metadata and controls
178 lines (158 loc) · 9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# Configuration for Distributed Encodes Manager
# ==============================================================================
# SERVER SETTINGS
# ==============================================================================
SERVER_HOST = '0.0.0.0'
SERVER_PORT = 5000
# The URL workers and users will use to access the manager
# Example: "http://192.168.1.50:5000/" or "https://www.yourdomain.com/"
SERVER_URL_DISPLAY = "https://encode.fractumseraph.net/"
# ==============================================================================
# AUTHENTICATION
# ==============================================================================
ADMIN_USER = "admin"
ADMIN_PASS = "changeme" # [!] CHANGE THIS!
# Security Tokens (Generate new random strings for production)
WORKER_SECRET = "ChangeThisToALongRandomString"
SECRET_KEY = "ChangeThisToAnotherRandomString"
# Require workers to present WORKER_SECRET (X-Worker-Token header or ?token=).
# When True (default), requests with NO token are rejected — previously a
# missing token was waved through, so the secret gated nothing. Regular
# workers already send the token, so they are unaffected. Set False only if
# you intentionally run a fully open, anonymous-worker manager.
# This also gates /download_source (the raw source library).
REQUIRE_WORKER_TOKEN = True
# ==============================================================================
# FRACTUMCOIN PAYOUTS
# ==============================================================================
# Shared secret for the payout daemon (FractumCoin repo, encode-rewards/) that
# runs next to the coin wallet and settles the earnings ledger. It presents
# this as an X-Payout-Token header. None disables the token path entirely
# (admin Basic auth still reaches the payout API for testing).
PAYOUT_TOKEN = None
# Display hints for the admin UI ONLY — the payout daemon's own config is
# authoritative for real money movement. Keep them in sync so the UI's
# "FRCT owed" figures and AUTO/NEEDS-APPROVAL badges match what the daemon
# actually does (the UI warns when the daemon reports different values).
PAYOUT_RATE_FRCT_PER_MIN = 1.0
PAYOUT_AUTO_CAP_FRCT = 250.0
# ==============================================================================
# DATABASE BACKUPS
# ==============================================================================
# The database is the single source of truth for the whole queue and the
# FractumCoin earnings ledger, so it is backed up on a schedule (consistent
# SQLite backup, safe while live). Keeps the newest DB_BACKUP_RETENTION copies.
DB_BACKUP_ENABLED = True
DB_BACKUP_DIR = "db_backups"
DB_BACKUP_INTERVAL_HOURS = 12
DB_BACKUP_RETENTION = 10
# Also keep one backup per hour for this many hours and one per day for this
# many days (a backup is then taken hourly). Each backup is checked before it
# counts. Set both to 0 to keep only the newest DB_BACKUP_RETENTION.
DB_BACKUP_KEEP_HOURLY = 12
DB_BACKUP_KEEP_DAILY = 7
# ==============================================================================
# MANAGER AUTO-UPDATE
# ==============================================================================
# When True, the manager checks origin/<branch> on a schedule, fast-forwards
# to it, and restarts itself into the new code — no manual login/pull/restart.
# Restart order: MANAGER_RESTART_CMD if set; else a graceful gunicorn reload
# (SIGHUP to the master, zero downtime); else a clean exit under systemd
# (the shipped unit has Restart=always). Repos with local modifications are
# never touched, and only fast-forward pulls are performed.
# NOTE: this executes whatever lands on the branch — anyone with push access
# to it effectively controls the server. Keep the branch protected.
MANAGER_AUTO_UPDATE = True
MANAGER_UPDATE_INTERVAL_HOURS = 6
MANAGER_UPDATE_BRANCH = "main"
# Optional explicit restart command, e.g.:
# MANAGER_RESTART_CMD = "systemctl --user restart distributed-encodes.service"
MANAGER_RESTART_CMD = None
# ==============================================================================
# FILE & DIRECTORY SETTINGS
# ==============================================================================
# Local folder to scan for source files
SOURCE_DIRECTORY = "./source_media"
# Folder where finished encodes will be saved
COMPLETED_DIRECTORY = "./completed_media"
# Remote HTTP Source (Optional)
# If set, the manager will scan this URL for mp4/mkv files.
# Workers v1.9.0+ will download directly from this URL.
# Example: "http://192.168.1.100:8080/"
# REMOTE_SOURCE_URL = "http://IP:PORT/"
REMOTE_SOURCE_URL = None
WORKER_TEMPLATE_FILE = "worker_template.py"
# The Android app offered on the dashboard at /dl/android: this file when it
# exists next to manager.py, otherwise a redirect to ANDROID_APK_URL (the
# latest GitHub release). See android/README.md.
ANDROID_APK_FILE = "FractumWorker.apk"
ANDROID_APK_URL = "https://github.com/FractumSeraph/DistributedEncodes/releases/latest/download/FractumWorker.apk"
VIDEO_EXTENSIONS = ('.mkv', '.mp4', '.avi', '.mov')
# ==============================================================================
# DATABASE SETTINGS
# ==============================================================================
DB_FILE = "encoding_jobs.db"
# Database Mode:
# 'disk' = Standard file-based.
# 'ram' = Load into Memory (Linux: /dev/shm), copied to DB_FILE every minute.
# IMPORTANT: if the manager runs under a normal login account, run
# once: sudo loginctl enable-linger <account>
# Otherwise the system deletes that account's files in /dev/shm when
# its last login session ends (an SSH logout), while the manager is
# still running. The manager warns about this at start-up, and
# reloads the disk copy if it happens (losing up to a minute).
DB_MODE = 'ram'
# Wipe guard: the manager never copies a database that looks wiped (no jobs
# table, or under half the jobs of a copy with 100+ jobs) over a good one:
# not in the minute sync, not at start-up, not into db_backups/. Set False
# only while removing most of the jobs table by hand with an outside script.
DB_SHRINK_GUARD = True
# Write-Ahead Logging (WAL):
# True = Faster, better concurrency (Recommended for Local Disk & RAM)
# False = Slower, strictly serial (Use ONLY if DB is on a Network Share/NAS)
USE_WAL_MODE = True
# ==============================================================================
# CHUNKED ENCODING
# ==============================================================================
# When True, long videos are split into time-range chunks so several workers
# (or several cores via --jobs) can encode ONE video in parallel. The manager
# stitches the chunks back together with a lossless stream-copy concat, so
# there is no quality or file-size penalty beyond one extra keyframe per
# chunk boundary. Requires FFmpeg on the manager (already needed for
# upload verification). Workers can opt out with --no-chunks.
CHUNKED_ENCODING = True
# Target length of each video chunk in seconds (minimum 60).
# Shorter = more parallelism, slightly more coordination overhead.
# NOTE for browser (WASM) workers: they advertise a MAX CHUNK SEC (default
# 600 since web worker 3.6.0) and are only handed chunks at or under it; native
# workers take any length. A 10-minute 1080p chunk peaked at about 1 GB of
# browser memory in testing. If you want browser volunteers to help on big
# videos, keep this at/below their MAX CHUNK SEC.
CHUNK_DURATION_SEC = 120
# ==============================================================================
# AUDIO FROM CHUNK SLICES
# ==============================================================================
# A chunked job normally reads its source twice: the video chunks cover the
# file once between them, and a separate audio pass downloads the whole file
# again. When the source host's upload speed is what limits the farm, that
# second download is half the traffic.
#
# 'off' (default) the separate audio pass, as before.
# 'on' each video-chunk worker (worker 3.10.0+) also saves the untouched
# source audio and text subtitles for its slice and sends them with
# its chunk; the manager rejoins the slices, checks every join, and
# encodes the track itself with the same settings. If anything does
# not check out, that job falls back to the separate pass.
# 'verify' both, for checking 'on' against real sources: the separate pass
# still supplies the final file, the slices are built as well, and
# the comparison is written to the log ("Audio-from-chunks check").
#
# This can also be changed from the admin page without a restart; the admin
# setting takes precedence over this file. It applies to jobs split afterwards.
AUDIO_FROM_CHUNKS = 'off'
# Optional: folder containing the ffmpeg and ffprobe to use for building that
# track, e.g. the same static build the workers download. Not needed when the
# server's own FFmpeg is version 8.1 or newer. FFmpeg 6.1 places audio that
# carries an encoder delay a few milliseconds later than the workers do
# (versions in between were not tested).
AUDIO_FROM_CHUNKS_FFMPEG_DIR = None