Self-host YOURLS with Levelrail

A self-hosted URL shortener with custom keywords, click statistics and a plugin system. Runs with a bundled MariaDB database. The admin login is the user and password you set in the install form.

  • AuthorYOURLS
  • LicenceMIT
  • Memory256 MiB
  • Archarm64
  • Services2

Needs setup: set YOURLS_PASS before the first start.

How to self-host YOURLS

  1. Pull the images

    2 images are pulled on your server.

    Show images
    • mariadb:11.8.9
    • yourls:1.10.6
  2. Create the app

    2 services start in a single Compose app, with 1 named volume mount for your data, on port 8080.

  3. Fill in the secrets

    3 secrets are generated and stored encrypted, 7 settings are preset, you provide 1 value.

  4. Open it

    Without a domain the app gets an sslip.io address; add --domain SERVICE=HOST to use your own.

After the first start

  • Open /admin/install.php on the app address and click Install YOURLS once.
  • Sign in at /admin/ with the user and password from the install form.

YOURLS requirements

Memory
About 256 MiB
Architectures
amd64 image published, arm64 image published
Ports
8080
Domain
Optional, an sslip.io address is used without one
Settings
1 to fill in
License
MIT, permissive license
  • Listed. It is in the catalog but not verified. Back up the data volume before changing an image tag.

Install Levelrail first

On a server with Levelrail running, run the command above, or open the dashboard: Apps, New app, Browse templates, then YOURLS. New to Levelrail? Install it on a fresh VPS first.

docker pull ghcr.io/glincker/levelrail:latest

Then levelrail-cli login --device. See Getting started and the YOURLS docs page.

Deploy YOURLS your way

Every format below deploys the same pinned images. Pick the one that fits how you work.

Deploy YOURLS from the CLI

Add --domain SERVICE=HOST to serve a service on your own domain, for example --domain db=app.example.com.

levelrail-cli templates install yourls --name my-yourls --env YOURLS_PASS=VALUE

Deploy YOURLS with the API

Create a token in the dashboard first. Name, env and domains are the request fields.

curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  https://levelrail.example.com/api/v1/service-templates/yourls/install \
  -d '{
    "name": "my-yourls",
    "env": { "YOURLS_PASS": "VALUE" }
  }'

YOURLS configuration

YOURLS services

ServiceImagePortsVolumes
db mariadb:11.8.9 none dbdata -> /var/lib/mysql
yourls yourls:1.10.6 8080 none

YOURLS environment variables

VariableServiceValue
MARIADB_DATABASE db Preset by the template
MARIADB_PASSWORD db Generated at deploy
MARIADB_ROOT_PASSWORD db Generated at deploy
MARIADB_USER db Preset by the template
YOURLS_DB_HOST yourls Preset by the template
YOURLS_DB_NAME yourls Preset by the template
YOURLS_DB_PASS yourls Generated at deploy
YOURLS_DB_USER yourls Preset by the template
Show all 11 variables
  • YOURLS_PASSyourlsYou must set this
  • YOURLS_SITEyourlsPreset by the template
  • YOURLS_USERyourlsPreset by the template

Ports and volumes

Ports
8080
Volumes
1 named mount: dbdata -> /var/lib/mysql

YOURLS FAQ

How much memory does YOURLS need?

The catalog lists about 256 MiB of memory for YOURLS across its 2 services.

Does YOURLS run on arm64?

For YOURLS, an arm64 image is published; amd64 is image published.

What licence is YOURLS under?

YOURLS is licensed under MIT, which is permissive, with few conditions on reuse.

Does YOURLS need configuration before it starts?

Yes. YOURLS has required settings: YOURLS_PASS.

Which database does YOURLS bundle?

The template includes MySQL, running as its own service.

Which ports does YOURLS use?

YOURLS listens on port 8080 inside the stack.

Where does YOURLS keep its data?

In a named volume: dbdata mounted at /var/lib/mysql.

Can I deploy YOURLS on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list has an entry with the id yourls for this app, so check that entry as well. Dokku deploys container images with its own commands, so the pinned image mariadb:11.8.9, yourls:1.10.6 is what you deploy there.

levelrail-cli templates install yourls --name my-yourls --env YOURLS_PASS=VALUE