Configuration checks#
This page lists every configuration check FairDM adds to Django’s check framework. Each entry gives the check’s id, its severity, its tags, what it reports and how to fix it. It does not explain why the portal refuses to start in production, which is in How FairDM configures a portal, and it does not list the checks Django itself provides.
Summary#
Id |
Severity |
Stops a production start |
Runs without |
|---|---|---|---|
|
Error |
Yes |
No |
|
Error |
Yes |
No |
|
Error |
Yes |
No |
|
Error |
Yes |
No |
|
Error |
No |
Yes |
|
Error |
Yes |
No |
|
Error |
Yes |
No |
|
Error |
Yes |
No |
|
Error |
Yes |
No |
|
Error |
No |
No |
|
Error |
No |
No |
|
Error |
Yes, in every environment |
Yes |
|
Error |
Yes |
No |
|
Error |
Yes |
No |
|
Error |
Yes |
No |
|
Error |
Yes |
No |
|
Warning |
No |
Yes |
|
Error |
No |
Yes |
|
Warning |
No |
No |
fairdm.E001: the secret key is empty, insecure or too short#
Severity: Error.
Tags:
security,deploy,production_critical.Reports: One of three conditions.
SECRET_KEYis empty.SECRET_KEYstarts withdjango-insecure-, the prefix of a published development key. FairDM’s own development fallback carries it.SECRET_KEYis shorter than 50 characters.
Fix: Set
DJANGO_SECRET_KEYto a private, randomly generated value of 50 characters or more.
python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
fairdm.E003: the allowed hosts list is empty#
Severity: Error.
Tags:
security,deploy,production_critical.Reports:
ALLOWED_HOSTSis empty. FairDM builds it fromDJANGO_SITE_DOMAINandDJANGO_ALLOWED_HOSTS, so the check fires when both are unset.Fix: Set
DJANGO_SITE_DOMAIN, or setDJANGO_ALLOWED_HOSTSto a comma-separated list of host names.
DJANGO_ALLOWED_HOSTS=example.com,www.example.com
fairdm.E004: the allowed hosts list contains a wildcard#
Severity: Error.
Tags:
security,deploy,production_critical.Reports:
ALLOWED_HOSTScontains*.Fix: Name each host. Remove
*fromDJANGO_ALLOWED_HOSTSand from any assignment in your settings.
fairdm.E005: debug mode is on#
Severity: Error.
Tags:
security,deploy,production_critical.Reports:
DEBUGisTrue.Fix: Set
DJANGO_DEBUG=False, or remove the variable. The default isFalse.
fairdm.E100: no default database is configured#
Severity: Error.
Tags:
database,deploy,production_critical.Reports:
DATABASES["default"]is missing or empty. FairDM’s baseline always fills it, so this appears only when your own settings remove or empty it.Fix: Leave
DATABASESto FairDM and setDATABASE_URL.
DATABASE_URL=postgresql://user:password@localhost:5432/dbname
fairdm.E101: the database is not PostgreSQL with PostGIS#
Severity: Error.
Tags:
database,deploy,production_critical.Reports: The
ENGINEofDATABASES["default"]is notdjango.contrib.gis.db.backends.postgis.Fix: Leave
DATABASESto FairDM and setDATABASE_URL. FairDM opens it with the PostGIS backend whatever scheme it names. A portal that setsDATABASESitself setsENGINEto the PostGIS backend. The database needs the PostGIS extension, and the server needs the GDAL, GEOS and PROJ libraries.
fairdm.E102: the database has no name#
Severity: Error.
Tags:
database,deploy,production_critical.Reports:
DATABASES["default"]has noNAME. This is what an unset or malformedDATABASE_URLleaves, for examplepostgresql://with nothing after the scheme.Fix: Set
DATABASE_URLto a complete PostgreSQL connection string, or setPOSTGRES_DBwithPOSTGRES_USER,POSTGRES_PASSWORD,POSTGRES_HOSTandPOSTGRES_PORT.
fairdm.E300: no Celery broker is configured#
Severity: Error.
Tags:
deploy. Not part of the start-up guard.Reports:
CELERY_BROKER_URLis empty. FairDM fills it fromREDIS_URL.Fix: Set
REDIS_URL.
fairdm.E301: Celery tasks run in the web process#
Severity: Error.
Tags:
deploy. Not part of the start-up guard.Reports:
CELERY_TASK_ALWAYS_EAGERisTrue, so background tasks run synchronously. FairDM sets it toTrueitself whenDJANGO_ENVisdevelopmentandREDIS_URLis unset.Fix: Remove the assignment in your settings that sets it to
True. For a development portal, setREDIS_URLto run tasks on a worker.
fairdm.E400: the language settings disagree#
Severity: Error.
Tags:
translation. This is not a deployment check.Reports:
PARLER_LANGUAGESnames a language code thatLANGUAGESdoes not include. A code such asfr-cais accepted whenLANGUAGEShasfr. Thecodeunder thedefaultkey andPARLER_DEFAULT_LANGUAGE_CODEare checked too. The same rule runs when the settings load and again when the portal’s models load, in every environment, so the portal stops before any command runs.Fix: Add the missing codes to
LANGUAGES, or remove them fromPARLER_LANGUAGESandPARLER_DEFAULT_LANGUAGE_CODE.
fairdm.E500: a portal role is missing#
Severity: Error.
Tags:
deploy,production_critical.Reports: One or more of the four shipped roles is not in the database: Portal Administrator, Data Curator, Community Manager, Developer. The message names each missing role. The check stands down while
migrateruns, and whileupgrade_literature,upgrade_vocabulariesorsync_vocabulariesruns, because the upgrade guides run those beforemigrate. It reports nothing when the group table cannot be read.Fix: Run
python manage.py migrate, which installs the roles.
fairdm.E501: development accounts exist outside development#
Severity: Error.
Tags:
deploy,production_critical.Reports: A person holds one of the email addresses of FairDM’s development accounts, which share a published password. The check stands down when
DJANGO_ENVisdevelopment. The addresses are:portal.administrator@example.comdata.curator@example.comcommunity.manager@example.comportal.developer@example.comregular.user@example.comstaff.user@example.comsuper.user@example.comadmin.user@example.commember.user@example.comformer-admin.user@example.comcommunity-manager.user@example.comdata-curator.user@example.com
Fix: Remove the accounts the message names. If the portal is a development portal, set
DJANGO_ENV=development.
fairdm.E600: a registered type cannot be created through the API#
Severity: Error.
Tags:
models. This is not a deployment check.Reports: The API serializer of a registered sample or measurement type has no writable field for a field the model requires. A field is required when it is editable, has no default and may be neither blank nor null. A field the serializer marks read-only counts as left out. The message names the type and the field, and no record of the type can be created through the API.
Fix: Add the field to
serializer_fieldsorfieldsin the type’s registration, or to the serializer the registration names. See Model configuration.
fairdm.W601: the number of proxies in front of the API is not set#
Severity: Warning.
Tags:
security,deploy. This check never stops the portal from starting.Reports:
REST_FRAMEWORKhas noNUM_PROXIESkey. The API then takes a caller’s address from theX-Forwarded-Forheader, which the caller writes. Any value you set silences the warning,0andNoneincluded.Fix: Set the number of proxies between the visitor and the portal, or
0when there is none. See How to count API callers behind a proxy.
REST_FRAMEWORK["NUM_PROXIES"] = 1
fairdm.E700: no backup public key is set#
Severity: Error.
Tags:
security,deploy,production_critical.Reports:
BACKUP_PUBLIC_KEYis empty. A production portal does not write unencrypted backups, so it does not start.Fix: Set
BACKUP_PUBLIC_KEYto an armoured OpenPGP public key. See How to back up a portal.
fairdm.E701: the backup public key cannot be used#
Severity: Error.
Tags:
security,deploy,production_critical.Reports: One of these.
BACKUP_PUBLIC_KEYis not an armoured public key. The key cannot encrypt, as with a key that only signs. The value holds a private key, which the portal refuses so that it never holds the key that decrypts its backups. Orgpgis not installed, as in a custom image withoutgnupg.Fix: Export the public key with
gpg --armor --export, and setBACKUP_PUBLIC_KEYto its text. Remove a private key from the environment. In a custom image, installgnupg.
fairdm.W700: backups are kept on the local disk#
Severity: Warning.
Tags:
security.Reports: The
dbbackupstorage inSTORAGESis aFileSystemStorageand the portal runs in production. Backups on the server’s own disk are lost with the server. The check does not stop the portal starting, andmigrateprints it.Fix: Put the media on S3, so backups go to the bucket as well (see
BACKUP_S3_BUCKET_NAME), or assignSTORAGES["dbbackup"]a storage that is off the server. To keep local backups on purpose, for example on a volume that is itself backed up, addfairdm.W700toSILENCED_SYSTEM_CHECKS.
What you can do with the checks#
Run them. See How to run the configuration checks.
Hide one from the report. See How to silence a configuration check.
Fix a portal that stops at start-up. See How to fix a portal that refuses to start in production.