php-sso php-sso

Run with Docker

The published image is the way to run php-sso.

docker run -d --name sso -p 8080:8080 \
  -v sso-data:/app/var \
  -e SSO_PUBLIC_URL=https://sso.example.com \
  -e ADMIN_PASSWORD='choose-a-long-password' \
  ghcr.io/php-sso/php-sso:latest

That starts the server on port 8080. Sign in at /admin as admin with the password you gave. ADMIN_PASSWORD is only read while the database is empty: it creates the first administrator, so change the password in the admin panel afterwards.

Tags #

Every release is published as ghcr.io/php-sso/php-sso with these tags, for linux/amd64 and linux/arm64:

TagWhat it is
1.2.3Exactly that release. Use this in production, and move it on purpose
1.2The newest 1.2.x release
1The newest 1.x release (not published for the 0.x releases, where any minor may change things)
latestThe newest release

What the image expects #

  • SSO_PUBLIC_URL is the address people reach it at, and the issuer in every token. The image speaks plain HTTP: put a reverse proxy in front for HTTPS, and tell the server which proxies to believe with SSO_TRUSTED_PROXIES.
  • A volume at /app/var. It holds the SQLite database (unless you use MySQL or PostgreSQL) and the signing and encryption keys. Back it up. Without the keys, every token and every saved authenticator secret stops working. The container runs as www-data (user id 33), so a folder you mount instead of a named volume must be writable by that user: chown 33:33 ./sso-data.
  • Every other setting is an environment variable: see Production and configuration.

With a database server #

The same image, with the database in its own container:

services:
  sso:
    image: ghcr.io/php-sso/php-sso:latest
    ports: ["8080:8080"]
    environment:
      SSO_PUBLIC_URL: https://sso.example.com
      ADMIN_PASSWORD: choose-a-long-password
      SSO_DB_DRIVER: pgsql
      SSO_DB_HOST: db
      SSO_DB_NAME: sso
      SSO_DB_USER: sso
      SSO_DB_PASSWORD: choose-another-password
    volumes:
      - sso-keys:/app/var   # the keys; the data is in the database
    depends_on:
      db:
        condition: service_healthy
  db:
    image: postgres:17
    environment:
      POSTGRES_DB: sso
      POSTGRES_USER: sso
      POSTGRES_PASSWORD: choose-another-password
    volumes:
      - sso-db:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U sso -d sso"]
      interval: 3s
      retries: 20
volumes:
  sso-keys:
  sso-db:

Your own look #

Put your theme in a folder and either mount it at /theme, or build your own image from ours so that it travels with the image:

FROM ghcr.io/php-sso/php-sso:1.2.3
COPY theme /theme
docker build -t sso-acme .

What goes in the folder, and what you can change, is on the Theming page. The app skeleton is a ready-made folder to start from.

Upgrading #

Change the tag, pull and recreate the container. The volume keeps the data. SQLite databases are brought up to date when the new version starts. MySQL and PostgreSQL tables are created if missing but not altered, so read the release notes of a version before you move to it.

Edit this page on GitHub