Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
Arjan Widlak
b06bdc88e7 strip deploy config, keep app-only (split into webgui-compose) 2026-06-30 22:02:53 +00:00
Arjan Widlak
9fdb1bfc25 distribution -> deploy (git mv, history kept)
> distributino/docker-compose.yml -> compose.yml in the root, paths in file updated
> Dockerfile -> deploy/webgui/Containerfile
> deploy/webgui/Containerfile now with FROM localhost/webgui-deps
> New: deploy/webgui-deps/Containerfile with all cpan modules (and apt block that was above it)
all modules their own RUN cpanm --notest line
ENV PERL_CPANM_OPT to use cpan-mirror
README.md, CONTEXT.md and .dockerignore updated
--no-cache --force -> --notest (so i can test)
2026-06-30 20:00:40 +00:00
14 changed files with 18 additions and 2941 deletions

View file

@ -1,15 +0,0 @@
# https://medium.com/@bounouh.fedi/mastering-the-dockerignore-file-boosting-docker-build-efficiency-398719f4a0e1
# Ignore version control (directories), not needed in container
.git
.git/
.gitignore
# If we're cacheing cpan modules, so they are not downloaded every time
# ignore these caches in the container
.cpanrc
cpan-cache/
# Ignore Docker-related files
Dockerfile*
.dockerignore

View file

@ -7,10 +7,11 @@
## Directory Structure & Key Files
- `CONTEXT.md`, this file
- `README.md` of the WebGUI project
- `distribution/docker-compose.yml` Current orchestration
- `Dockerfile` - the Dockerfile of the WebGUI container
- `compose.yml` Current orchestration
- the custom folder contains all files related to custom modules add to WebGUI
- the distribution folder contains
- the deploy folder contains
- - `webgui-deps/Containerfile` - system packages and Perl modules (cpanm), built first as `localhost/webgui-deps`
- - `webgui/Containerfile` - the WebGUI app image, built `FROM localhost/webgui-deps`
- - `nginx/nginx.conf` - configuration file for nginx in seperate pod
- - `share/create.sql` - the create database file so mariadb can function as a database service for WebGUI
- - `webgui/entrypoint` - the script that runs when the WebGUI service starts

View file

@ -1,183 +0,0 @@
# Podman Containerfile
# build via compose.yml or:
# podman image build -q -t debian:podman-trixie -f Containerfile .
FROM debian:trixie
ENV DEBIAN_FRONTEND="noninteractive"
RUN apt update && apt -y install perl cpanminus libaspell-dev make libdbd-mysql-perl libdigest-perl-md5-perl libxml-simple-perl \
libmodule-install-perl gcc libperl-dev default-libmysqlclient-dev libpng-dev build-essential libgd-dev mariadb-client imagemagick \
libpng-dev libjpeg-dev libtiff-dev libapache2-mod-perl2 libapache2-mod-perl2-dev libapache2-request-perl libimage-magick-perl vim \
apache2 apache2-utils mailutils \
# could be removed for production:
curl procps
RUN cpanm --notest --no-cache --force \
Algorithm::Permute \
App::Cmd \
Archive::Any \
Archive::Tar \
Archive::Zip \
Business::OnlinePayment \
Business::OnlinePayment::AuthorizeNet \
Business::PayPal::API \
Business::Tax::VAT::Validation \
CHI \
CSS::Minifier::XS \
CSS::Packer \
Cache::FastMmap \
Capture::Tiny \
Class::C3 \
Class::InsideOut \
Clone \
Color::Calc \
Compress::Zlib \
Config::JSON \
DBI \
Data::ICal \
DateTime \
DateTime::Event::ICal \
DateTime::Format::HTTP \
DateTime::Format::Mail \
DateTime::Format::Strptime \
DBD::mysql@4.051 \
Devel::StackTrace \
Devel::StackTrace::WithLexicals \
Digest::MD5 \
Digest::SHA \
Email::Valid \
Exception::Class \
Facebook::Graph \
File::Path \
Finance::Quote \
GD \
GD::Graph \
Geo::Coder::Googlev3 \
HTML::Form \
HTML::Highlight \
HTML::Packer \
HTML::Parser \
HTML::TagCloud \
HTML::TagFilter \
HTML::Template \
HTML::Template::Expr \
HTTP::BrowserDetect \
HTTP::Exception \
HTTP::Headers \
HTTP::Request \
IO::File::WithPath \
IO::Interactive::Tiny \
IO::Socket::SSL \
IO::Zlib \
Image::ExifTool \
Imager \
Imager::File::PNG \
JSON \
JSON::Any \
JSON::PP \
JavaScript::Minifier::XS \
JavaScript::Packer \
Kwargs \
LWP \
LWP::Protocol::https \
List::MoreUtils \
Locales \
Log::Log4perl \
Mail::DeliveryStatus::BounceParser \
MIME::Tools \
Module::Find \
Monkey::Patch \
Moose \
MooseX::NonMoose \
MooseX::Storage \
MooseX::Storage::Format::JSON \
Net::CIDR::Lite \
Net::DNS \
Net::LDAP \
Net::POP3 \
Net::SMTP \
Net::Twitter \
Number::Format \
POE \
POE::Component::Client::HTTP \
POE::Component::IKC::Server \
POE::Component::IKC \
Package::Stash \
Params::Validate \
Path::Class \
PerlIO::eol \
Plack \
Plack::Middleware::Debug \
Plack::Middleware::Status \
Plack::Request \
Plack::Response \
Pod::Coverage \
Readonly \
Scope::Guard \
Search::QueryParser \
Storable \
Template \
Test::Class \
Test::Deep \
Test::Differences \
Test::Exception \
Test::Harness \
Test::Log::Dispatch \
Test::LongString \
Test::MockObject \
Test::MockTime \
Test::More \
Test::Tester \
Test::WWW::Mechanize::PSGI \
Text::Aspell \
Text::Balanced \
Text::CSV_XS \
Tie::CPHash \
Tie::IxHash \
Time::HiRes \
Try::Tiny \
URI::Escape \
UUID::Tiny \
Weather::Com::Finder \
XML::FeedPP \
XML::FeedPP::MediaRSS \
XML::Simple \
common::sense \
namespace::autoclean
RUN apt -y remove libjson-xs-perl
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/*
#RUN cpanm --notest --force \
# DBD::mysql@4.051
ADD lib /data/WebGUI/lib
ADD sbin /data/WebGUI/sbin
ADD share /data/WebGUI/share
ADD www/extras /data/WebGUI/www/extras
ADD www/maintenance.html /data/WebGUI/www/maintenance.html
ADD www/uploads /data/WebGUI/uploads
ADD etc /data/WebGUI/etc
ADD distribution/webgui/entrypoint /entrypoint
ADD distribution/webgui/www.example.com.conf /etc/apache2/sites-available/000-default.conf
ADD distribution/webgui/webgui.conf /etc/apache2/mods-enabled/webgui.conf
ADD distribution/webgui/modperl.pl /etc/apache2/modperl.pl
RUN useradd --home=/data/WebGUI webgui; chown -R webgui: /data/WebGUI; chmod 755 /entrypoint; \
# apt remove -y cpanminus make gcc libperl-dev ; rm -rf /root/.cpanm; \
echo "ServerName localhost" >> /etc/apache2/apache2.conf;
#USER webgui
# zorgt voor een andere shell prompt in de container gestart in de development container
# ook wanneer die in dezelfde UTC namespace zit - always /after/ USER command
ENV CONTAINER_CONTEXT=inner
RUN printf '%s\n' 'export PS1="\u@${CONTAINER_CONTEXT}:\w\\$ "' >> ~/.bashrc
WORKDIR /data/WebGUI
CMD [ "/entrypoint" ]

View file

@ -35,7 +35,7 @@ WebGUI is a powerful, open-source content management system and web framework bu
### Recommended Modules
A comprehensive list of Perl dependencies is installed via `cpanm` (see Dockerfile for details).
A comprehensive list of Perl dependencies is installed via `cpanm` (see `deploy/webgui-deps/Containerfile` for details).
## Quick Start Installation
@ -110,27 +110,27 @@ mysql.server start
apachectl start
```
## Docker Deployment
## Podman Deployment
WebGUI includes Docker support for easy containerized deployment:
WebGUI includes Podman support for easy containerized deployment:
# Build Docker image
# Build the deps and app images
```bash
docker build -t webgui:latest .
podman build -t webgui-deps -f deploy/webgui-deps/Containerfile .
podman build -t webgui:latest -f deploy/webgui/Containerfile .
```
# Run with docker-compose (see distribution/docker-compose.yml)
# Run with podman-compose (see compose.yml)
```bash
cd distribution
docker-compose up -d
podman-compose up -d
```
The Docker setup includes:
The Podman setup includes:
- Debian-based container with all dependencies
- Apache 2 with mod_perl
- MariaDB client
- ImageMagick for image processing
- Nginx reverse proxy configuration (distribution/nginx/)
- Nginx reverse proxy configuration (deploy/nginx/)
## Project Structure
@ -144,7 +144,7 @@ The Docker setup includes:
├── t/ # Test suite
├── etc/ # Configuration files
├── docs/ # Documentation
├── distribution/ # Docker and deployment configs
├── deploy/ # Podman and deployment configs
├── www/ # Web content (uploads, extras)
└── share/ # Shared resources (nginx config, SQL)
```
@ -197,7 +197,7 @@ perl t/MyTest.t
### Virtual Host Configuration
- `etc/www.example.com.conf` - Example virtual host config
- `distribution/webgui/www.example.com.conf` - Docker example
- `deploy/webgui/www.example.com.conf` - Podman example
## Database Schema
@ -275,7 +275,7 @@ Contributions are welcome! Please ensure:
- Ensure WebguiRoot path is correct
### Missing Dependencies
- Use the Dockerfile as a reference for all dependencies
- Use `deploy/webgui-deps/Containerfile` as a reference for all dependencies
- Install via cpanm: `cpanm Module::Name`
- Run: `perl sbin/testEnvironment.pl`
@ -284,4 +284,4 @@ Contributions are welcome! Please ensure:
- Plain Black home: http://www.plainblack.com
- WebGUI Wiki: http://wiki.webgui.org
- Test suite: `t/` directory with comprehensive test coverage
- Configuration examples: `etc/` and `distribution/` directories
- Configuration examples: `etc/` and `deploy/` directories

View file

@ -1,44 +0,0 @@
# This file is ideal for development and testing.
# --- DO NOT USE FOR PRODUCTION ---
# however, you can use it as a guide to create a proper production environment.
services:
db:
image: docker.io/library/mariadb:latest
container_name: db
environment:
- MYSQL_ROOT_PASSWORD=123qwe
- MYSQL_USER=webgui
- MYSQL_PASSWORD=123qwe
- MYSQL_DATABASE=www_example_com
volumes:
- ./share/create.sql:/docker-entrypoint-initdb.d/1.sql
ports:
- 3306:3306
webgui:
image: webgui:latest
build:
context: ..
dockerfile: Dockerfile
container_name: webgui
depends_on:
- db
volumes:
- ../.:/data/WebGUI
expose:
- "80"
nginx-proxy:
image: docker.io/nginx:latest
container_name: nginx_proxy
depends_on:
- webgui
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "80:80"
#TODO: add ssl later
#- "443:443"
# TODO: serve staatic files directly from nginx
#- ./www:/var/www/html:ro

View file

@ -1,20 +0,0 @@
worker_processes auto;
events {}
http {
upstream backend {
server webgui:80;
}
server {
listen 80;
location / {
proxy_pass http://backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -1,46 +0,0 @@
#!/bin/bash
# script that runs when the podman container starts
echo "Starting WebGUI entrypoint script with:"
perl -Ilib sbin/wgd ls
echo "Starting WebGUI entrypoint script..."
for configfile in `perl -Ilib sbin/wgd for-each`;do
echo "Processing config file: $configfile"
# wait for the db to come up and get our version so we know if we need to run upgrades
connection_info=`perl -Ilib sbin/wgd db --config-file=$configfile --webgui-root=/data/WebGUI --print | sed "s/'//g" `
while true; do
db_version=`mysql --skip-column-names -e 'select webguiVersion from webguiVersion order by dateApplied desc limit 1;' $connection_info ` && break
echo "waiting for the database to come up..."
sleep 10
done
code_version=`perl -Ilib -e 'use WebGUI; print $WebGUI::VERSION;'`
echo "code version $code_version"
echo "database version $db_version for $configfile with configfile $configfile"
if [ "$db_version" != "$code_version" ];then
echo "Upgrading Webgui from $db_version to $code_version..."
#first we alter the userSession table to make sure that the userId has a default value This is required for the upgrade process to work correctly.
`mysql -e 'alter table userSession MODIFY COLUMN userId char(22) NOT NULL DEFAULT "0";' $connection_info `
perl -Ilib sbin/wgd reset --upgrade --verbose --config-file=$configfile --webgui-root=/data/WebGUI/
## perl -Ilib sbin/wgd db --config-file=www.example.com --webgui-root=/data/WebGUI
#install newsletter module
perl -I /data/WebGUI/lib -I /data/WebGUI/custom/webgui_newsletter/lib /data/WebGUI/custom/webgui_newsletter/sbin/install_icons.pl --customRoot=/data/WebGUI/custom
cd /data/WebGUI/lib
perl -I /data/WebGUI/lib -I /data/WebGUI/custom/webgui_newsletter/lib /data/WebGUI/custom/webgui_newsletter/sbin/install_newsletter.pl --configFile=www.example.com.conf
fi
done
perl -I/data/WebGUI/lib sbin/spectre.pl --daemon
apachectl -DFOREGROUND

View file

@ -1,6 +0,0 @@
#use Apache2::SizeLimit;
#$Apache2::SizeLimit::MAX_PROCESS_SIZE = 600000;
#$Apache2::SizeLimit::MAX_UNSHARED_SIZE = 600000;
#$Apache2::SizeLimit::CHECK_EVERY_N_REQUESTS = 10;
1;

View file

@ -1,4 +0,0 @@
PerlSetVar WebguiRoot /data/WebGUI
#PerlCleanupHandler Apache2::SizeLimit
PerlRequire /data/WebGUI/sbin/preload.perl
PerlRequire /etc/apache2/modperl.pl

View file

@ -1,16 +0,0 @@
<VirtualHost 0.0.0.0:80>
ServerName localhost
ServerAlias webgui www.example.com example.com unitedknowledge.vps2.unitedknowledge.net www.unitedknowledge.eu unitedknowledge.eu www.united-knowledge.eu united-knowledge.eu www.unitedknowledge.net unitedknowledge.net
DocumentRoot /data/WebGUI/www
SetEnvIf SSLPROXY "1" \
SSLPROXY
SetHandler perl-script
PerlInitHandler WebGUI
CustomLog /var/log/apache2/www.example.com.access.log combined
ErrorLog /var/log/apache2/www.example.com.error.log
PerlSetVar WebguiConfig www.example.com.conf
<Directory "/data/WebGUI/www">
Require all granted
</Directory>
</VirtualHost>

View file

@ -1,19 +0,0 @@
server {
listen 8080 default_server;
access_log /dev/stdout main;
index index.htm index.html;
root /data/WebGUI/www;
location / {
proxy_pass http://webgui-upstream;
}
location /extras/ {
add_header Cache-Control public;
expires 24h;
add_header Access-Control-Allow-Origin *;
}
location /uploads/filepump { expires max; }
}

View file

@ -1,25 +0,0 @@
worker_processes 1;
error_log /dev/stdout warn;
pid /tmp/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /dev/stdout main;
sendfile on;
keepalive_timeout 65;
include /etc/nginx/streams.d/*.conf;
include /etc/nginx/conf.d/*.conf;
}

View file

@ -1,3 +0,0 @@
upstream webgui-upstream {
server 127.0.0.1:80;
}