First steps

In this article we’ll learn to install and manage web apps in an easy way and we’ll also see the technologies there’re behind GorillaJS.

Before starting I would like to explain some concepts:

  • Web applications: In computing, a web application or web app is a client–server software application in which the client (or user interface) runs in a web browser. Common web applications include webmail, online retail sales, online auctions, wikis, instant messaging services and many other functions. (Source Wikipedia).
  • Web server: a local or remote engine that is in charge of processing the http calls we make through the web browser to our app.
  • Command line (CLI): is a means of interacting with a computer program where the user (or client) issues commands to the program in the form of successive lines of text. (Source Wikipedia).
  • NodeJS: an execution environment that allows to use Javascript on the server side and build apps like GorillaJS.
  • NPM: local manager of packages and NodeJS libraries.
  • Docker: a free code multiplatform tool that produces light virtual engines which start in an easy and fast way and they are remote between them. Is something like VirtualBox but more powerful lighter and it’s completely based on Linux. It’s becoming on the standard and it’s used by the most of big business and servers.

What is GorillaJS?

GorillaJS is a program developed in NodeJS that allows you to install and manage web apps easily in your local computer or remote server. To start to use it you have to install NodeJS and Docker. Here you have an article that helps you to do it. Then you’ll be able to install GorillaJS with the command:

$ npm install -g gorillajs

You don’t need to know how to program in NodeJS or have heard about Docker to use GorillaJS: you only need to know how install it. Although you can also learn these things.

GorillaJS is divided in three parts: core, installers and plugins.

Core

The core is in charge of managing the question and the answers we introduce in the command line and they serves to configure the app. It also takes on starting the installers.

Installers

A installer is a folder that contains the files with which GorillaJS will build the app. A installer needs at least a docker-compose.yml file that includes the required data to build Docker containers. You have several installers that GorillaJS has automatically. If you don’t find your type, you can create one as you like.

Plugins

GorillaJS not only serves to install apps but also to go with you over the development process. With the plugins you can add usefulness to your app: database management, share your project, backups, SSL…

 

Install an app

Before you start we’ll make some checks to avoid problems.

  • Mac
    • The Docker app have to be started.
    • We have to share with Docker the file in which we’ll install our projects. Sharing a total folder is the easiest thing, like Users or Documents. Click on  Docker’s icon of the toolbar -> preferences ->File Sharing and then we put the absolute path toward our folders.  
  • Windows
    • The Docker app have to be started.
    • We have to share with Docker the unit in which we’ll install our projects. Click on Docker’s icon of the toolbar -> settings -> Shared Drives -> and we mark the unit in which will be our folders.
    • We must log into the console as an admin in order that GorillaJS could write in the hosts file.
  • Mac and Windows
    • Automatically, GorillaJS tries to use the 80 port in order that you could access to your projects without needing to use the http://mylocalproject:8568 url. You can access using the http://mylocalproject url. You’ll have to make sure there is no app using the 80 port to allow to GorillaJS uses it (recommended). It’s commonly used by Xampp, Mammp, Web Deployment Agent Service in Windows y the Apache server in Mac.

Build command

After checking, we can start with the installation. In this example we’ll use the WordPress installer that GorillaJS has automatically. 

Open the terminal and write:

$ gorilla build my-project

It will start a new project in my-project folder.

From here the installer will ask you several data that needs to configure the project: kind of installer, domain name, credentials you want to use for the database…

 

 

 

After finishing this process, GorillaJS saves all the data in the (my-project/.gorilla/gorillafile) file to build again the app when it’s necessary. From here everything is automatic. You won’t have to do anything else. In just a few seconds your app will be ready.

If you open my-project folder you’ll notice that GorillaJS has created two folders:

  • gorilla: where GorillaJS saves all your configuration projects. This folder is managed by GorillaJS.
  • app: is the server published folder in which is installed WordPress.

Depending on the operating system you use you might have some configuration problems: the port 80 isn’t free because other program is using it or because you haven’t given folder permission to Docker. In the FAQ’s section you will find solutions to the most common  problems you can come across using GorillaJS.

If you need to change some configuration data you’ll have to build again your project adding the -f parameter.

$ cd my-project

$ gorilla build -f

 

Run command

The run command allows you to start the project up when it’s built. If you used always the build command you would do operations over without needing and wasting your time.

$ cd my-project

$ gorilla run

 

Using a plugin

According to the WordPress example, now we are going to use the plugin Adminer in order to install a database manager. Installing a plugin is very simple:

$ cd my-project

$ gorilla plugin add adminer

When it’s installed we have to build our project again.

$ gorilla build

And we can already access to the admin adding /adminer to the url we had chosen for our project:

http://myproject.local/adminer, for example.

The NodeJS installer

The NodeJS template that comes as a default in GorillaJS uses the Express.js framework to start a server and return a response. This is optional, and once the application is running we can eliminate this server and use the application in any other way.

FAQ’s

Why do you need to free the port 80? Can you make your own installers? Can you use GorillaJS in a remote server?