Files
VPS-scripts_Web-V2/Docs/docs/Dev-Adding-CMS.md

3.3 KiB

List of possible Files and expected Structure

  • CMS/<NewCmsName>/
    • conf.sh
    • preconf.sh
    • generic.pkg.list
    • apt.pkg.list
    • dnf.pkg.list
    • <Webserver>-conf.sh
    • <Webserver>-preconf.sh
    • <Webserver>-generic.pkg.list
    • <Webserver>-apt.pkg.list
    • <Webserver>-dnf.pkg.list
    • <Webserver>-unconfigured

File Explanation

File Name Description
preconf.sh Pre config/apt install commands runs for all web servers
conf.sh Configuration runs for all webservers
generic.pkg.list packagelist for this webserver and php for all distro's
apt.pkg.list packagelist for this webserver and php for distro's that use apt
dnf.pkg.list packagelist for this webserver and php for distro's that use dnf/yum
<Webserver>-preconf.sh Pre config/apt install commands runs for specified webserver
<Webserver>-conf.sh Configuration runs for specified webserver
<Webserver>-generic.pkg.list packagelist for specified webserver for all distro's
<Webserver>-apt.pkg.list packagelist for specified webserver for distro's that use apt
<Webserver>-dnf.pkg.list packagelist for specified webserver for distro's that use dnf/yum
<Webserver>-unconfigured webserver(vhost) config

Example File Content for minimal CMS using NGINX

nginx-conf.sh

#Getting Nginx SiteConfig
curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CMS/<CMSName>/Nginx-unconfigured -o /tmp/nginx-siteconf

#Configuring Nginx SiteConfig
sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/' /tmp/nginx-siteconf
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/nginx-siteconf' -e '/#ConfHere/c\' /etc/nginx/sites-enabled/"$domain"

#Crating dir for serving documents
mkdir -p /var/www/"$domain"/html
chown www-data:www-data -R /var/www/"$domain"/html

#Restarting Nginx
systemctl reload nginx

Nginx-unconfigured

#Getting Nginx SiteConfig
curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CMS/<CMSName>/Nginx-unconfigured -o /tmp/nginx-siteconf

#Configuring Nginx SiteConfig
sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/' /tmp/nginx-siteconf
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/nginx-siteconf' -e '/#ConfHere/c\' /etc/nginx/sites-enabled/"$domain"

#Crating dir for serving documents
mkdir -p /var/www/"$domain"/html
chown www-data:www-data -R /var/www/"$domain"/html

#Restarting Nginx
systemctl reload nginx

Make sure the config always starts with #beginConf and ends with #endConf
So the installer can keep track of the config

Defining in the menu

Add the following to ModulesMenu.list

For each webserver a list define seperate.

Rules for Cms names in menu

  • a “:” needs to be appended
  • the repo name must not contain capital leters
  • the name need a “/” pre and appended

Example CMS name: "test-cms"

For Whiptail

add under the previous “CMSL+” make sure to add to all supported webservers

<WebserverName>CMSL+=("<CMSName>:" "<CMS Description>." OFF)

For legacy

add to the “<WebserverName>CMSL variable after the last entry and before "None" Make sure the the entry is quoted, otherwise the installer will break