docs / controller

Almalinux / Rocky Linux 8 Example Installation

In our example we will setup a Zonecloud controller under a Centos 8 server with FQDN (hostname) controller.nixpal.com

Required packages installation

Installing Remi, Epel, Apache httpd, PHP 7.4, Ioncube and Let’s Encrypt certbot

dnf update -y
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
dnf install yum-utils wget curl epel-release -y
dnf module reset php
dnf module install php:remi-7.4
dnf install php74-php-ioncube-loader.x86_64
dnf install php-fpm php-mysqlnd php-zip php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json
dnf install httpd-tools.x86_64 httpd.x86_64
dnf install php-ioncube-loader

Enable, start and test Apache / PHP

systemctl enable php-fpm
systemctl enable httpd
systemctl start php-fpm
systemctl start httpd
echo '<?php phpinfo();' | sudo tee /var/www/html/info.php

At this point you should have a fully working Apache httpd with PHP and Ioncube. Test with php -v

php -v
PHP 7.3.16 (cli) (built: Mar 17 2020 10:18:38) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.16, Copyright (c) 1998-2018 Zend Technologies
with the ionCube PHP Loader + ionCube24 v10.3.9, Copyright (c) 2002-2019, by ionCube Ltd.

Apache Configuration

Create Controller’s VirtualHost

nano /etc/httpd/conf.d/controller.conf
<VirtualHost *:80>
DocumentRoot "/var/www/controller/public/"
DirectoryIndex index.php
ServerName controller.nixpal.com

<Directory "/var/www/controller/public/">
Options -Indexes
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>

</VirtualHost>

Create the folder if it doesn’t already exists and restart httpd

mkdir /var/www/controller
mkdir /var/www/controller/public
systemctl restart httpd

Configuring Let’s Encrypt

Let’s encrypt requires snap now.

dnf install mod_ssl openssl
dnf install epel-release
dnf upgrade
dnf install snapd
systemctl enable --now snapd.socket
ln -s /var/lib/snapd/snap /snap
snap install core
snap refresh core
ln -s /var/lib/snapd/snap /snap
snap install --classic certbot
ln -s /snap/bin/certbot /usr/bin/certbot
certbot --apache

Install Composer

wget https://getcomposer.org/installer -O composer-installer.php
php composer-installer.php --filename=composer --install-dir=/usr/local/bin

MariaDB Installation

dnf install mariadb mariadb-server
systemctl enable --now mariadb
mysql_secure_installation
mysql -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.3.17-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> CREATE USER ‘controller’@’localhost’ IDENTIFIED BY ‘SuperStrongPassword!’;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> CREATE DATABASE controller CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
Query OK, 1 row affected (0.002 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON controller.* TO ‘controller’@’localhost’;
Query OK, 0 rows affected (0.001 sec)

Zonecloud Controller Package installation

cd /var/www/controller
wget https://repo.nixpal.com/controller/zcloud-controller-latest.zip
unzip zcloud-controller-latest.zip

Import Database:

mysql -p controller < db.sql

Edit .env config file, complete DB credentials, URL and License Information Like this example:

APP_NAME=zCloud
APP_ENV=local
APP_KEY=ThisIsAStrongKeyButChangeItAnyWay
APP_DEBUG=false
APP_URL=https://controller.nixpal.com

ZCLOUD_LICENSE="ZCWeb-XXXXXXXXXXXX"

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=controller
DB_USERNAME=controller
DB_PASSWORD=SuperStrongPassword!

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MAIL_DRIVER=smtp
MAIL_HOST=mail.nixpal.com
MAIL_PORT=25
MAIL_USERNAME="zcloud@nixpal.com"
MAIL_PASSWORD="SuperStrongPassword"
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=zcloud@nixpal.com
MAIL_FROM_NAME="zCloud"

Final Steps

php artisan key:generate
Application key set successfully
composer install –no-dev
chown -R apache:apache /var/www/controller/

CronJob:

crontab -e
* * * * * cd /var/www/controller/ && php artisan schedule:run

SELinux Configuration

setsebool -P httpd_read_user_content 1
setsebool -P httpd_can_network_connect 1
setsebool -P httpd_can_network_connect_db on
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/controller(/.*)?"
restorecon -RFv /var/www/controller

Finish setup in web interface

Now go to https://<server’s hostname>/. In our example it’s https://controller.nixpal.com

Default username is admin@example.com and password admin_!@

You can start creating a Cluster. For example “Nixpal” and then Adding servers to this Cluster.

We recommend creating 2, or 3 or 4 DNS Servers Nodes first, and then add all of your Web Servers (Agents).