Constants
constants
¶
Defines the constants for the launcher-owned Modal host deploy
Pre-Defined Values
-
The name of the deployed
Modalapp and the name of theweb functionthat runs theFastAPIapplication (HOST_APP_NAME,WEB_FUNCTION_NAME) -
The name of the persistent
Modalvolume used to store user data, the separate path at which it is mounted, and the local-disk path the server reads and writes and the syncer mirrors to the volume (DATA_VOLUME_NAME,DATA_MOUNT,CONTAINER_CACHE) -
Where the built frontend lives inside the Docker image run by the
web functionand where the frontend lives inside mirumoji's published frontend Docker image (FRONTEND_DIR,FRONTEND_IMAGE_ROOT) -
How many requests the the
web functioncan serve simultaneously (MAX_CONCURRENT_REQUESTS) -
The pre-defined username used for the
Basic Authand the name of the managed environment variable containing the user-definedBasic Authpassword which gurads the deployed app (WEB_USERNAME,WEB_PASSWORD_ENV) -
Managed environment variables defining the hardware capability to request for the container that runs the
web function(HOST_MAX_CONCURRENT_REQUESTS_VAR,HOST_CPU_VAR,HOST_MEMORY_VAR) -
The GPU / preemptibility host-mode keys (
MIRUMOJI_HOST_ON_GPU,MIRUMOJI_MODAL_GPU,MIRUMOJI_HOST_NONPREEMPTIBLE) live incore.constantsand resolve throughcore.envfile
CONTAINER_CACHE = '/root/.local/share/mirumoji'
module-attribute
¶
Where the mirumoji user data lives inside the container, matching the
container's platformdirs user_data_path
Data Handling
-
Instead of mounting the persistent volume directly on this path, a background task watches this directory and keeps the volume in sync with it
-
This allows the application to serve files and perform database operations directly on the container's NVMe, avoiding network latency on file operations, which would considerably slow down the application
DATA_MOUNT = '/opt/mirumoji/volume_mnt'
module-attribute
¶
Where the persistent Volume mounts inside the container
The volume is mounted in the container at this path only so that
a background task can utilise the mount's FUSE syncing to persist
user data from the CONTAINER_CACHE to the volume on file-system
changes. Therefore, this directory is always kept in sync with
CONTAINER_CACHE throughout the application's lifespan
DATA_VOLUME_NAME = 'mirumoji-data'
module-attribute
¶
The persistent modal.Volume name backing the database and media
FRONTEND_DIR = '/opt/mirumoji/frontend'
module-attribute
¶
Where the built frontend is copied inside the composed image
FRONTEND_IMAGE_ROOT = '/usr/share/nginx/html'
module-attribute
¶
Where the published frontend image serves the build from (nginx's web root),
the source of the COPY --from that grafts it into the host image
HOST_APP_NAME = 'mirumoji-host'
module-attribute
¶
The deployed host app's name on the user's Modal workspace
HOST_CPU_VAR = 'MIRUMOJI_HOST_CPU'
module-attribute
¶
Managed config key setting the CPU cores reserved for the web container
HOST_MAX_CONCURRENT_REQUESTS_VAR = 'MIRUMOJI_HOST_MAX_CONCURRENT_REQUESTS'
module-attribute
¶
Managed config key setting how many requests the web container serves at once
HOST_MEMORY_VAR = 'MIRUMOJI_HOST_MEMORY'
module-attribute
¶
Managed config key setting the memory (MiB) reserved for the web container
HOST_MODE_KEY = 'mirumoji-host-mode'
module-attribute
¶
Modal app tag holding a digest of the host's deploy-time configuration (GPU vs CPU, preemptibility, and the CPU / memory / concurrency reservations)
Passed to mirumoji.modal.ensure_deployed as an extra identity tag, so
changing the host mode or a reservation at the same version forces a redeploy
instead of matching the live app and silently doing nothing
MODAL_LOGS_MAX_TAIL = 20000
module-attribute
¶
The largest --tail the modal app logs CLI accepts
Passing more is rejected with a usage error, so the launcher bounds its own option here and reports a clean message instead of surfacing modal's raw usage text
WEB_FUNCTION_NAME = 'web'
module-attribute
¶
The host app's web endpoint name (the web function), used for
Function.from_name URL lookups
WEB_PASSWORD_ENV = 'MIRUMOJI_WEB_PASSWORD'
module-attribute
¶
Environment variable carrying the host app's Basic Auth password into the
container, matching the MIRUMOJI_WEB_PASSWORD managed config key
WEB_USERNAME = 'mirumoji'
module-attribute
¶
The username that the browser HTTP Basic Auth prompt expects