The EuroCMS Installer Module

AuthorVersion
Imri Paloja1

This is the Installer module. You only can view this during first install.

In steps what the installer does.

Features

  • INSTALLER_MODULES_INSTALL

This will display all the available modules to install via the installer.

Step 1: ips.txt

Check if the /ips.txt file exists. This file needs to exist in the root directory of the project folder, next to the index.php file.

With the ips.txt file you can IP protect the Installer. This is so that no one else in the world can access your installer.

The text file supports one IP per new line in the ips.txt file.

Example:

127.0.0.1
127.0.0.2

Then, save your ips.txt file, again, next to EuroCMS index.php file.

At first install, your /ips.txt, will be read, and if the IP address of the visitor does not match the IP in the ips.txt file, the script will not continue with the installation.

Step 2: Dependencies

Dependencies will be checked for every ECMS component:

  • core

  • libraries

  • modules

  • widgets

The type of dependencies can be PHP modules, or other Linux binary files like exiftool.

EuroCMS needs certain php modules installed. It will check if those are installed. If they are not, it will not continue, with the installation, until the dependencies are installed.

EuroCMS will display the modules needed, and if the information is available for your Linux distro, also display installation steps for the missing dependencies.

Step 3: Installation form

After the /ips.txt and dependencies check has passed, you get the installation form, where you can fill in your:

User credentials

  • user name

  • first name

  • email

  • password

Fill in your database credentials:

For now, the only supported DB is MariaDB.

  • hostname

  • password

  • username

  • port

Step 4: Installing

If the INSTALLER_MODULES_INSTALL installer options is set to true, the modules tab with all the available modules to install, are shown.

The modules that were selected will be installed, this is done in the following ways:

This examples uses the Files modules

  • Check module requirements()

The Files/requirements.json file of every selected modules will be read and it's settings will be applied. Such as, but not limited to: sql databases, feature permissions, Dashboards, Planner items, ajax url, license acceptance.

  • Set in the modules database table, the activated modules.

Finished installation

After the installation has finished, you will de redirected to the website, and from /admin you can login with your user credentials.

And from their on, you can manage your EuroCMS website.

Browse the EuroCMS modules, to view what you can do with EuroCMS.

Contemplate

These are idea to think about for future versions.

Read Only Files?

For a module developer, make available a READ_ONLY option, with the following available options:

  1. ALL - where every file, during module installation is made read only, via file system, using chattr.

  2. file.json, file.php: a comma seperated list of files that need to be read only.

  3. dynamic: comma separated list of files to make read only, that will exist in the future.

Benefits

  • Security

The files can never be modified, by malicious code, should there ever be such a thing.

  • Trust

Features like these build trust within the user base and community, that EuroCMS has all possible security options readily available for whatever environments that it maybe installed on.

Drawbacks

  • Does complicate the overall ECMS project?

Dependencies

  • Chattr?

chattr is a Linux CLI, that allows you to "change file attributes on a Linux file system". Meaning you can make specific files, non editable.

Not by default supported in PHP. So, the best we can do is a ~~shell_exec("chattr +i \"$file\"");~~.

Apparently it is supported: https://www.php.net/manual/en/ref.xattr.php

Per step installation?

Fill in user credentials, AJAX to validation.php,  get sent validation e-mail, get return token input field, paste token, token passed, Ajax return database credentials input fields, check if they are correct, installation passed. redirect to /.

Automatic installation

via curl, and some custom headers, authentication, you can install everything you need automatically.