Backend Knowledge Sharing #24

Laravel Envoy, Domain and hosting reselling using WHMCS

Bikalpa Thapa
YoungInnovations' Blog

--

Table of Contents

  1. Laravel Envoy
  2. Domain and hosting reselling using WHMCS

Laravel Envoy

This week Akita Nakarmi shared insights on what Laravel Envoy is, when and how can we use it.

Laravel Envoy is a simple task runner, provides a clean, minimal syntax for defining common tasks you run on your remote servers. It uses the blade templating language as a way to script actions. You can easily setup tasks for deployment, Artisan commands, and more. Require PHP version 5.4 or greater.

Installation

composer global require laravel/envoy

Make sure to place the ~/.composer/vendor/bin directory in your PATH so the envoy executable is found when running the envoy command in your terminal.

Create Envoy.blade.php file in the root of your project.

@servers(['web' => ['user@192.164.1.1']])@task('list', ['on' => 'web']
ls -la
@endtask

Within your @task declarations, you should place the Bash code that should run on your server when the task is executed.

In @servers we define an array of servers, allowing you to reference these servers in the on option of your task declarations.

To run Envoy

envoy run list

You can force a script to run locally by specifying the server’s IP address as 127.0.0.1:

@servers(['local' => '127.0.0.1'])

You can also pass option values into Envoy tasks using the command line:

envoy run deploy --branch=master

To access the variable with the help of “echo” syntax.

@servers(['web' => '192.134.1.1'])@task('deploy', ['on' => 'web'])
cd site
@if ($branch)
git pull origin {{ $branch }}
@endif
php artisan migrate
@endtask

Task across multiple servers

Add additional servers to your @servers and each should have a unique name assigned. In the task’s, on list servers where you want it to run.

@servers(['local'=>'127.0.0.1','web-1' => '192.164.1.1', 'web-2' => '192.164.1.2'])@task('deploy', ['on' => ['web-1', 'web-2']])
cd web/current
php artisan migrate
@endtask@task('list',['on'=>'local'])
ls -la
@endtask

Tasks will be executed on each server serially.

For Parallel execution

You can add the parallel option to your task declaration for the parallel execution.

@servers(['local'=>'127.0.0.1','web-1' => '192.164.1.1', 'web-2' => '192.164.1.2'])@task('deploy', ['on' => ['web-1', 'web-2'],'parallel'=>true])
cd web/current
php artisan migrate
@endtask

Confirming Task

You should add the confirm directive to your task declaration to prompt the confirmation before running the task.

@servers(['local'=>'127.0.0.1','web-1' => '192.164.1.1', 'web-2' => '192.164.1.2'])@task('deploy', ['on' => ['web-1', 'web-2'],'confirm'=>true])
cd web/current
php artisan migrate
@endtask

For more information be sure to visit Laravel Envoy page on the official Laravel page.

Domain and hosting reselling using WHMCS

Mani Bibek Acharya shared his insights on WHMCS — a Webhosting automation tool.

WHMCS

WHMCS is a Webhosting Automation tool including Billing System.

Some of its features are

  • Modular, extensible, well-documented API’s and ORM all make developing with and customising WHMCS easy.
  • Takes care of automating things so you don’t have to, saving you valuable time and money.
  • Integrated with all the leading web hosting control panels and domain registrars for automatic provisioning and management.
  • WHMCS is a secure, dependable and scalable solution designed for businesses of all sizes and backed by an awesome support team.

Domain Registration

We can use various domain registration systems listed in WHMCS or we can create our own plugin for systems not supported in WHMCS.

Hosting

User can integrate various hosting platforms such as Cpanel, Plesk and automate the user accounts allocation. Admins can create different packages for disk space, email accounts, bandwidth etc.

WHMCS is a very useful tool to manage domain and hosting registrations. It takes care of almost all the features any hosting administrators would wish for. You can go here for complete information.

--

--