Skip to content

Deploying an OJS App

Introduction

Open Journal Systems (OJS) is an open-source platform for managing and publishing scholarly journals. Deploying OJS with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage for uploads, cache, and configuration—all managed from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, sample usage, and production tips.


Prerequisites

  • A Klutch.sh account (sign up)
  • A GitHub repository containing your OJS 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 email notifications
  • Domain and TLS for secure access

For onboarding, see the Quick Start.


Architecture and ports

  • OJS 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 public files, cache, and config.

Repository layout

ojs/
├── Dockerfile # Must be at repo root for auto-detection
├── config.inc.php # Generated/edited; keep secrets out of Git
├── public/ # Public assets (persist)
├── cache/ # Cache (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 ojs-local .
docker run -p 8080:8080 --env-file .env ojs-local

Dockerfile for OJS (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 libzip-dev libxml2-dev libicu-dev git unzip \
&& docker-php-ext-configure gd --with-jpeg \
&& docker-php-ext-install gd mysqli zip intl xmlrpc soap opcache \
&& 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 mkdir -p cache public && chown -R www-data:www-data /var/www/html
EXPOSE 8080
CMD ["apache2-foreground"]

Notes:

  • Add any extra PHP extensions needed by your plugins.
  • Keep public/ and cache/ writable; mount them as volumes.

Environment variables (Klutch.sh)

Set these in Klutch.sh before deploying:

  • OJS_BASE_URL=https://example-app.klutch.sh
  • DB_HOST=<db-host>
  • DB_PORT=3306
  • DB_NAME=<db-name>
  • DB_USER=<db-user>
  • DB_PASSWORD=<db-password>
  • DB_DRIVER=mysqli
  • APACHE_HTTP_PORT_NUMBER=8080
  • SMTP: SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASSWORD, SMTP_SECURE (e.g., tls)

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/cache — cache.
  • /var/www/html/public — public files and uploads.
  • /var/www/html/config.inc.php — configuration (optionally keep outside the image).

Ensure these paths are writable inside the container.


Deploy OJS 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/cache, /var/www/html/public, and optionally /var/www/html/config.inc.php sized for your cache and assets.
  6. Deploy. Complete the OJS web installer at https://example-app.klutch.sh and connect to your database.

Sample usage

Check reachability:

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

After setup, you can manage journals, issues, and submissions via the web UI.


Health checks and production tips

  • Add an HTTP probe to / or a lightweight status page once configured.
  • Enforce HTTPS at the edge; forward internally to port 8080.
  • Keep DB and SMTP credentials in Klutch.sh secrets; rotate them regularly.
  • Monitor storage usage on public/ and cache/; resize volumes before they fill.
  • Pin image versions and test upgrades in staging before production.

OJS 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 publish and manage journals without extra YAML or workflow overhead.