refactor: rewrite yourls_dev to match template conventions

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
code
2026-07-15 02:39:22 +00:00
co-authored by Claude Fable 5
parent 60ce765aa2
commit b542905f31
5 changed files with 135 additions and 45 deletions
+67
View File
@@ -0,0 +1,67 @@
# YOURLS
## Overview
YOURLS (Your Own URL Shortener) is a self-hosted URL shortener with
link statistics, a bookmarklet, and a plugin API. This stack runs
YOURLS with a MariaDB database.
## Project Details
- **Project Repository:** [github.com/YOURLS/YOURLS](https://github.com/YOURLS/YOURLS)
- **Container Image:** [Docker Hub](https://hub.docker.com/_/yourls)
- **Documentation:** [yourls.org](https://yourls.org/)
- **Reverse Proxy Port:** `80`
## Getting Started
1. Copy `sample.env` and set `YOURLS_SITE`, the admin login, and the
database passwords
2. Start the containers: `docker compose up -d`
3. Open http://localhost:8080/admin/ in your browser and run the
install step, then sign in with `YOURLS_USER` / `YOURLS_PASS`
## Environment Variable Notes
YOURLS_SITE public base URL used in generated short links; must
match how users reach the site (domain behind the proxy)
YOURLS_USER / YOURLS_PASS admin login for the /admin/ interface
YOURLS_DB_NAME / YOURLS_DB_USER / YOURLS_DB_PASSWORD database
name and credentials, shared by both services
YOURLS_MYSQL_ROOT_PASSWORD MariaDB root password
YOURLS_PORT host port for the web UI (default 8080)
## Volume Notes
- `/var/www/html` — YOURLS application files and plugins; stored at
`${VOL_PATH:-/data}/yourls/html` on the host
- `/var/lib/mysql` — MariaDB data; stored at
`${VOL_PATH:-/data}/yourls/db` on the host
## Network Notes
Requires proxy network. The database is only attached to the stack's
`internal` network.
## Docker Run
Not recommended — YOURLS needs its MariaDB companion. Use the compose
file.
## Additional Notes / Gotchas
- This is a `_dev` stack — experimental, not yet production-ready.
- The admin interface is at `/admin/`, not the site root.
- Changing `YOURLS_SITE` after install does not rewrite existing
short links; set it correctly before creating links.
## Dockhand Stack, Deploy from Git
- Cookbooks Repository
- stackname: yourls_dev
- Compose file path: yourls_dev/compose.yaml
- Additional env file (optional): yourls_dev/sample.env
Then "Load" yourls_dev/sample.env into the Environment variables in dockhand.
Create the Stack
+50
View File
@@ -0,0 +1,50 @@
# YOURLS URL Shortener
services:
yourls:
image: ${YOURLS_IMAGE:-yourls:latest}
restart: ${YOURLS_RESTART:-unless-stopped}
volumes:
- ${VOL_PATH:-/data}/yourls/html:/var/www/html
environment:
- YOURLS_DB_HOST=yourls-db
- YOURLS_DB_USER=${YOURLS_DB_USER:-yourls}
- YOURLS_DB_PASS=${YOURLS_DB_PASSWORD:-changeme}
- YOURLS_DB_NAME=${YOURLS_DB_NAME:-yourls}
- YOURLS_SITE=${YOURLS_SITE:-http://localhost:8080}
- YOURLS_USER=${YOURLS_USER:-admin}
- YOURLS_PASS=${YOURLS_PASS:-changeme}
ports:
- "${YOURLS_PORT:-8080}:80"
networks:
- proxy
- internal
depends_on:
- yourls-db
yourls-db:
image: ${MARIADB_IMAGE:-mariadb:11}
restart: ${YOURLS_RESTART:-unless-stopped}
volumes:
- ${VOL_PATH:-/data}/yourls/db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=${YOURLS_MYSQL_ROOT_PASSWORD:-changeme-root}
- MYSQL_DATABASE=${YOURLS_DB_NAME:-yourls}
- MYSQL_USER=${YOURLS_DB_USER:-yourls}
- MYSQL_PASSWORD=${YOURLS_DB_PASSWORD:-changeme}
networks:
- internal
networks:
proxy:
external: true
internal:
driver: bridge
-33
View File
@@ -1,33 +0,0 @@
services:
yourls-db:
# https://hub.docker.com/_/mariadb/
image: mariadb:${DB_V}
restart: always
volumes:
- ${VOL_PATH:-./data}/yourls-db:/var/lib/mysql
networks:
- yourls-net
environment:
MYSQL_ROOT_PASSWORD: ${YOURLS_MYSQL_ROOT_PASSWORD}
MYSQL_PASSWORD: ${YOURLS_MYSQL_PASSWORD}
MYSQL_DATABASE: db_yourls
MYSQL_USER: yourls
yourls:
# reference: https://github.com/matomo-org/docker/blob/master/.examples/docker-compose.yml
image: yourls
restart: always
volumes:
- ${VOL_PATH:-./data}/yourls:/var/www/html
networks:
- yourls-net
- proxy
environment:
YOURLS_DB_HOST: ${PREFIX}_yourls-db_1
YOURLS_DB_USER: yourls
YOURLS_DB_PASS: ${YOURLS_MYSQL_PASSWORD}
YOURLS_DB_NAME: db_yourls
YOURLS_SITE: https://${YOURLS_DOMAIN_NAME}
YOURLS_USER: ${YOURLS_USER}
YOURLS_PASS: ${YOURLS_PASS}
-12
View File
@@ -1,12 +0,0 @@
# Domains & Project
PREFIX=p1
YOURLS_DOMAIN_NAME=yourls.nickyeoman.com
# Passwords
YOURLS_MYSQL_ROOT_PASSWORD=ChangeMe2ASecurepass!
YOURLS_MYSQL_PASSWORD=Again2ASecurepass!
YOURLS_USER=username
YOURLS_PASS=Password4urls
# Software versions
DB_V=10.4.11
+18
View File
@@ -0,0 +1,18 @@
YOURLS_IMAGE=yourls:latest
MARIADB_IMAGE=mariadb:11
YOURLS_RESTART=unless-stopped
VOL_PATH=/data
YOURLS_PORT=8080
# Site URL (public URL used in generated short links)
YOURLS_SITE=http://localhost:8080
# Admin login
YOURLS_USER=admin
YOURLS_PASS=changeme
# Database
YOURLS_DB_NAME=yourls
YOURLS_DB_USER=yourls
YOURLS_DB_PASSWORD=changeme
YOURLS_MYSQL_ROOT_PASSWORD=changeme-root