Debian
How to install PureLife Cloud on Debian/Linux:
It is assumed in the following sections that the installation is done under Debian/Linux (x64).
PureLife Cloud also works on other platforms and the instructions should transfer, but we do not provide support for this. Please feel free to contact us for more information.
For the installation, we assume that the following packages are installed.
Preparation
Before you start the installation, you should make sure that the following components are present:
- A bash (or other) terminal
- A PostgreSQL >= 13 database server and database
- The MQTT broker Mosquitto with the mosquitto-go-auth plugin, if authentication is to be used. If no authentication is to be used (not recommended), any other MQTT broker can be used.
- (Recommended) A domain name pointing to your server (e.g. example.com)
- (Recommended) A web server, e.g. nginx
- (Recommended) SMTP access data for an email account to send service emails
You should also create a user who will later start the server:
Installation
First switch to the user who will later be responsible for running the PureLife Cloud instance.
Download the latest available version for your platform from the PureLife Cloud, copy it to the computer and unzip it.
You should now see a binary purelife-cloud
which you should first check with ./purelife-cloud -h
. After that you can you create a configuration file.
You should now see a new folder config
with a file config.toml
. From now on, the file is used for Configuration of the PureLife Cloud Instance.
Configuration
First should be under SqlSettings.DataSource
the DSN for the PostgreSQL database connection be deposited. The following DNS can serve as a template:
The URL under which the page can later be reached should also be set under HttpSettings.SiteURL
. A trailing backslash should be removed. If the access to the URL is secured by HTTPS
(strongly recommended), a URL for unencrypted access to the PureLife Cloud must also be specified under HTTP.LegacyFirmwareURL
.
Under MQTT
you need to specify the URL through which Mosquitto can be reached. If you created an MQTT account for the PureLife cloud when setting up Mosquitto, you should also store it under MQTT
. Otherwise, PureLife Cloud will automatically create a account, which Mosquitto will query via the Auth plugin.
The connection to the database can now be tested directly. For this purpose, a first user should be created, which is then automatically also the administrator of the application. (More users can be added later via the frontend).
Now that you have a connection to the database, you should configure the server mails directly. To do this, you must enter your SMTP access data under SystemSMTPSettings
and under SystemSettings.AdminMail
Enter email address.
To complete the setup, you should save the secret key under ServiceSettings.SecretKey
! This one is for it responsible for partially encrypting the data in your database. If the Secret Key is lost or overwritten the data in your database is useless.
System-Service
If you want the PureLife Cloud instance to start automatically with your server, a system service must be created.
1. Create a systemd file for the PureLife Cloud instance
2. Open the file with a text editor and paste the following content.
If PostgreSQL is installed on another server, After=postgresql.service
and BindsTo=postgresql.service
must be removed.
3. After saving, the new service must be recognized.
4. Check if the file was recognized.
You should now see something like the following output.
5. You have created the service and can start it.
6. Check if the instance is started.
As an output, you should see an HTML file that the instance sent.
7. You can now enable the service to start automatically with your computer.
Try it
Now that the cloud instance is up and running, you can adjust the configuration or log in. To do this, open the URL http://127.0.0.1:8080 locally on the server or using the IP address of the server from another computer.
Other useful adjustments
System
Enter the domain of the server in the hosts file.
Database
Activate extensions.
Test the SMTP configuration
Configure logrotate
Create the file /etc/logrotate.d/purelife-cloud
, with the following content.
Test the configuration with logrotate -f -v /etc/logrotate.d/purelife-cloud