Skip to content

Latest commit

 

History

History
80 lines (58 loc) · 2.63 KB

quickstart.md

File metadata and controls

80 lines (58 loc) · 2.63 KB

Quick Start

Deploy RickRoller

RickRoller is a Python application that can run locally or from a Docker container.

Run directly

This project is coded in Python and uses poetry. After cloning the project, run:

# install dependencies and package (to do once)
poetry install

# launch a basic Flask server (for development only)
poetry run rickroll --debug # use --debug/-d for auto-reload

Using a Docker container

The Docker image is available for download from GitHub packages (ghcr.io) and Docker Hub (docker.io). For example:

docker run --rm -p 8080:8080 derlin/rickroller:latest

If you want to build your own, clone the project and run:

docker build -t derlin/rickroller:latest .
docker run --rm -p 8080:8080 derlin/rickroller:latest

The container exposes port 8080. In case you are serving the app under a prefix, pass this environment variable to the docker container:

SCRIPT_NAME=/your-prefix

To increase the number of HTTP workers (see gunicorn: How Many Workers?), pass this environment variable:

WORKERS=3 # default to 2

Available Environment Variables

The application can be tuned using environment variables.

Security

  • APP_SECRET_KEY: The Flask Secret Key used for CSRF tokens and sessions. Default to urandom(10).
  • BEHIND_PROXY: If set to a truthy value (one of 1, t, true, yes, y case-insensitive), the app will trust and honour the X-Forwarded-* headers (up to one level). Only use it when the app runs behind a reverse proxy. See ProxyFix for more information.

Persistence

See docs/persistence.

  • DATABASE_URL: enable URL shortening feature. Empty means do not use any database,
  • CLEANUP_INTERVAL and CLEANUP_INTERVAL_UNITS: How often should we clean the database of old entries,
  • SLUG_RETENTION and SLUG_RETENTION_UNITS: How old an entry must be for it to be removed from the database,
  • MAX_URLS_PER_USER: How many URLs can the same IP create before being blocked.

Docker

  • WORKERS: number of gunicorn workers to spawn (> 1).