CWP DataCenter Panel - installation
==============================

One panel for all your CWP servers: health, accounts, backups, SSL, alerts, updates.

Requirements
------------
- PHP-FPM 8.3 or newer with curl, openssl, PDO (MySQL or SQLite), mbstring
- ionCube Loader for that PHP version (the package is encoded). On CWP it is there already;
  if not: sh /scripts/update_ioncube restart
- A MySQL/MariaDB database (or SQLite for small setups)
- HTTPS for the panel's domain
- The managed CWP servers need CWP with API v2 and /scripts/datacenter_addserver

Install (on a CWP server)
-------------------------
1. Create a hosting account for the panel, e.g. datacenter.example.com.
   Set the domain to PHP-FPM 8.3 (or newer), and request AutoSSL.
2. Create a MySQL database and user in that account.
3. Unpack the package and move the CONTENTS of its folder cwp-datacenter-<version>/ into public_html
   (remove the default index.html):
       cd ~/public_html && rm -f index.html && unzip cwp-datacenter-*.zip && mv cwp-datacenter-*/* . && rmdir cwp-datacenter-*
4. Open https://datacenter.example.com/install.php and follow the page.
   It checks the requirements, creates the tables and the admin, and shows the cron line.
5. Add the cron line it shows, as the account (CWP: Cron jobs of that account).
6. Log in and turn on two-factor login on your profile.

The panel must be able to reach its CWP servers on port 2304. On the panel's server, as root, once per
managed server:
    /scripts/datacenter_allow <IP of the managed server>
It opens port 2304 in CSF (TCP_OUT) and allows that IP in CWP Secure Kernel.
Note: the Secure Kernel list is per server, not per account: every website on the panel's server may then
reach the API port of the managed servers (they still need a token). A dedicated server or VPS for the
panel is the safest setup.

Add a server
------------
On the CWP server, as root:
    /scripts/datacenter_addserver <public IP of the panel>
Paste the line it prints (CWPDC1.) into the panel: Add server.
Or create an enrollment code in the panel and run the command it shows: the server adds itself.

Update
------
Unpack the new package over the panel folder. config.php and data/ are not in the package and stay.
Open the panel once: the database is upgraded automatically.
The panel tells admins at the top of every page when a new version is available.

Web servers other than Apache
-----------------------------
src/, pages/, templates/ and data/ are protected with .htaccess. On nginx add:
    location ~ ^/(src|pages|templates|data)/ { deny all; }
    location = /config.php { deny all; }

(c) CWP Control Web Panel - https://control-webpanel.com
