diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..11cbc4f --- /dev/null +++ b/.env.example @@ -0,0 +1,17 @@ +# Your short URL domain (e.g. s.example.com) +DEFAULT_DOMAIN=s.example.com + +# Set to false if running without TLS termination +IS_HTTPS_ENABLED=true + +# Database +DB_NAME=shlink +DB_USER=shlink +DB_PASSWORD=change_me_strong_password + +# Generate a UUID or random string for the initial API key +# e.g.: openssl rand -hex 32 +INITIAL_API_KEY=change_me_api_key + +# Timezone (https://www.php.net/manual/en/timezones.php) +TIMEZONE=UTC diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/README.md b/README.md index e69de29..15c1884 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,18 @@ +# Shlink — self-hosted URL shortener + +Deployed on [Coolify](https://coolify.io) via Docker Compose. + +## Coolify setup + +1. Create a new resource → **Docker Compose** → point to this repo. +2. In the Coolify environment variables UI, set the values from `.env.example`: + - `DEFAULT_DOMAIN` — your short URL domain (e.g. `s.example.com`) + - `DB_PASSWORD` — strong random password + - `INITIAL_API_KEY` — initial API key (`openssl rand -hex 32`) + - `TIMEZONE` — your timezone +3. Add a domain in Coolify pointing to port `8080`. +4. Deploy. + +## Shlink Web UI + +Optionally connect [shlink-web-client](https://app.shlink.io) to your instance using your domain and API key. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1554978 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,38 @@ +services: + shlink: + image: shlinkio/shlink:stable + restart: unless-stopped + environment: + DEFAULT_DOMAIN: ${DEFAULT_DOMAIN} + IS_HTTPS_ENABLED: ${IS_HTTPS_ENABLED:-true} + DB_DRIVER: postgres + DB_HOST: db + DB_PORT: 5432 + DB_NAME: ${DB_NAME:-shlink} + DB_USER: ${DB_USER:-shlink} + DB_PASSWORD: ${DB_PASSWORD} + INITIAL_API_KEY: ${INITIAL_API_KEY} + TIMEZONE: ${TIMEZONE:-UTC} + depends_on: + db: + condition: service_healthy + ports: + - "8080:8080" + + db: + image: postgres:16-alpine + restart: unless-stopped + environment: + POSTGRES_DB: ${DB_NAME:-shlink} + POSTGRES_USER: ${DB_USER:-shlink} + POSTGRES_PASSWORD: ${DB_PASSWORD} + volumes: + - db_data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-shlink} -d ${DB_NAME:-shlink}"] + interval: 5s + timeout: 5s + retries: 10 + +volumes: + db_data: