diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..6944478 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,46 @@ +services: + shlink_server: + image: shlinkio/shlink:stable + container_name: shlink_server + restart: unless-stopped + env_file: + - .env + networks: + - proxy + - backend + ports: + - "${SHLINK_PORT}:8080" + security_opt: + - no-new-privileges:true + + shlink_postgres: + image: postgres/postgres:17-alpine + container_name: shlink_postgres + user: ${DB_USER_UID}:${DB_USER_GID} + environment: + POSTGRES_PASSWORD: ${DB_PASSWORD} + POSTGRES_USER: ${DB_USER} + POSTGRES_DB: ${DB_NAME} + volumes: + - postgres_data:/var/lib/postgresql/data + - /etc/passwd:/etc/passwd:ro + networks: + - backend + security_opt: + - no-new-privileges:true + +networks: + proxy: + external: true + backend: + external: true + +volumes: + postgres_data: + driver: local + driver_opts: + type: nfs + o: "addr=${NFS_ADDR},nolock,soft,rw" + device: ${DB_LOCATION} + labels: + dev.housh.description: "Shlink postgres database volume." diff --git a/example.env b/example.env new file mode 100644 index 0000000..57fb641 --- /dev/null +++ b/example.env @@ -0,0 +1,22 @@ +# Shlink variables +DEFAULT_DOMAIN=l.housh.dev +IS_HTTPS_ENABLED=true +GEOLITE_LICENSE_KEY="super-secret-key" +DB_DRIVER=postgres + +# Database variables +DB_HOST=shlink_postgres +DB_NAME=shlink +DB_USER=shlink +DB_PASSWORD="super-secret" +DB_PORT=5432 +# Set these to owner of the database volume. +# These also need to be in /etc/passwd of the host for +# postgres to startup correctly. +DB_USER_UID=1000 +DB_USER_GID=1000 + +# Other custom variables. +SHLINK_PORT=8880 +DB_LOCATION=":/var/nfs/shared/" +NFS_ADDR=nas.local