update documentation

update configuration using variables
use markdown
This commit is contained in:
Milan
2020-04-10 09:31:48 +02:00
parent fffe3899df
commit 2a8906b598

View File

@@ -1,11 +1,11 @@
==== database setup ==== # setup database
=== create database === ## create database
mysqladmin -u root -p create calcms_test mysqladmin -u root -p create calcms
=== create users === ### start mysql with root permissions
mysql -u root -p mysql -u root -p
@@ -13,111 +13,116 @@ if using plesk, use
mysql -u admin mysql -p`cat /etc/psa/.psa.shadow` mysql -u admin mysql -p`cat /etc/psa/.psa.shadow`
# calcms_admin We use different accounts for different purposes.
Please change the passwords config after "INDENTIFIED BY" !
#### create admin account
CREATE USER 'calcms_admin'@'localhost' IDENTIFIED BY 'taes9Cho'; CREATE USER 'calcms_admin'@'localhost' IDENTIFIED BY 'taes9Cho';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON *.* TO 'calcms_admin'@'localhost' IDENTIFIED BY 'taes9Cho'; GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON *.* TO 'calcms_admin'@'localhost' IDENTIFIED BY 'taes9Cho';
GRANT ALL PRIVILEGES ON `calcms_test`.* TO 'calcms_admin'@'localhost'; GRANT ALL PRIVILEGES ON `calcms_test`.* TO 'calcms_admin'@'localhost';
# calcms_write / for users #### create editor account
CREATE USER 'calcms_write'@'localhost' IDENTIFIED BY 'Toothok8'; CREATE USER 'calcms_write'@'localhost' IDENTIFIED BY 'Toothok8';
GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO 'calcms_write'@'localhost' IDENTIFIED BY 'Toothok8'; GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO 'calcms_write'@'localhost' IDENTIFIED BY 'Toothok8';
GRANT ALL PRIVILEGES ON `calcms_test`.* TO 'calcms_write'@'localhost'; GRANT ALL PRIVILEGES ON `calcms_test`.* TO 'calcms_write'@'localhost';
# calcms_read / for all #### create read-only account
CREATE USER 'calcms_read'@'localhost' IDENTIFIED BY 'Ro2chiya'; CREATE USER 'calcms_read'@'localhost' IDENTIFIED BY 'Ro2chiya';
GRANT SELECT ON *.* TO 'calcms_read'@'localhost' IDENTIFIED BY 'Ro2chiya' ; GRANT SELECT ON *.* TO 'calcms_read'@'localhost' IDENTIFIED BY 'Ro2chiya' ;
GRANT ALL PRIVILEGES ON `calcms_test`.* TO 'calcms_read'@'localhost'; GRANT ALL PRIVILEGES ON `calcms_test`.* TO 'calcms_read'@'localhost';
=== deploy time zones === ### import database content
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -p mysql -u calcms_admin -p calcms < ./install/create.sql
if using plesk, use mysql -u calcms_admin -p calcms < ./install/migrate.sql
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u admin mysql -p`cat /etc/psa/.psa.shadow` ## Apache HTTP Server Setup
=== create database content === ### install mod_perl
mysql -u calcms_admin -p calcms_test < ./install/create.sql install apache2
==== Apache HTTP Server Setup (at /etc/conf/apache2/ server settings or vhost settings) ==== apt install apache2
=== install mod_perl === install apache2 rewrite
install apt-get install libapache2-rewrite
a2enmod rewrite
libapache2-mod-perl2 install mod_perl2
libapache2-reload-perl
libapache2-request-perl apt install libapache2-mod-perl2 libapache2-reload-perl libapache2-request-perl
a2enmod perl
or via cpan or via cpan
Apache2::Reload cpan install Apache2::Reload Apache2::Request
Apache2::Request a2enmod perl
if mod_perl was installed already make sure it is enabled
ln -s /etc/apache2/mods-available/perl.load /etc/apache2/mods-enabled/perl.load ### Apache Configuration
=== enable mod_rewrite === Virtual host configuration has to be placed at /etc/conf/apache2/.
install # adopt your settings here
Define domain your-domain.org
libapache2-rewrite Define base_dir /home/calcms
Define perl_lib /home/radio/calcms
ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
=== Apache Configuration ) ===
This has to be put into your apache server or virtual host configuration
### START OF FILE ###
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg. # Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel debug LogLevel info
# init mod_perl (should be done at /etc/apache/mods-enabled/perl.load) # limit redirection on injecting into your website
# LoadModule perl_module /usr/lib/apache2/modules/mod_perl.so
# redirect to inject calcms into website
LimitInternalRecursion 4 LimitInternalRecursion 4
# enable this at HTTP configuration, but disable at HTTPS configuration (!) # redirect HTTP to HTTPS,
Redirect permanent /agenda/planung https://calcms.medienstaatsvertrag.org/agenda/planung # only needed for HTTP configuration, do not use this at HTTPS configuration(!)
Redirect permanent /agenda/planung https://${domain}/agenda/planung
# alias to inject calcms into website # inject calcms into your website
Alias /agenda /home/calcms/website/agenda Alias /agenda ${base_dir}/website/agenda
Alias /agenda_files /home/calcms/website/agenda_files Alias /programm ${base_dir}/website/programm
Alias /programm /home/calcms/website/agenda/cache/programm Alias /agenda_files ${base_dir}/website/agenda_files
<Directory /home/calcms/website/agenda> <Directory ${base_dir}/website/agenda>
AllowOverride All AllowOverride All
Options -Indexes +FollowSymLinks +MultiViews +ExecCGI Options -Indexes +FollowSymLinks +MultiViews +ExecCGI
Order allow,deny
Allow from all
Require all granted Require all granted
</Directory> </Directory>
<Directory /home/calcms/website/agenda/cache/programm> <Directory ${base_dir}/website/programm>
AllowOverride All AllowOverride All
Options -Indexes +FollowSymLinks +MultiViews +ExecCGI Options -Indexes +FollowSymLinks -MultiViews -ExecCGI
Order allow,deny
Allow from all
Require all granted Require all granted
<IfModule mod_rewrite.c>
RewriteBase /programm
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule (.*) $1 [L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule (.*) $1 [L]
RewriteRule ^kalender/(\d{4}-\d{2}-\d{2})_(\d{4}-\d{2}-\d{2})\.html[\?]?(.*)$ /agenda/aggregate.cgi?from_date=$1&till_date=$2&$3 [L]
RewriteRule ^kalender/(\d{4}-\d{2}-\d{2})\.html[\?]?(.*)$ /agenda/aggregate.cgi?date=$1&$2 [L]
RewriteRule ^sendungen/(\d{4}-\d{2}-\d{2})\.html[\?]?(.*)$ /agenda/aggregate.cgi?date=$1&$2 [L]
RewriteRule ^sendung/(\d+)\.html[\?]?(.*)$ /agenda/aggregate.cgi?event_id=$1&$2 [L]
RewriteRule ^sendung/serie_plus/(\d+)\.html[\?]?(.*)$ /agenda/aggregate.cgi?next_series=$1&$2 [L]
RewriteRule ^sendung/serie_minus/(\d+)\.html[\?]?(.*)$ /agenda/aggregate.cgi?previous_series=$1&$2 [L]
</IfModule>
</Directory> </Directory>
<Directory /home/calcms/website/agenda_files> <Directory ${base_dir}/website/agenda_files>
AllowOverride All AllowOverride All
Options -Indexes -FollowSymLinks -MultiViews -ExecCGI Options -Indexes -FollowSymLinks -MultiViews -ExecCGI
Order allow,deny
Allow from all
Require all granted Require all granted
</Directory> </Directory>
#mod_perl
<IfModule mod_perl.c> <IfModule mod_perl.c>
PerlSetEnv LC_ALL en_US.UTF-8 PerlSetEnv LC_ALL en_US.UTF-8
PerlSetEnv LANGUAGE en_US.UTF-8 PerlSetEnv LANGUAGE en_US.UTF-8
@@ -127,26 +132,26 @@ This has to be put into your apache server or virtual host configuration
PerlModule Apache2::Reload PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload PerlInitHandler Apache2::Reload
#PerlSetVar ReloadAll Off
SetEnv TMPDIR /var/tmp/ # set local tmp dir
SetEnv TMPDIR ${base_dir}/tmp/
# set base library path # set library directory
PerlSetEnv PERL5LIB /home/calcms/lib/calcms/ PerlSetEnv PERL5LIB ${base_dir}/lib/calcms/
PerlPostConfigRequire /home/calcms/lib/calcms/startup.pl
# preload libraries
PerlPostConfigRequire ${base_dir}/lib/calcms/startup.pl
</IfModule> </IfModule>
#### END_OF_FILE #### ### install required perl modules
=== install required perl modules === There are debian packages for most required perl modules.
You can install CPAN packages, if you cannot use debian packages.
For debian/ubuntu there are packages for most required modules. For example there is no debian package for Image::Magick::Square, so you can install it by "cpan Image::Magick::Square".
If you cannot install packages you can use the CPAN perl package install.
For Image::Magick::Square no deb package exists, you need to install it by "cpan Image::Magick::Square"
apt-get install <deb-package> apt-get install <deb-package>
== Install by deb package == #### install debian packages
mariadb-server mariadb-server
build-essentials build-essentials
@@ -173,66 +178,78 @@ libtext-wikicreole-perl
liburi-escape-xs-perl liburi-escape-xs-perl
perlmagick perlmagick
== Install by CPAN perl packages == #### Install CPAN packages
cpan <perl-package> cpan <perl-package>
Apache2::Reload
Apache2::Request
Apache2::Upload Apache2::Upload
Apache::DBI Apache::DBI
Authen::Passphrase Authen::Passphrase
Authen::Passphrase::BlowfishCrypt Authen::Passphrase::BlowfishCrypt
Calendar::Simple Calendar::Simple
CGI::Simple
CGI::Session
CGI CGI
CGI::Carp CGI::Carp
CGI::Cookie CGI::Cookie
CGI::Session
CGI::Simple
Config::General Config::General
Data::Dumper Data::Dumper
DateTime
Date::Calc Date::Calc
Date::Manip Date::Manip
DateTime
DBD::mysql DBD::mysql
DBI DBI
Encode Digest::MD5
File::stat Encode::Locale
HTML::Entities
HTML::FormatText HTML::FormatText
HTML::Parse HTML::Parse
HTML::Template
HTML::Template::Compiled HTML::Template::Compiled
HTML::Template::Compiled::Plugin::XMLEscape HTML::Template::Compiled::Plugin::XMLEscape
JSON
MIME::Base64
MIME::Lite
Text::Diff::FormatedHtml
Text::WikiCreole
Time::Local
Time::localtime
URI::Escape
Image::Magick Image::Magick
Image::Magick::Square Image::Magick::Square
JSON
MIME::Lite
ModPerl::Util
Session::Token
Text::Diff::FormatedHtml
Text::Markdown
Text::WikiCreole
URI::Escape
==== Configure ==== #### Configuration
edit configuration at website/config/config.cgi edit configuration at website/config/config.cgi
==== inject calcms into any CMS ==== Now you can connect to web gui
to frequently update calcms integration create a cronjob to run tools/update_page.sh https://<localhost>/agenda/planung/
you may have to update the paths inside update_page.sh
=== connect to Admin interface
https://localhost/agenda/planung/
ccAdmin ccAdmin
shug!3Lu shug!3Lu
=== how to migrate schema from one version to another one # inject calcms into your website
calcms uses a copy of your web page as a template to have the same layout as your web site.
To update calcms content create a cronjob to run tools/update_page.sh
you may have to update the paths inside update_page.sh
# how-to
## update time zones
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -p
if using plesk, use
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u admin mysql -p`cat /etc/psa/.psa.shadow`
## create database schema deltas for updates
cat calcmsOld.sql | mysql -u root calcmsOld cat calcmsOld.sql | mysql -u root calcmsOld
cat calcmsNew.sql | mysql -u root calcmsNew cat calcmsNew.sql | mysql -u root calcmsNew
mysqldiff --force --changes-for=server2 --difftype=sql calcmsOld:calcmsNew > migrate.sql mysqldiff --force --changes-for=server2 --difftype=sql calcmsOld:calcmsNew > migrate.sql
# make sure lines with "modified_at" contain "ON UPDATE CURRENT_TIMESTAMP" # make sure lines with "modified_at" contain "ON UPDATE CURRENT_TIMESTAMP"
# for example: `modified_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP # for example: `modified_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP