Server - Contents

Mojolicious - Part B

revised: 30-Oct-2021

Prerequisites: a. Basic Server (Debian 10.3 64bit) with Webmin, FTP, Firewall and [optional] iRedmail

Note: Adjust the Firewall, it's to be re-configured to allow port 5000 for testing purposes, if the port has not already been opened.

Mojolicious on a Debian Server

Part B. Create the Perl Environment on the Server

Note: By default, Perl 5 (a fairly recent stable version >5.28) is initially installed and this is the version used. However, use of Perlbrew -see [Dancer-Extras#1] is highly recommended and here it is assumed installed. Open a connection to one's remote server via PuTTy:

Logon the server, via PuTTY, and enter the following commands:

sammy@imega:$ sudo apt update
sammy@imega:$ sudo apt upgrade
sammy@imega:$ sudo apt install build-essential
sammy@imega:$ source .profile // activate perlbrew
sammy@imega:$ cpan -S Mojolicious
sammy@imega:$ cpan -S Crypt::Bcrypt::Easy

Part B2. Testing Mojolicious and Setting Login3 Service
Using FileZilla or other means, upload from the perlexamples directory, the one containing the Login3 website – preferably as a zipped folder than unzip in the sammy home directory.

Step01:Test Mojolicious

sammy@imega:$ sudo apt install unzip
sammy@imega:$ unzip login3.zip
sammy@imega:$ chmod -R 775 login3 // give permissions for service setup.
sammy@imega:$ cd login3
sammy@imega:/login3$ perl script/login_app daemon -l http://0.0.0.0:5000

Enter in the browser, one's domain at port:5000 (eg. http://[MySeverIP]:5000), the result should the welcome page of the Login3 website. Type in the PuTTY console: 'ctl'+c to exit.

Step02: Establishing the Login3 Service

sammy@imega:$ sudo nano /etc/systemd/system/login3.service //see below **
sammy@imega:$ sudo systemctl start login3
sammy@imega:$ sudo systemctl status login3 // 'ctl'+c to exit
sammy@imega:$ sudo systemctl stop login3 // to stop the service

The website is now being served at port:8080 (eg. http://[MySeverIP]:8080). Note: Usually the Firewall will not permit 'outside' access to this port but one can check the output with this bash command: curl http://localhost:8080/

** Copy & paste this text within file: login3.service

Should the login3 service be properly functioning, one can establish its automatic startup at every reboot with the following command:

sammy@imega:$ sudo systemctl enable login3
Note: The daemon server is adequate for light and moderate use. However other servers, such as 'prefork' or 'hypnotoad', can deliver stronger support should the side come under heavier demand.
Warning: There are in the Debian environment, slight differences with regard to that of the Win-PC. Take note of these:
- File names are case-sensitive. Example: myphoto.jpg and myphoto.JPG are seen as different files. If the image is not appearing in your website, check this issue.
- Permissions and Ownerships are concepts deeply implemented in the Linux environment (eg. sammy:www-data, 775 permissions)
Mojolicious Mojo-PartB
Mojo-Deploy Mojo-Extras