Installing SGIV10 Demos

Version Date Notes By
0.1 2019-01-18 Initial release JFM

How to install a SGIV10 Demo on the linode test server

This document doesn't include the creation of the subdomain. You must create it and assure that it is propagated before proceeding

This was tested only on the Linode Test Server

This guide assumes you have access to the Linode Test Server

Read everything on this document before putting your hands on the terminal

Before proceeding

  • Check the SGIV10 - Linode Test Server Instalations for the availability of the Redis Databases number and the ports for socket.io. currently the max number is 50

  • Be sure the subdomain is created and available - ping it

  • Be careful and check if the folders and database you are going to use on this installation doesn't already exist.

  • Be sure you know the MySQL Authentication of the server, you will need it

  • This scripts creates a HTTPS Let's Encrypt certificate using certbot. Usually the certificate goes to the folder /etc/letsencrypt/live/<subdomain> and this is assumed on this script automation. If you have any problems with the certificate, check if the configurations files are correct and pointing to the correct certificate

  • You must understand what you are doing :) close this if you don't :D

Script Installation and Execution

  1. Check the folder /root/scripts to see if the repo sgiv10-installations is already cloned. If not, clone it: git clone https://gitlab.wemake.pt/it/scripts/sgiv10-installations.git otherwise do a git pull to update

If you update, always read the changes made on the commits before proceeding

  1. Execute the script by running: ./sgi_project

  2. You will be asked the following information regarding the installation:

Information Notes
Subdomain The subdomain of the demo without the wemake.pt part
Branch Always choose m for the Master branch unless there's the need have a demo to show the latest development. Beware it might be unstable
Client Name Usually WeMake unless it's a demo for a particular client, then you can use the client name.
Licenses number Usually 999
Redis database number Check the SGIV10 - Linode Test Server Installations document for available databases number
Redis cache number Check the SGIV10 - Linode Test Server Installations document for available databases number. Usually its +1 the Redis database number
Laravel echo server Check the SGIV10 - Linode Test Server Installations document for available ports. usually its somewhere on the 6 thousands ending with the Redis database number. Ex: 6021
MySQL Database name Choose an appropriate name that can be related with the subdomain. Usually something like demo## Ex: demo15

After this you will be asked for the modules you want to install, select them (usually all) and press OK.

Review you choices and choose y to start the installation or n to cancel

======================================================

Subdomain: demo16.wemake.pt
Client name: WeMake
Number of licences: 999
Redis database number: 30
Redis cache database number: 31
Laravel Echo Server Port: 6030
Modules to install: wemake/sgi-documents wemake/sgi-plans wemake/sgi-audits wemake/sgi-surveys wemake/sgi-equipments wemake/sgi-suppliers wemake/sgi-risk wemake/sgi-processes wemake/sgi-occurrences wemake/sgi-OHS wemake/sgi-ems wemake/sgi-meetings wemake/sgi-occupational-health wemake/sgi-training

======================================================
Is this information correct(y/n)?

After this, the script install and configures everything needed, including:

Database

  • Creates the database, a user with the same name as the database and a random 32bit password

Backend

  • Clones the backend repo to a folder on the Apache DocumentRoot. Ex: /var/www/demo16-back.wemake.pt
  • Runs composer install, php artisan key:generate, composer require <modules>, php artisan migrate, php artisan reseed-translations and php artisan clear-all-caches
  • Gives the appropriate permissions

Frontend

This script uses an already cloned frontend repo that is located at /root/projects/sgiv10/

  • Runs: git checkout config.js package-lock.json, git pull, jspm install and executes the fix.sh script
  • Exports the code with gulp export
  • Copies the result to a folder on the Apache DocumentRoot. Ex: /var/www/demo16.wemake.pt

Config

  • Creates the Backend and frontend config files, including the echo server
  • Creates the supervisor configurations
  • Creates the virtual hosts on Apache for the frontend and backend
  • Generates a certificate on Let's Encrypt

Finally it reloads Apache and Supervisor and it should be ready to use. Test it on the browser and do some basic testing.

Happy installations! :)