Skip to content

Deploying a MintHCM App

Introduction

MintHCM is an open-source human capital management platform built on PHP. Deploying MintHCM with a Dockerfile on Klutch.sh delivers reproducible builds, managed secrets, and persistent storage for configs and uploads—all configured from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, sample API usage, and production tips.


Prerequisites

  • A Klutch.sh account (sign up)
  • A GitHub repository containing your MintHCM code and Dockerfile (GitHub is the only supported git source)
  • A MySQL/MariaDB database (deploy as a Klutch.sh TCP app on port 8000 and connect on 3306)
  • SMTP credentials for outbound emails/notifications
  • Domain ready for your MintHCM instance

For onboarding, see the Quick Start.


Architecture and ports

  • MintHCM runs on PHP/Apache; set the internal container port to 8080 and choose HTTP traffic.
  • Database runs separately on TCP; connect on 3306.
  • Persistent storage is required for configuration, cache, and uploads.

Repository layout

minthcm/
├── Dockerfile # Must be at repo root for auto-detection
├── config/ # MintHCM configs (persist)
├── cache/ # Cache (persist recommended)
├── upload/ # User uploads (persist)
└── README.md

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


Installation (local) and starter commands

Validate locally before pushing to GitHub:

Terminal window
docker build -t minthcm-local .
docker run -p 8080:8080 --env-file .env minthcm-local

Dockerfile for MintHCM (production-ready)

Place this Dockerfile at the repo root; Klutch.sh auto-detects it (no Docker selection in the UI):

FROM php:8.1-apache
ENV APACHE_HTTP_PORT_NUMBER=8080
WORKDIR /var/www/html
RUN apt-get update && apt-get install -y --no-install-recommends \
libpng-dev libjpeg-dev libonig-dev libzip-dev unzip git && \
docker-php-ext-configure gd --with-jpeg && \
docker-php-ext-install gd mysqli zip && \
a2enmod rewrite && \
sed -i 's/80/${APACHE_HTTP_PORT_NUMBER}/g' /etc/apache2/ports.conf /etc/apache2/sites-available/000-default.conf && \
rm -rf /var/lib/apt/lists/*
COPY . .
RUN chown -R www-data:www-data /var/www/html && \
mkdir -p config cache upload && \
chown -R www-data:www-data config cache upload
EXPOSE 8080
CMD ["apache2-foreground"]

Notes:

  • Add more PHP extensions if your plugins require them (e.g., ldap, imap).
  • Keep config/, cache/, and upload/ writable; mount them as volumes.

Environment variables (Klutch.sh)

Set these in Klutch.sh before deploying:

  • DB_HOST=<db-host>
  • DB_PORT=3306
  • DB_NAME=<db-name>
  • DB_USER=<db-user>
  • DB_PASSWORD=<db-password>
  • MINT_SITE_URL=https://example-app.klutch.sh
  • APACHE_HTTP_PORT_NUMBER=8080
  • SMTP: SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASSWORD, SMTP_FROM

If you deploy without the Dockerfile and need Nixpacks overrides (PHP):

  • NIXPACKS_PHP_VERSION=8.1
  • NIXPACKS_START_CMD=apache2-foreground

Attach persistent volumes

In Klutch.sh storage settings, add mount paths and sizes (no names required):

  • /var/www/html/config — application configuration.
  • /var/www/html/cache — cache (improves performance).
  • /var/www/html/upload — user uploads and attachments.

Ensure these directories are writable.


Deploy MintHCM 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 8080.
  4. Add the environment variables above, including database and SMTP settings.
  5. Attach persistent volumes for /var/www/html/config, /var/www/html/cache, and /var/www/html/upload with sizes matching your data and attachment needs.
  6. Deploy. Complete the MintHCM web installer at https://example-app.klutch.sh and connect to your database.

Sample API usage

If you enable REST API, list users (adjust endpoint/token as configured):

Terminal window
curl -X GET "https://example-app.klutch.sh/api/v1/users" \
-H "Authorization: Bearer <token>"

Health checks and production tips

  • Add an HTTP probe to / or a lightweight status route once configured.
  • Enforce HTTPS at the edge; forward internally to port 8080.
  • Keep PHP and MintHCM updated; test upgrades in staging first.
  • Monitor database connections and storage; resize volumes before they fill.
  • Store secrets only in Klutch.sh and rotate them regularly.

MintHCM on Klutch.sh combines reproducible Docker builds with managed secrets, persistent storage, and flexible HTTP/TCP routing. With the Dockerfile at the repo root, port 8080 configured, and MySQL/MariaDB connected, you can deliver a reliable HCM platform without extra YAML or workflow overhead.