Repository navigation
Configuration
Application configuration is done in app/config.py. Every time the configuration file is changed, the application needs to be restarted to apply the changes.
The default configuration assumes the use of docker-compose to run the application. Changes will be required in other cases.
DEBUG = True
Debug mode allows certian things to display to the end user when something fails. Good in development, not so good in a production setting.
TESTING = True
Testing mode changes certain functionality so that unit tests can test functionality properly. One signiciant part of this is that mail is not sent. Disable when in an environment where you're testing actual functionality, not a controlled unit test function.
JINJA_AUTO_RELOAD = True
Automatically reload templates without restarting the application. You probably don't need this in production.
PREFERRED_URL_SCHEME = 'https'
Prefer to use https over http
BCRYPT_WORK_FACTOR = 12
The application uses bcrypt hashing, which can be configured to run longer or shorter depending on the work factor. A sensible and recommended default is 12, but this can be raised to have a longer generation period.
PERMANENT_SESSION_LIFETIME = datetime.timedelta(days=365)
Length of a "permanent" session. Doesn't matter too much if the secret key is regenerated on each restart.
SECRET_KEY = rand_str(32)
The secret key used for various things. With it being reset every time the application runs, all sessions will be invalidated.
SESSION_COOKIE_NAME = 'coyotelab'
The name of the cookie to be set.
SESSION_KEY_BITS = 256
Size of the random integer used to create session IDs.
SESSION_STORE = RedisStore(redis.StrictRedis())
The session store information for the application. I like using Redis for this. Deleting this key will fall back to Flask's default session handler.
SQLALCHEMY_TRACK_MODIFICATIONS = False
Disables the modification tracking system built into the Flask-SQLAlchemy extension for performance (since we don't use the event system at all).
SQLALCHEMY_DATABASE_URI = 'postgresql://dbuser:dbuser@localhost/db'
This is the database URI to connect to. This needs to be a connection URI that SQLAlchemy understands. Most database systems should work.
SQLALCHEMY_POOL_SIZE = 5
The number of persisting connections that should be allowed. This can be increased as needed
MAIL_DEFAULT_SENDER = 'mikekorcha@gmail.com'
MAIL_SERVER = 'smtp.gmail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USE_SSL = False
MAIL_USERNAME = ''
MAIL_PASSWORD = ''
The defaults set are to use Gmail as your SMTP server for sending email. This can be configured however you like for your needs. If you're using a standard Gmail account with Two-Factor Authentication, make sure to generate an App Password to use in place of your own.
LXD_ADDRESS = 'https://localhost:8443'
If you aren't using Docker to run the application, this parameter tells the application where to send LXD API requests.
LXD_TRUST_PASSWORD = 'lxd_password'
This is to set up a trust with the LXD API, along with the certificates generated at installation time. This should be the same as the LXD trust password you set up when you installed LXD.
LXD_LIMIT_MEMORY = '64MB'
LXD_LIMIT_CPU = '1'
These are limits that the student containers have in terms of CPU and Memory usage.
USER_COURSE_FILE_DIR = '../files/user-c{course_id}-u{user_id}/rootfs/home/coyote'
USER_CONTAINER_NAME = 'user-c{course_id}-u{user_id}'
These templates define where the user's files (within the container) are stored, and how container naming is defined for LXD. {user_id} and {course_id} are supported parameters in the templates, which correspond to a unique integer ID for the user and course, respectively.