From 3349ea882d3340c69b89233027c43a5041aefa23 Mon Sep 17 00:00:00 2001 From: kalipso Date: Fri, 11 Apr 2025 11:06:01 +0200 Subject: [PATCH] kind of working --- docker/Dockerfile | 22 ++++-- docker/docker-compose.yml | 18 ++--- docker/initdb.sh | 12 +++ install/apache2-sites/calcms.conf | 6 +- install/apache2-sites/coloradio.conf | 6 +- install/init.sql | 18 ++--- tools/update_page.sh | 2 +- tools/update_program.pl | 4 +- website/agenda/config/config.cgi.off | 10 +-- website/agenda/templates/coloradio/aura.xml | 87 +++++++++++++++++++++ website/agenda/templates/default/aura.xml | 87 +++++++++++++++++++++ 11 files changed, 235 insertions(+), 37 deletions(-) create mode 100755 docker/initdb.sh create mode 100644 website/agenda/templates/coloradio/aura.xml create mode 100644 website/agenda/templates/default/aura.xml diff --git a/docker/Dockerfile b/docker/Dockerfile index 7568ec6..89203d6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,22 +1,34 @@ # Use the official Debian image as a base -FROM debian:latest +FROM debian:bullseye # Set environment variables # ENV DEBIAN_FRONTEND=noninteractive # Update the package list and install Apache2 and MariaDB RUN apt-get update && \ - apt-get install -y apache2 && \ + apt-get install -y apache2 apache2-dev && \ apt-get clean && \ + a2dismod mpm_event && \ + a2enmod mpm_prefork && \ + # apt-get install -y libapache2-rewrite && \ + a2enmod rewrite && \ + apt-get install -y libapache2-mod-perl2 libperl-dev libapache2-reload-perl libapache2-request-perl libapache2-mod-apreq2 build-essential imagemagick libapreq2-3 libapache-dbi-perl libauthen-sasl-perl libauthen-passphrase-perl libcalendar-simple-perl libcrypt-blowfish-perl libcgi-pm-perl libcgi-session-perl libcgi-simple-perl libconfig-general-perl libdatetime-perl libdate-calc-perl libdate-manip-perl libdbi-perl libdbd-mysql-perl libemail-sender-perl libencode-perl libjson-perl libhtml-formattext-withlinks-andtables-perl libhtml-parser-perl libhtml-template-perl libhtml-template-compiled-perl libmime-tools-perl libsession-token-perl libtext-multimarkdown-perl libtext-unidecode-perl libtext-wikicreole-perl liburi-escape-xs-perl perlmagick sox libsox-fmt-all && \ + a2enmod perl && \ + service apache2 restart && \ + cpan App::cpanminus && \ rm -rf /var/lib/apt/lists/* +# RUN ["cpanm", "--force", "Image::Magick", "Image::Magick::Square" ] +# RUN ["cpanm", "--force", "Apache2::Reload", "Apache2::Request", "Apache2::Upload", "Apache::DBI", "Authen::Passphrase", "Authen::Passphrase::BlowfishCrypt", "Calendar::Simple", "CGI", "CGI::Carp", "CGI::Cookie", "CGI::Session", "CGI::Simple", "Config::General", "Data::Dumper", "Date::Calc", "Date::Manip", "DateTime", "DBD::mysql", "DBI", "Digest::MD5", "Encode::Locale", "HTML::Entities", "HTML::FormatText", "HTML::Parse", "HTML::Template::Compiled", "HTML::Template::Compiled::Plugin::XMLEscape", "Image::Magick", "Image::Magick::Square", "JSON", "ModPerl::Util", "Session::Token", "Text::Diff::FormatedHtml", "Text::Markdown", "Text::WikiCreole", "URI::Escape" ] # Copy your website files to the Apache document root (optional) -COPY ./install/apache2-sites/coloradio.conf /etc/conf/apache2/sites-enabled/ - +COPY . /var/www/html/. +COPY ./install/apache2-sites/calcms.conf /etc/apache2/sites-enabled/ +COPY ./website/agenda/config/config.cgi.off /var/www/html/website/config/config.cgi +COPY ./website/agenda/config/config.cgi.off /var/www/html/website/agenda/config/config.cgi # Expose ports for Apache and MariaDB EXPOSE 80 # Start both Apache and MariaDB -CMD service apache2 start && \ +CMD service apache2 restart && \ tail -f /var/log/apache2/access.log diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 2e12170..ecbbff8 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,13 +1,13 @@ services: - #web: - # build: - # context: .. - # dockerfile: ./docker/Dockerfile - # ports: - # - "80:80" - # #volumes: - # #- ./your-website-files:/var/www/html/ - # #- ./httpd.conf:/etc/apache2/sites-available/000-default.conf + web: + build: + context: .. + dockerfile: ./docker/Dockerfile + ports: + - "80:80" + #volumes: + #- ../:/var/www/html/ + #- ./httpd.conf:/etc/apache2/sites-available/000-default.conf db: image: mariadb:10 diff --git a/docker/initdb.sh b/docker/initdb.sh new file mode 100755 index 0000000..fda451c --- /dev/null +++ b/docker/initdb.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -e + +# Call the original entrypoint script +exec docker-entrypoint.sh + +# Run the first script as root +mariadb -h 127.0.0.1 -u root -p"$MYSQL_ROOT_PASSWORD" < /init/01-init.sql +# +## Run the second script as caladmin +mariadb -h 127.0.0.1 -u calcms_admin -pcaladmin000 < /init/02-create.sql + diff --git a/install/apache2-sites/calcms.conf b/install/apache2-sites/calcms.conf index 8cea477..59ccbcf 100644 --- a/install/apache2-sites/calcms.conf +++ b/install/apache2-sites/calcms.conf @@ -6,9 +6,9 @@ LimitInternalRecursion 4 # Redirect permanent /agenda/planung https://${domain}/agenda/planung Define domain localhost -Define base_dir /home/calcms/racalmas -Define web_dir /home/calcms/racalmas/website/ -Define perl_lib /home/calcms/racalmas/lib +Define base_dir /var/www/html +Define web_dir /var/www/html/website/ +Define perl_lib /var/www/html/lib Define archive_dir /home/radio/archive/ # Redirect permanent /agenda/planung https://${domain}/agenda/planung diff --git a/install/apache2-sites/coloradio.conf b/install/apache2-sites/coloradio.conf index 154e4ed..abcec53 100644 --- a/install/apache2-sites/coloradio.conf +++ b/install/apache2-sites/coloradio.conf @@ -5,9 +5,9 @@ LogLevel info LimitInternalRecursion 4 Define domain localhost -Define base_dir /home/milan/radio/coloradio/racalmas.orig/ -Define perl_lib /home/milan/radio/coloradio/racalmas.orig/lib/calcms -Define web_dir /home/milan/radio/coloradio/racalmas.orig/website/ +Define base_dir /var/www/html/ +Define perl_lib /var/www/html/lib/calcms +Define web_dir /var/www/html/website/ Define archive_dir /home/radio/archive/ # calcms endpoints for your website diff --git a/install/init.sql b/install/init.sql index 6d578d6..443fc00 100644 --- a/install/init.sql +++ b/install/init.sql @@ -3,15 +3,15 @@ CREATE DATABASE IF NOT EXISTS calcms; CREATE DATABASE IF NOT EXISTS calcms_test; --- Create admin user -CREATE USER IF NOT EXISTS 'calcms_admin'@'localhost' IDENTIFIED BY 'caladmin000'; -GRANT ALL PRIVILEGES ON calcms.* TO 'calcms_admin'@'localhost'; -GRANT ALL PRIVILEGES ON calcms_test.* TO 'calcms_admin'@'localhost'; +CREATE USER IF NOT EXISTS 'calcms_admin'@'%' IDENTIFIED BY 'caladmin000'; +GRANT ALL PRIVILEGES ON calcms.* TO 'calcms_admin'@'%'; +GRANT ALL PRIVILEGES ON calcms_test.* TO 'calcms_admin'@'%'; --- Create write user -CREATE USER IF NOT EXISTS 'calcms_write'@'localhost' IDENTIFIED BY 'calwrite000'; -GRANT SELECT, INSERT, UPDATE, DELETE ON calcms.* TO 'calcms_write'@'localhost'; -GRANT ALL PRIVILEGES ON calcms_test.* TO 'calcms_write'@'localhost'; +CREATE USER IF NOT EXISTS 'calcms_write'@'%' IDENTIFIED BY 'calwrite000'; +GRANT SELECT, INSERT, UPDATE, DELETE ON calcms.* TO 'calcms_write'@'%'; +GRANT ALL PRIVILEGES ON calcms_test.* TO 'calcms_write'@'%'; --- Create read user -CREATE USER IF NOT EXISTS 'calcms_read'@'localhost' IDENTIFIED BY 'calread000'; -GRANT SELECT ON calcms.* TO 'calcms_read'@'localhost'; -GRANT ALL PRIVILEGES ON calcms_test.* TO 'calcms_read'@'localhost'; +CREATE USER IF NOT EXISTS 'calcms_read'@'%' IDENTIFIED BY 'calread000'; +GRANT SELECT ON calcms.* TO 'calcms_read'@'%'; +GRANT ALL PRIVILEGES ON calcms_test.* TO 'calcms_read'@'%'; diff --git a/tools/update_page.sh b/tools/update_page.sh index 728eac3..f258e1c 100755 --- a/tools/update_page.sh +++ b/tools/update_page.sh @@ -1,4 +1,4 @@ #!/bin/sh -perl -I /home/calcms/lib/calcms update_program.pl +perl -I /var/www/html/lib/calcms/update_program.pl #perl -I /home/radio/calcms/calcms aggregate.cgi date=today 2>/dev/null > /home/radio/radio/agenda/programm.html diff --git a/tools/update_program.pl b/tools/update_program.pl index cf390d4..3668db7 100755 --- a/tools/update_program.pl +++ b/tools/update_program.pl @@ -8,8 +8,8 @@ use Date::Calc; use config; use template; -my $perlPath='-I /home/calcms/lib/calcms'; -my $configPath=$ARGV[0]||'/home/calcms/website/agenda/config/config.cgi'; +my $perlPath='-I /var/www/html/lib/calcms'; +my $configPath=$ARGV[0]||'/var/www/html/website/agenda/config/config.cgi'; unless (defined $config::config){ config::get($configPath); diff --git a/website/agenda/config/config.cgi.off b/website/agenda/config/config.cgi.off index d38e3ef..22ce55c 100755 --- a/website/agenda/config/config.cgi.off +++ b/website/agenda/config/config.cgi.off @@ -1,12 +1,12 @@ #!/usr/bin/perl -print "Content-type:text/plain\n\nAccess denies."; -exit; -__END__ +#print "Content-type:text/plain\n\nAccess denies."; +#exit; +#__END__ Define DOMAIN localhost -Define BASE_DIR /home/calcms/racalmas/website +Define BASE_DIR /var/www/html/website # default project from database project my-project @@ -100,7 +100,7 @@ domain ${DOMAIN} - hostname localhost + hostname db port 3306 database calcms diff --git a/website/agenda/templates/coloradio/aura.xml b/website/agenda/templates/coloradio/aura.xml new file mode 100644 index 0000000..f629552 --- /dev/null +++ b/website/agenda/templates/coloradio/aura.xml @@ -0,0 +1,87 @@ + + + 11. Oktober 2024 + + https: + + update-or-create + + + + <TMPL_VAR full_title> + + + + 11. Oktober 2024 + + + Sendung + + + + + + + + + + + + + + + + + + + + + + + + + + CC-BY-SA + true + + + Unsplash + + + + Soziales + + + + Bastian Baltasar Bux + + + + 28771759517_54ecd90cf9_o.jpg + Enrico Strocchi + Ein abgesägter und von Moos überzogener Baumstamm + + + + + + ilnur-kalimullin-KJedOlSAdO8-unsplash.jpg + Ilnur Kalimullin + true + Große Balkons mit integrierten Pflanzenkübeln an einem Plattenbau + + Ilnur Kalimullin auf Unsplash]]> + + + + + + + + diff --git a/website/agenda/templates/default/aura.xml b/website/agenda/templates/default/aura.xml new file mode 100644 index 0000000..f629552 --- /dev/null +++ b/website/agenda/templates/default/aura.xml @@ -0,0 +1,87 @@ + + + 11. Oktober 2024 + + https: + + update-or-create + + + + <TMPL_VAR full_title> + + + + 11. Oktober 2024 + + + Sendung + + + + + + + + + + + + + + + + + + + + + + + + + + CC-BY-SA + true + + + Unsplash + + + + Soziales + + + + Bastian Baltasar Bux + + + + 28771759517_54ecd90cf9_o.jpg + Enrico Strocchi + Ein abgesägter und von Moos überzogener Baumstamm + + + + + + ilnur-kalimullin-KJedOlSAdO8-unsplash.jpg + Ilnur Kalimullin + true + Große Balkons mit integrierten Pflanzenkübeln an einem Plattenbau + + Ilnur Kalimullin auf Unsplash]]> + + + + + + + +