Skip to content

Docker Compose boot files #397

@monty241

Description

@monty241

Documentation only

The following files are used to bootstrap Hypha on docker. Will be updated (edited) with improvements.

Folder Structure

ROOT=path
mkdir $ROOT
mkdir $ROOT/data
mkdir $ROOT/data/apache2
mkdir $ROOT/data/hypha

$ROOT/hypha-start

#!/bin/ksh

#
# START OF CONFIGURATION
#
GITBRANCH=koppelting
#
# END OF CONFIGURATION
#

BRANCHFOLDER=hypha-git

if [ ! -d "${BRANCHFOLDER}" ]; then
  git clone --branch koppelting https://github.com/PlanBCode/hypha.git ${BRANCHFOLDER}
else
  (cd ${BRANCHFOLDER} ; git pull .)
fi
#
# Copy base files for data folder.
#
cp -r ${BRANCHFOLDER}/data/* data/hypha

docker compose down;docker compose up -d --build
docker exec -u 0 -it hypha /bin/ksh

$ROOT/Dockerfile

#
# Ubuntu:bionic = Ubuntu 18.04.6 LTS, last update 2021
# Ubuntu:24.04 = Ubuntu 24.04 LTS, last update 2026
#
FROM ubuntu:bionic
#FROM ubuntu:24.04 # FAILS
#FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update
RUN apt-get install -y apache2 php libapache2-mod-php php-xml php-mbstring
#
# Add-ons for debugging.
#
RUN apt-get install -y ksh lsof vim lynx
RUN usermod -s /bin/ksh www-data
#
# END OF DEBUGGING
#

#
# Enable php module
#
RUN a2enmod rewrite

#
# Enable creation of apache2.pid
#
RUN chown -Rh www-data:www-data /var/run/apache2

EXPOSE 8080
USER www-data

ENTRYPOINT ["apache2ctl", "-D", "FOREGROUND"]

$ROOT/docker-compose.yaml

services:
  hypha:
    build:
      context: .
      dockerfile: Dockerfile
    image: planb/hypha:latest
    mem_limit: 256m
    container_name: hypha
    ports:
      - "8086:8080"
    stdin_open: true
    tty: true
    restart: unless-stopped
    volumes:
      -./data/hypha:/var/www/hypha/data
      -./hypha-build/hypha.php:/var/www/hypha/hypha.php:ro
      #- ./hypha-build/hypha.php:/var/www/hypha/hypha.php
      -./hypha-git:/var/www/hypha:ro
      #- ./hypha-git:/var/www/hypha
      -./data/apache2/apache2.conf:/etc/apache2/apache2.conf:ro

$ROOT/data/apache2/apache2.conf

DefaultRuntimeDir ${APACHE_RUN_DIR}
ServerName localhost
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog /dev/stderr
LogLevel warn

IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

Listen 8080

<Directory />
  AllowOverride None
  Require all denied
</Directory>

<Directory /var/www/>
  AllowOverride None
  Require all granted
</Directory>

AccessFileName .htaccess

<FilesMatch "^\.ht">
  Require all denied
</FilesMatch>

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

#
# Hypha.
#
<VirtualHost *:8080>
  ServerName destadsbron.invantive.com
  DocumentRoot /var/www/hypha
  LogLevel info
  ErrorLog /dev/stderr
  CustomLog /dev/stdout combined
  DirectoryIndex index.php
  SetEnv HTTPS on

  <Directory "/var/www/hypha">
    AllowOverride FileInfo Options
    Require all granted
  </Directory>
</VirtualHost>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions