Skip to content

Deploying a Snipe-IT App

Introduction

Snipe-IT is an open-source asset management system built on Laravel. Deploying Snipe-IT with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage—all configured from klutch.sh/app. This guide covers installation, Dockerfile setup, environment variables, storage, Nixpacks overrides, and sample checks to verify your deployment.


Prerequisites

  • A Klutch.sh account (sign up)
  • A GitHub repository containing your Snipe-IT Dockerfile (GitHub is the only supported git source)
  • External MySQL/MariaDB database
  • Domain and TLS for secure access

For onboarding, see the Quick Start.


Architecture and ports

  • Snipe-IT serves HTTP on internal port 80 in the official image. Choose HTTP traffic and set the internal port to 80.
  • Persistent storage is required for uploads, logs, and config caches; primary data resides in MySQL/MariaDB.

Repository layout

snipe-it/
├── Dockerfile # Must be at repo root for auto-detection
└── README.md

Keep secrets out of Git; store them in Klutch.sh environment variables.


Installation (local) and starter commands

Build and run locally (ensure MySQL is reachable):

Terminal window
docker build -t snipeit-local .
docker run -p 8080:80 \
-e APP_URL=http://localhost:8080 \
-e DB_CONNECTION=mysql \
-e DB_HOST=localhost \
-e DB_DATABASE=snipeit \
-e DB_USERNAME=snipeit \
-e DB_PASSWORD=changeme \
snipeit-local

Dockerfile for Snipe-IT (production-ready)

Place this at the repo root; Klutch.sh auto-detects Dockerfiles.

FROM snipe/snipe-it:latest
ENV APP_URL=http://localhost:8080
ENV DB_CONNECTION=mysql
EXPOSE 80
CMD ["/bin/bash", "-lc", "apache2-foreground"]

Notes:

  • Pin to a specific tag (e.g., snipe/snipe-it:v6.1.0) for stability.
  • Apache serves the app on port 80 inside the container.

Environment variables (Klutch.sh)

Set these before deploying:

  • PORT=80
  • APP_URL=https://example-app.klutch.sh
  • Database:
    • DB_CONNECTION=mysql
    • DB_HOST=<db-host>
    • DB_PORT=3306
    • DB_DATABASE=<db-name>
    • DB_USERNAME=<db-user>
    • DB_PASSWORD=<db-password>
  • App settings:
    • APP_KEY=<secure-key> (generate via php artisan key:generate locally)
    • APP_DEBUG=false
  • Optional mail settings: MAIL_HOST, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD, MAIL_ENCRYPTION, MAIL_FROM_ADDRESS, MAIL_FROM_NAME

If deploying without the Dockerfile and relying on Nixpacks:

  • NIXPACKS_START_CMD=apache2-foreground

Attach persistent volumes

Add storage in Klutch.sh (path and size only):

  • /var/lib/snipeit — uploads and app-generated files.
  • /var/www/html/storage — Laravel storage (logs/cache).

Ensure paths are writable inside the container.


Deploy Snipe-IT on Klutch.sh (Dockerfile workflow)

  1. Push your repository—with the Dockerfile at the root—to GitHub.
  2. Open klutch.sh/app, create a project, and add an app.
  3. Select HTTP traffic and set the internal port to 80.
  4. Add the environment variables above (database, app key, mail settings as needed).
  5. Attach volumes at /var/lib/snipeit and /var/www/html/storage sized for your uploads and logs.
  6. Deploy. Access your app at https://example-app.klutch.sh and finish setup in the UI.

Sample checks

Landing page:

Terminal window
curl -I https://example-app.klutch.sh

If a health endpoint exists (replace if different):

Terminal window
curl -I https://example-app.klutch.sh/health

Health checks and production tips

  • Add an HTTP readiness probe to / or your health endpoint.
  • Keep DB and mail credentials plus APP_KEY in Klutch.sh secrets; rotate regularly.
  • Pin image versions and test upgrades in staging before production rollout.
  • Back up MySQL and the volumes /var/lib/snipeit and /var/www/html/storage regularly.

Snipe-IT on Klutch.sh delivers reproducible Docker builds, managed secrets, and persistent storage—without extra YAML or CI steps. Configure ports, env vars, and volumes, then launch your asset management platform.