strip deploy config, keep app-only (split into webgui-compose)

This commit is contained in:
Arjan Widlak 2026-06-30 22:02:53 +00:00
parent 9fdb1bfc25
commit b06bdc88e7
13 changed files with 0 additions and 2950 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
Containerfile*
.dockerignore

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:
- ./deploy/share/create.sql:/docker-entrypoint-initdb.d/1.sql
ports:
- 3306:3306
webgui:
image: webgui:latest
build:
context: .
dockerfile: deploy/webgui/Containerfile
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:
- ./deploy/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,177 +0,0 @@
# Podman Containerfile for webgui-deps
# System packages and Perl modules for WebGUI, added one at a time so each
# can be audited for compile/test failures with its own podman layer.
# build via: podman build -t webgui-deps -f deploy/webgui-deps/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 \
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
ENV PERL_CPANM_OPT="--mirror file:///cpan-mirror \
--mirror https://www.cpan.org"
RUN cpanm --notest Algorithm::Permute
RUN cpanm --notest App::Cmd
RUN cpanm --notest Archive::Any
RUN cpanm --notest Archive::Tar
RUN cpanm --notest Archive::Zip
RUN cpanm --notest Business::OnlinePayment
RUN cpanm --notest Business::OnlinePayment::AuthorizeNet
RUN cpanm --notest Business::PayPal::API
RUN cpanm --notest Business::Tax::VAT::Validation
RUN cpanm --notest CHI
RUN cpanm --notest CSS::Minifier::XS
RUN cpanm --notest CSS::Packer
RUN cpanm --notest Cache::FastMmap
RUN cpanm --notest Capture::Tiny
RUN cpanm --notest Class::C3
RUN cpanm --notest Class::InsideOut
RUN cpanm --notest Clone
RUN cpanm --notest Color::Calc
RUN cpanm --notest Compress::Zlib
RUN cpanm --notest Config::JSON
RUN cpanm --notest DBI
RUN cpanm --notest Data::ICal
RUN cpanm --notest DateTime
RUN cpanm --notest DateTime::Event::ICal
RUN cpanm --notest DateTime::Format::HTTP
RUN cpanm --notest DateTime::Format::Mail
RUN cpanm --notest DateTime::Format::Strptime
RUN cpanm --notest DBD::mysql@4.051
RUN cpanm --notest Devel::StackTrace
RUN cpanm --notest Devel::StackTrace::WithLexicals
RUN cpanm --notest Digest::MD5
RUN cpanm --notest Digest::SHA
RUN cpanm --notest Email::Valid
RUN cpanm --notest Exception::Class
RUN cpanm --notest Facebook::Graph
RUN cpanm --notest File::Path
RUN cpanm --notest Finance::Quote
RUN cpanm --notest GD
RUN cpanm --notest GD::Graph
RUN cpanm --notest Geo::Coder::Googlev3
RUN cpanm --notest HTML::Form
RUN cpanm --notest HTML::Highlight
RUN cpanm --notest HTML::Packer
RUN cpanm --notest HTML::Parser
RUN cpanm --notest HTML::TagCloud
RUN cpanm --notest HTML::TagFilter
RUN cpanm --notest HTML::Template
RUN cpanm --notest HTML::Template::Expr
RUN cpanm --notest HTTP::BrowserDetect
RUN cpanm --notest HTTP::Exception
RUN cpanm --notest HTTP::Headers
RUN cpanm --notest HTTP::Request
RUN cpanm --notest IO::File::WithPath
RUN cpanm --notest IO::Interactive::Tiny
RUN cpanm --notest IO::Socket::SSL
RUN cpanm --notest IO::Zlib
RUN cpanm --notest Image::ExifTool
RUN cpanm --notest Imager
RUN cpanm --notest Imager::File::PNG
RUN cpanm --notest JSON
RUN cpanm --notest JSON::Any
RUN cpanm --notest JSON::PP
RUN cpanm --notest JavaScript::Minifier::XS
RUN cpanm --notest JavaScript::Packer
RUN cpanm --notest Kwargs
RUN cpanm --notest LWP
RUN cpanm --notest LWP::Protocol::https
RUN cpanm --notest List::MoreUtils
RUN cpanm --notest Locales
RUN cpanm --notest Log::Log4perl
RUN cpanm --notest Mail::DeliveryStatus::BounceParser
RUN cpanm --notest MIME::Tools
RUN cpanm --notest Module::Find
RUN cpanm --notest Monkey::Patch
RUN cpanm --notest Moose
RUN cpanm --notest MooseX::NonMoose
RUN cpanm --notest MooseX::Storage
RUN cpanm --notest MooseX::Storage::Format::JSON
RUN cpanm --notest Net::CIDR::Lite
RUN cpanm --notest Net::DNS
RUN cpanm --notest Net::LDAP
RUN cpanm --notest Net::POP3
RUN cpanm --notest Net::SMTP
RUN cpanm --notest Net::Twitter
RUN cpanm --notest Number::Format
RUN cpanm --notest POE
RUN cpanm --notest POE::Component::Client::HTTP
RUN cpanm --notest POE::Component::IKC::Server
RUN cpanm --notest POE::Component::IKC
RUN cpanm --notest Package::Stash
RUN cpanm --notest Params::Validate
RUN cpanm --notest Path::Class
RUN cpanm --notest PerlIO::eol
RUN cpanm --notest Plack
RUN cpanm --notest Plack::Middleware::Debug
RUN cpanm --notest Plack::Middleware::Status
RUN cpanm --notest Plack::Request
RUN cpanm --notest Plack::Response
RUN cpanm --notest Pod::Coverage
RUN cpanm --notest Readonly
RUN cpanm --notest Scope::Guard
RUN cpanm --notest Search::QueryParser
RUN cpanm --notest Storable
RUN cpanm --notest Template
RUN cpanm --notest Test::Class
RUN cpanm --notest Test::Deep
RUN cpanm --notest Test::Differences
RUN cpanm --notest Test::Exception
RUN cpanm --notest Test::Harness
RUN cpanm --notest Test::Log::Dispatch
RUN cpanm --notest Test::LongString
RUN cpanm --notest Test::MockObject
RUN cpanm --notest Test::MockTime
RUN cpanm --notest Test::More
RUN cpanm --notest Test::Tester
RUN cpanm --notest Test::WWW::Mechanize::PSGI
RUN cpanm --notest Text::Aspell
RUN cpanm --notest Text::Balanced
RUN cpanm --notest Text::CSV_XS
RUN cpanm --notest Tie::CPHash
RUN cpanm --notest Tie::IxHash
RUN cpanm --notest Time::HiRes
RUN cpanm --notest Try::Tiny
RUN cpanm --notest URI::Escape
RUN cpanm --notest UUID::Tiny
RUN cpanm --notest Weather::Com::Finder
RUN cpanm --notest XML::FeedPP
RUN cpanm --notest XML::FeedPP::MediaRSS
RUN cpanm --notest XML::Simple
RUN cpanm --notest common::sense
RUN cpanm --notest namespace::autoclean
RUN apt -y remove libjson-xs-perl
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/*

View file

@ -1,32 +0,0 @@
# Podman Containerfile
# build via compose.yml or:
# podman image build -q -t webgui -f deploy/webgui/Containerfile .
FROM localhost/webgui-deps
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 deploy/webgui/entrypoint /entrypoint
ADD deploy/webgui/www.example.com.conf /etc/apache2/sites-available/000-default.conf
ADD deploy/webgui/webgui.conf /etc/apache2/mods-enabled/webgui.conf
ADD deploy/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

@ -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;
}