marsha
contains several projects, three of which are configured through environment variables.
First, there is our Django backend. We try to follow 12 factors app and so use environment variables for configuration. It looks for environment variables in env.d/{environment}
.
Then, there is our AWS deployment configurations in the src/aws
folder. Terraform looks for environment variables in src/aws/env.d/{environment}
:
- A small side Terraform project located in
src/aws/create_state_bucket
is responsible just for creating an S3 bucket in AWS that Terraform will use to record the state of the main Marsha project with encryption and versioning. - The main Terraform project in charge of deploying Marsha,
Specified in {REPO_ROOT}/env.d/{environment}
.
A string of comma separated domains that Django should accept and answer to. See Django documentation for more details about this setting.
- Type: String
- Required: Varies depending on the environment.
- No in development, this setting is not available and its value is forced to accept any originating domain;
- Yes otherwise.
- Default: Varies depending on the environment.
- ["*"] in development: all originating domains are accepted;
- None otherwise: all originating domains are rejected.
Define the environment in which the application should run. It conditions which version of the settings will be loaded.
- Type:
String
- Required: Yes
- Default:
Development
- Choices: One of
Development
,Test
,Staging
,Preprod
orProduction
.
Turns on/off debug mode.
- Type: Boolean
- Required: No
- Default:
True
ifDJANGO_CONFIGURATION
is set toDevelopment
,False
otherwise - Choices:
True
orFalse
Standard Django secret key used to make the instance unique and generate hashes such as CSRF tokens or auth keys.
See Django documentation for more information about this setting.
- Type: String
- Required: Yes
- Default: None
Define the settings file to use, relative to src/backend
.
- Type:
String
- Required: Yes
- Default:
marsha.settings
- Choices: Must be set to
marsha.settings
.
Whether to skip all LTI-related checks and accept all requests on LTI endpoints as valid. This is useful for development but should never be set to True
on publicly accessible deployments.
Note: Can't be set to True
unless DJANGO_DEBUG
is True
too.
- Type: Boolean
- Required: No
- Default:
False
- Choices:
True
orFalse
Secret key used to sign JWTs. Those are used to communicate between the Django backend and authenticated third parties (including the frontend).
- Type: string
- Required: Yes
- Default:
DJANGO_SECRET_KEY
. The SIGNING_KEY setting defaults to the value of the SECRET_KEY setting for your django project. This is a reasonable default. We still recommend you change this setting to an indenpendent value so you can easily invalidate the tokens by changing the key if it becomes compromise.
Should be set to activate sentry for an environment. The value of this DSN is given when you add a project to your Sentry instance.
- Type: string
- Required: No
- Default: None
Secrets used to sign messages sent to the Django backend from AWS lambdas (like state updates). This being a list lets us support 1 or more shared secrets — and 1 or more deployments — at the same time.
Note: should include the value from TF_VAR_update_state_secret
in src/aws
for any stack deployed to AWS which should communicate with the Django backend.
- Type: comma-separated list of strings
⚠️ ITEMS MUST NOT INCLUDE ANY COMMAS as commas are used to separated items. - Required: Yes
- Default: None
List of external javascript scripts to load in the LTI template. This list will be loaded after loading the main react script. This setting allows to load scripts hosted on another domain and specific to your project.
- Type: comma-separated list of strings
⚠️ ITEMS MUST NOT INCLUDE ANY COMMAS as commas are used to separated items. - Required: No
- Default: Empty list
Name for the Postgres database used by Marsha.
- Type: string
- Required: No
- Default:
"marsha"
Address for the Postgres database used by Marsha.
- Type: string
- Required: No
- Default:
"localhost"
Password corresponding to the user specified in POSTGRES_USER
, for the Postgres database used by Marsha.
- Type: string
- Required: No
- Default:
"pass"
Port for the Postgres database used by Marsha.
- Type: number
- Required: No
- Default:
5432"
User to connect to the Postgres database used by Marsha.
- Type: string
- Required: No
- Default:
"marsha_user"
Cache expiration (in seconds) for application data passed to the frontend by LTI views.
- Type: number
- Required: No
- Default: 60
A key ID + secret pair for an AWS IAM account with administrative access to the resources the relevant AWS deployment is using.
- Type: string
- Required: Yes
- Default: None
The Amazon Web Services region where we deployed or want to deploy our serverless stack.
- Type: string
- Required: No
- Default:
"eu-west-1"
- Choices: Any valid AWS region name.
All the AWS services we use have their name prefixed by the terraform workspace name. This setting should contain the terraform workspace name defined in marsha's AWS project.
- Type: string
- Required: No
- Default: Varies depending on the environment.
"development"
in development;"test"
in test;"staging"
in staging;"preprod"
in preprod;"production"
in production.
The source AWS S3 bucket where files will be uploaded by end users. This should match the name of the bucket created by the relevant AWS deployment.
- Type: string
- Required: No
- Default: Varies depending on the environment.
"development-marsha-source"
in development;"test-marsha-source"
in test;"staging-marsha-source"
in staging;"preprod-marsha-source"
in preprod;"production-marsha-source"
in production.
The AWS S3 bucket where static files will be uploaded by collectstatic. The development and test environments do not store their static files to S3 but on the filesystem. This should match the name of the bucket created by the relevant AWS deployment.
- Type: string
- Required: No
- Default: Varies depending on the environment:
"staging-marsha-static"
in staging;"preprod-marsha-static"
in preprod;"production-marsha-static"
in production.
The static files storage backend that Django should use to serve static files. For more information, see documentation.
- Type: string
- Required: No
- Default: Varies depending on the environment:
"django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
in development and test"marsha.core.storage.ConfigurableManifestS3Boto3Storage"
in staging, preprod and production.
The mapping between the names of the original static files and the names of the static files distributed by the backend is stored in a file called the manifest.
This setting makes the manifest file name configurable so that it can be versioned with a deployment stamp in our CI/CD.
Indeed, we need to change the name of this manifest file for each deployment so that several versions of the app can run in parallel without interfering with each other.
- Type: string
- Required: No
- Default:
staticfiles.json
The public key id saved in AWS cloudfront public keys management. This public key is created by terraform and you can pick
the id using terraform output cloudfront_publick_key_id
- Type: string
- Required:
- Yes when
DJANGO_CLOUDFRONT_SIGNED_URLS_ACTIVE
isTrue
; - No otherwise.
- Yes when
- Default: None;
Path to a private key corresponding to the public key ID in DJANGO_CLOUDFRONT_SIGNED_PUBLIC_KEY_ID
. Also used to sign Cloudfront URLs.
The private key can be retrieve from the terraform output terraform output cloudfront_ssh_private_key
- Type: string
- Required:
- Yes when
DJANGO_CLOUDFRONT_SIGNED_URLS_ACTIVE
isTrue
and the key is not located in the default path; - No otherwise.
- Yes when
- Default:
src/backend/.ssh/cloudfront_private_key
Whether Cloudfront URLs for MP4 files and timed text tracks should be cryptographically signed.
Note: Preview images are never signed as a matter of policy; adaptive streaming formats pose technical challenges when it comes to signed URLs, so we're not doing any signing there for now.
- Type: Boolean
- Required: No
- Default: Varies depending on the environment:
False
in development and test;True
in all other environments.
- Choices:
True
orFalse
The domain for the AWS Cloudfront distribution for the relevant AWS deployment. This is the domain that will be used to distribute processed files to end users.
- Type: string
- Required: Yes
- Default: None
To enable or disable the global chat feature.
- Type: boolean
- Required: No
- Default: False
Main XMPP server domain.
- Type: string
- Required: Only when
DJANGO_LIVE_CHAT_ENABLED
is set to True - Default: None
The Bosh endpoint defined by your XMPP server. This url is used by Marsha's front application to excahnge with the XMPP server.
Required when DJANGO_LIVE_CHAT_ENABLED
is set to True
- Type: string
- Required: Only when
DJANGO_LIVE_CHAT_ENABLED
is set to True - Default: None
Your XMPP MUC component domain.
- Type: string
- Required: Only when
DJANGO_LIVE_CHAT_ENABLED
is set to True - Default: None
The JID of an admin configured on your XMPP server. Example: admin@your-xmpp-server.com
- Type: string
- Required: Only when
DJANGO_LIVE_CHAT_ENABLED
is set to True - Default: None
XMPP server port to use for client connections
- Type: number
- Required: No
- Default: 5222
The password associated to your admin user set in the setting DJANGO_XMPP_PRIVATE_ADMIN_JID
- Type: string
- Required: Only when
DJANGO_LIVE_CHAT_ENABLED
is set to True - Default: None
Secret key used to sign JWTs.
- Type: string
- Required: Only when
DJANGO_LIVE_CHAT_ENABLED
is set to True - Default: None
The JWT issuer accepted by the XMPP server
- Type: string
- Required: No
- Default: marsha
The JWT audience accepted by the XMPP server
- Type: string
- Required: No
- Default: marsha
Time window (in seconds) contained in each parent manifest. https://docs.aws.amazon.com/mediapackage/latest/apireference/origin_endpoints.html#origin_endpoints-prop-hlspackage-playlistwindowseconds
- Type: integer
- Required: No
- Default: 10
Duration (in seconds) of each fragment. Actual fragments are rounded to the nearest multiple of the source fragment duration. https://docs.aws.amazon.com/mediapackage/latest/apireference/origin_endpoints.html#origin_endpoints-prop-hlspackage-segmentdurationseconds
- Type: integer
- Required: No
- Default: 4
Framerate numerator - framerate is a fraction, e.g. 24000 / 1001 = 23.976 fps. https://docs.aws.amazon.com/medialive/latest/apireference/channels.html#channels-prop-h264settings-frameratenumerator
- Type: integer
- Required: No
- Default: 24000
Framerate denominator. https://docs.aws.amazon.com/medialive/latest/apireference/channels.html#channels-prop-h264settings-frameratedenominator
- Type: integer
- Required: No
- Default: 1000
GOP size (keyframe interval) in units of either frames or seconds per gopSizeUnits. gopSize must be greater than 0, but need not be an integer. https://docs.aws.amazon.com/medialive/latest/apireference/channels.html#channels-prop-h264settings-gopsize
- Type: number
- Required: No
- Default: 4
A boolean indicating whether the P2P live feature is enabled or not.
- Type: boolean
- Required: No
- Default: False
A comma-separated list of STUN server URLs to use for P2P live.
- Type: comma-separated list of strings
⚠️ ITEMS MUST NOT INCLUDE ANY COMMAS as commas are used to separated items. - Required: No
- Default: []
A comma-separated list of web torrent tracker URLs to use for P2P live.
- Type: comma-separated list of strings
⚠️ ITEMS MUST NOT INCLUDE ANY COMMAS as commas are used to separated items. - Required: No
- Default: []
Graphana is a web-based analytics tool for monitoring and visualizing metrics. Marsha can connect to a Grafana instance to display metrics. A backend Grafana instance must be configured in order to use this feature. All following settings are required to connect to a Grafana instance.
Django module to use for the statistics backend.
- Type: string
- Required: No
- Default:
marsha.core.stats.grafana_xapi_fun_backend
- Choices:
marsha.core.stats.grafana_xapi_fun_backend
ormarsha.core.stats.dummy_backend
The Grafana API endpoint.
- Type: string
- Required: Yes for grafana_xapi_fun_backend
- Default: None
The Grafana API key.
- Type: string
- Required: Yes for grafana_xapi_fun_backend
- Default: None
The Grafana data source ID.
- Type: string
- Required: Yes for grafana_xapi_fun_backend
- Default: None
The Grafana data stream.
- Type: s`tring
- Required: Yes for grafana_xapi_fun_backend
- Default:` None
The API access key provided by Crowdin. Only managers can have access to this key.
- Type: string
- Required: No
- Default: None
The unique project identifier provided by Crowdin. Only managers can have access to this setting.
- Type: string
- Required: No
- Default: None
The path from where the crowdin-cli
will work, this path should point to the src
directory of marsha.
By default its value is /app/src
and while you are using the container configured in our docker-compose
file you have no need to change it.
- Type: string
- Required: None
- Default: /app/src
Specified in {REPO_ROOT}/src/aws/env.d/{environment}
.
A key ID + secret pair for an AWS IAM account with administrative access to the resources the AWS deployment we're operating on is using.
- Type: string
- Required: Yes
- Default: None
The default region used by the AWS provider. All resources managed by terraform will be created on this region.
- Type: string
- Required: Yes
- Default: eu-west-1
A unique suffix added to all S3 bucket names. You choose this suffix once and can't change it afterwards as it is not allowed to rename a bucket (terraform would delete the current bucket and create a new one. All your data would be lost for ever). This suffix is needed because a bucket name is unique accross all existing AWS accounts: https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html A suffix can be your company name or any random string. If you don't add this variable, you will not be able to create any s3 bucket in your project.
- Type: string
- Required: Yes
The ID of the AWS master account (not its access key!) with which we want to sign urls (it is declared in the CloudFront distribution as a signing account).
- Type: string
- Required: Yes
- Default: None
Secret used to sign messages exchanged between the Django backend & AWS lambdas.
Note: should be included in the list of values declared in DJANGO_UPDATE_STATE_SHARED_SECRETS
for the Django backend deployment with which our deployment's lambdas will communicate.
- Type: string
⚠️ MUST NOT INCLUDE ANY COMMAS as the corresponding Django setting is a comma-separated list. - Required: Yes
- Default: None
The marsha backend url. This url will be used in the lambda as base url to build all the url called from all lambdas.
Example: marsha.education
- Type: string
- Required: Yes
- Default: None
The endpoint in Marsha to which our lambdas should POST state updates when they process files.
Example: /api/update-state
.
- Type: string
- Required: Yes
- Default: None
Whether SSL certificate validation in requests made by the AWS lambdas should be disabled. This allows Django to run on a domain with a self-signed or otherwise invalid certificate in non-production environments.
- Type: boolean
- Required: No
- Default: false
A list of migrations to execute by the migration lambda without the extension (.js
). List of migrations are available in src/aws/lambda-migrate/src/migrations
.
To execute the migration 0001_encode_timed_text_tracks.js
set this variable with 0001_encode_timed_text_tracks
Example: ["0001_encode_timed_text_tracks"]
- Type: list of strings
- Required: No
- Default: []
The ECR image name you want to use. All lambdas are built in one docker image and hosted in this repository
- Type: string
- Required: Yes
- Default: None
The lambda docker image tag used by all the lambdas
- Type: string
- Required: Yes
- Default: None
The arn associated with the ECR image name. This value can be found in the shared_resources terraform output.
- Type: string
- Required: Yes
- Default: None
This variable is used by the medialive routing lambda. This lambda will use the variable to determine on which lambda the event should be routed.
- Type: string
- Required: Yes
- Default: marsha-medialive
This variable allow you to configure the amount of memory allocated for the lambda convert. Depending the environment you are using you would like to increase this value.
- Type: number
- Required: No
- Default: 1536