Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Installation Guide

Taylor Broad edited this page Jan 25, 2020 · 13 revisions

Due to the variations of environments, we need to break out the installation guide into 3 different sections: Dedicated Hosting (VPS), Shared Hosting /w SSH and Composer and Shared Hosting without SSH and Composer.

To understand what section you fall in, Here's a list of scenarios and examples.

Dedicated Hosting - You have direct control over the entire operating system installed on either a virtual machine or a physical machine.

Shared Hosting Overall Definition - This means you don't have direct control over the operating system and software installed and instead are presented with a control panel (cPanel, Webmin, etc) to manage your website. Your hosting account is usually stored in the /home/[account] folder and you have your public_html folder for where your website goes.

Shared Hosting /w SSH and Composer - The above except your hosting company allows for you to make changes and run commands in a Secure SHell method (using PuTTY or macOS Terminal). Composer, a php dependency tool, is also installed on the server to manage php libraries which Laravel uses.

PLEASE NOTE THAT EVERY SHARED HOSTING ENVIRONMENT IS COMPLETELY DIFFERENT FROM ANOTHER. PLEASE CONSULT YOUR HOSTING COMPANY FOR QUESTIONS IN REGARDS TO SUPPORTING LARAVEL. IF THEY CANNOT SUPPORT LARAVEL, FIND A NEW HOST.

Dedicated Server

Due to the many variations of operating systems you will find floating around in the linux space for dedicated hosting, we will be primarily focussing on Ubuntu 18.04 LTS. This operating system is the one that is being used to power the VAOS master server.

Pre-requisites

Instead of making this guide way longer, Here is a guide to setup a secure hosting environment using nginx, MySQL 5.7, and PHP 7.0; also known as the LEMP stack.

https://goo.gl/urUJFt

What's not listed is how to update to PHP 7.1. That you can find rather easily by using our friend Google.

The full list of requirements are as follows

  • MySQL 5.7
  • nginx 1.12.1 or Apache 2.4
  • PHP 7.0 and up (FPM version for nginx)
  • Git for updates
  • Composer (either via the .phar file or globally)

Pulling in the VAOS Project From GitHub

With all our pre-requisites in place, it is now time to download the project. First we should decide on a installation directory. /var/www is created when you first install nginx. You can either create a sub directory to host the site in there, or put it in your linux home folder /home/[yournamehere]. Both methods are perfectly valid as long as the permissions are setup properly.

Now, that we have decided, let's pull in the project. First, lets go over the syntax we will be using.

git clone [repository address] [folder name]

So, let's see it in action:

cd /var/www
git clone https://github.com/fsvaos/vaos VAOS

This pulled the project and the latest updates from GitHub into the /var/www/VAOS folder.

Running Composer to Install Dependencies

Next we need to pull all of our dependencies into the project folder. Without this step, you will have 500 error's everywhere. To do this, there are 2 methods, if you installed Composer globally on your server (the recommended method), you can simply run this command:

composer install

However, if you do not have composer installed globally, there's a second method. On the composer website, download the manual composer.phar file located in the large list of versions near the bottom of the download page. Upload it to your server in the same directory as the project folder and simply do:

php composer.phar install

This method is also good if you are having issues with the php CLI spitting out errors regarding versions from dependencies.

.env File Copy

This next step is rather simple. Now we need to make a copy of the example .env file to make it an active file. To do so, just run this command:

cp .env.example .env

What .env File???

Since the .env file starts with a ., the operating system treats this file as a hidden one and therefore cannot be seen by running a simple ls command.

Your Home Free

Assuming you have your web server now pointed to the /var/www/VAOS/public directory, navigate to http://yoursite.com/setup to complete the rest of the installation.

Shared Hosting with SSH

Shared hosting can be a convenience for operations of your website, however can be a headache on the setup. If you have secure shell access, the dedicated hosting steps are basically the same steps you can do. They can vary in a few ways however depending on how the company has their root website assigned on your account. Sometimes you cannot control where the root of the website is and therefore is locked to the public_html folder.

Thankfully, we compile a folder complete with the below modifications. You can download the latest revision of this file here: https://storage.googleapis.com/us.assets.fsvaos.net/vaos-2.0_sh.zip

If you decide to instead download directly from GitHub, use the following steps below:

  1. Install the binary files located here. (https://github.com/fsvaos/vaos/releases)
  2. Copy the contents of the VAOS/public directory to the public_html folder
  3. modify the index.php and legacy_ACARS/boot.php files to point back to their appropriate directories.

IF YOU DON"T HAVE A VENDOR FOLDER, YOU HAVE THE WRONG DOWNLAOD. LOOK FOR THE .TAR FILES

How to modify the index.php file to direct to the VAOS folder.

With code examples, let's dive into modifying these files so they point back to the appropriate directories. First we need to know how the linux directory structure works and how it finds it's files. To do so, let's breakdown this example from the index.php file:

require __DIR__.'/../bootstrap/autoload.php';

First thing on the list (other than require) is __DIR__. This is a function which gives the location of the currently executing file. This is not as important as the next part.

../ means move back one directory. This is the equivalent of the back button in Explorer or Finder. So why is this important?

Well the directory structure of a standard Laravel application is as follows:

| VAOS
|-- app
|-- bootstrap
|-- config
|-- database
|-- public (entry point)
|-- resources
|-- routes
|-- storage
|-- tests
|-- vendor

if our entry point is within the public folder, basically what '/../bootstrap/autoload.php' is doing is asking to go up to the project directory and then enter the bootstrap directory.

** How do we apply this knowledge??**

Simple. Since the contents of VAOS/public are in the public_html, we need to point it to the VAOS directory now since it won't find bootstrap one directory up. In other words:

require __DIR__.'/../VAOS/bootstrap/autoload.php';

So now that I explained it, let's get into the code you need to modify and the use case.

On Root of public_html folder

Modify Line 22 and 36 in index.php:

require __DIR__.'/../VAOS/bootstrap/autoload.php';

$app = require_once __DIR__.'/../VAOS/bootstrap/app.php';

Note: The following steps are for Pre-2.0 installations and do not apply anymore. Modify Line 13 in legacy_ACARS/boot.php:

$dotenv = new \Dotenv\Dotenv(__DIR__."/../../VAOS");

Sub Domain in public_html folder

If you are placing a sub domain folder (public_html/vaos) Do this:

Modify Line 22 and 36 in index.php:

require __DIR__.'/../../VAOS/bootstrap/autoload.php';

$app = require_once __DIR__.'/../../VAOS/bootstrap/app.php';

Modify Line 13 in legacy_ACARS/boot.php:

$dotenv = new \Dotenv\Dotenv(__DIR__."/../../../VAOS");