Install Legend
Legend runs as a Docker container with minimal resource requirements, and ships with an optional update agent container that powers in-app “Check for Updates”. Choose the installation method that matches your comfort level and infrastructure.
Prerequisites
Section titled “Prerequisites”Before installing, ensure you have:
- Operating system: Linux, macOS, or Windows with Docker support
- Docker: Version 20.10 or later (the install script handles this on Linux)
- Docker Compose: Version 2.0 or later (the install script handles this on Linux)
- Resources: 512MB RAM, 512MB disk space, 1 CPU core
- Network: Port 3000 available (or choose a different port during setup)
- Outbound connectivity: Required for license validation
Installation Methods
Section titled “Installation Methods”The install script is the recommended method for Linux users. It handles Docker installation, configuration, and deployment automatically.
Run the Install Script
Section titled “Run the Install Script”curl -fsSL https://mylegend.io/install-legend.sh | bash- Check requirements: The script verifies curl, openssl, Docker, and Docker Compose are available. If Docker is missing, it offers to install it.
- Interactive configuration: You are prompted for installation directory (default
/opt/legend), host port (default 3000), optional domain or FQDN, storage type, and backup settings. - Generate secrets: A secure 64-character session secret is created using
openssl rand -hex 32. - Create configuration: The script writes
.envanddocker-compose.ymlfiles with your settings. - Pull and start: The Legend Docker image is pulled and the container starts.
- Deploy the update agent: A small companion container is started alongside Legend to power in-app “Check for Updates”. It communicates with the Legend app over a shared Unix socket.
- Health check: The script verifies the container is running and displays the access URL.
Storage Options
Section titled “Storage Options”During installation, you choose between two storage configurations:
Single directory (recommended for most users): All data, including the SQLite database and YAML catalog, is stored in one location. This is simplest to manage and back up.
Separate storage: The YAML catalog is stored on an NFS or SMB mount, while the SQLite database remains on local SSD. This provides better performance for the database while allowing the catalog to be shared or version controlled.
Non-Interactive Mode
Section titled “Non-Interactive Mode”For automated deployments, set environment variables before running the script:
export LEGEND_INSTALL_DIR=/opt/legendexport LEGEND_HOST_PORT=3000export LEGEND_DOMAIN=legend.example.comexport LEGEND_STORAGE_TYPE=singleexport LEGEND_ENABLE_BACKUPS=true
curl -fsSL https://mylegend.io/install-legend.sh | bashAvailable environment variables:
LEGEND_INSTALL_DIR: Installation directory (default:/opt/legend)LEGEND_HOST_PORT: Host port to expose (default: 3000)LEGEND_DOMAIN: Optional domain or FQDNLEGEND_STORAGE_TYPE:singleorseparate(default:single)LEGEND_DATA_DIR: Path for YAML catalog (used withseparatestorage)LEGEND_DB_DIR: Path for SQLite database (used withseparatestorage)LEGEND_ENABLE_BACKUPS: Enable automated backups (default:true)LEGEND_UPDATE_AGENT_IMAGE: Update agent image reference (default:legendapp/legend-update-agent:latest)
Docker Compose is ideal if you are comfortable with Docker and want explicit control over the configuration.
-
Create a directory for Legend:
Terminal window mkdir legend && cd legend -
Generate a session secret:
Terminal window openssl rand -hex 32Copy the output. You need this 64-character string for the next step.
-
Create a
.envfile:Terminal window cat > .env << EOFLEGEND_SESSION_SECRET=your-64-character-secret-hereLEGEND_PUBLIC_APP_URL=http://localhost:3000LEGEND_DATA_DIR=/app/dataLEGEND_DB_DIR=/app/dataLEGEND_DB_FILENAME=legend.dbLEGEND_PUBLIC_ENABLE_BACKUPS=trueLEGEND_BACKUP_MAX_AGE_DAYS=30LEGEND_BACKUP_MIN_BACKUPS=5LEGEND_BACKUP_MAX_BACKUPS=100EOFReplace
your-64-character-secret-herewith the secret you generated. UpdateLEGEND_PUBLIC_APP_URLif you are using a domain or different port. -
Prepare the update agent socket directory:
Terminal window sudo mkdir -p /etc/legend /var/run/legend-updateecho "$(pwd)" | sudo tee /etc/legend/install-path > /dev/null -
Create
docker-compose.yml:Terminal window cat > docker-compose.yml << EOFservices:legend:image: legendapp/legend:latestcontainer_name: legendports:- "3000:3000"volumes:- ./data:/app/data- /var/run/legend-update:/var/run/legend-updateenv_file:- .envsecurity_opt:- no-new-privileges:truerestart: unless-stoppedEOF -
Create
docker-compose.update-agent.yml:Terminal window cat > docker-compose.update-agent.yml << EOFservices:legend-update-agent:image: legendapp/legend-update-agent:latestcontainer_name: legend-update-agentvolumes:- /var/run/docker.sock:/var/run/docker.sock:ro- /var/run/legend-update:/var/run/legend-update- /etc/legend/install-path:/etc/legend/install-path:roenvironment:- LEGEND_UPDATE_IMAGE=legendapp/legend:latestsecurity_opt:- no-new-privileges:truerestart: unless-stoppedEOF -
Create the data directory:
Terminal window mkdir data -
Start Legend and the update agent:
Terminal window docker compose up -ddocker compose -f docker-compose.update-agent.yml up -d -
Verify the installation:
Terminal window docker compose pscurl http://localhost:3000You should see the Legend login page.
For minimal setups or testing, use a single docker run command.
-
Generate a session secret:
Terminal window openssl rand -hex 32 -
Create a data directory:
Terminal window mkdir -p legend-data -
Prepare the update agent socket directory:
Terminal window sudo mkdir -p /etc/legend /var/run/legend-updateecho "$(pwd)" | sudo tee /etc/legend/install-path > /dev/null -
Run the container:
Terminal window docker run -d \--name legend \-p 3000:3000 \-v $(pwd)/legend-data:/app/data \-v /var/run/legend-update:/var/run/legend-update \-e LEGEND_SESSION_SECRET=your-64-character-secret-here \-e LEGEND_PUBLIC_APP_URL=http://localhost:3000 \-e LEGEND_PUBLIC_ENABLE_BACKUPS=true \--security-opt no-new-privileges:true \--restart unless-stopped \legendapp/legend:latestReplace
your-64-character-secret-herewith the secret you generated. -
Run the update agent (optional):
Terminal window docker run -d \--name legend-update-agent \-v /var/run/docker.sock:/var/run/docker.sock:ro \-v /var/run/legend-update:/var/run/legend-update \-v /etc/legend/install-path:/etc/legend/install-path:ro \-e LEGEND_UPDATE_IMAGE=legendapp/legend:latest \--security-opt no-new-privileges:true \--restart unless-stopped \legendapp/legend-update-agent:latest -
Verify the installation:
Terminal window docker pscurl http://localhost:3000
Environment Variables Reference
Section titled “Environment Variables Reference”All installation methods use the same environment variables. Here is what each one does:
| Variable | Required | Default | Description |
|---|---|---|---|
LEGEND_SESSION_SECRET |
Yes | None | 64-character hex string for JWT signing and encryption. Generate with openssl rand -hex 32. |
LEGEND_PUBLIC_APP_URL |
No | http://localhost:3000 |
The URL where Legend is accessible. Used for links and redirects. |
LEGEND_DATA_DIR |
No | /app/data |
Path inside the container for YAML catalog, documentation, and branding. |
LEGEND_DB_DIR |
No | /app/data |
Path inside the container for the SQLite database. Separate from LEGEND_DATA_DIR for performance. |
LEGEND_DB_FILENAME |
No | legend.db |
SQLite database filename. |
LEGEND_PUBLIC_ENABLE_BACKUPS |
No | true |
Enable automated daily backups at 2 AM. |
LEGEND_BACKUP_MAX_AGE_DAYS |
No | 30 |
Delete backups older than this many days. |
LEGEND_BACKUP_MIN_BACKUPS |
No | 5 |
Always keep at least this many backups, even if older than max age. |
LEGEND_BACKUP_MAX_BACKUPS |
No | 100 |
Maximum number of backups to retain. |
LEGEND_LICENSE_SERVER_URL |
No | https://mylegend.io |
License server URL. Only change if using a custom license server. |
LEGEND_UPDATE_AGENT_IMAGE |
No | legendapp/legend-update-agent:latest |
Update agent image reference used by the install script. Only change if you mirror the agent image. |
Verify the Installation
Section titled “Verify the Installation”After installation, verify Legend is running:
-
Check the container:
Terminal window docker ps | grep legendYou should see the Legend container running.
-
Access the web interface: Open your browser and navigate to
http://localhost:3000(or your configured domain). -
Complete the setup wizard: On first visit, you are redirected to the setup wizard where you create the initial administrator account.
Update Legend
Section titled “Update Legend”To update Legend to the latest version, use the methods below. See Updates and Version Management for the complete update guide, including managed hosting behavior.
In-App Updates (Recommended)
Section titled “In-App Updates (Recommended)”If you deployed the update agent (install script does this automatically), use the Check for Updates button in the Admin panel. Legend asks the update agent to pull the latest image, recreate the container preserving your configuration, and verify health. If the update fails, the agent rolls back to the previous image automatically.
Manual Updates
Section titled “Manual Updates”cd /opt/legenddocker compose pulldocker compose up -dcd legenddocker compose pulldocker compose up -ddocker stop legenddocker rm legenddocker run -d \ --name legend \ -p 3000:3000 \ -v $(pwd)/legend-data:/app/data \ -v /var/run/legend-update:/var/run/legend-update \ -e LEGEND_SESSION_SECRET=your-64-character-secret-here \ -e LEGEND_PUBLIC_APP_URL=http://localhost:3000 \ --security-opt no-new-privileges:true \ --restart unless-stopped \ legendapp/legend:latestYour data is persisted in the mounted volume, so updates do not affect your configuration or entities.