README.md

Fundamentals

Basic knowledge of the following technologies, and in some cases an experienced or advanced understanding, are not required but may be nesisary for understanding this stack.

  • cli
  • sql
  • javascript
  • graphql
  • json
  • yml
  • markdown

Technology

Outside of the fundamentals this stack leverages a handful of standards, specifications, libraries, and frameworks. Below is a quick overview of some of these implementations within fleetgrid.

Requirements

Depending on what you plan on doing, the following dependencies are required as a prerequisite to starting the application.

$ git --version
git version 2.11.1

$ gcloud --version                                                                                          Google Cloud SDK 183.0.0
bq 2.0.27
core 2017.12.08
gsutil 4.28
kubectl 

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.4", GitCommit:"9befc2b8928a9426501d3bf62f72849d5cbcd5a3", GitTreeState:"clean", BuildDate:"2017-11-20T05:28:34Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}

$ virtualbox --help
Oracle VM VirtualBox Manager 5.1.20
...

$ hostile --help
...

$ sudo rabbitmqctl status|grep rabbit
{rabbit,"RabbitMQ","3.6.12"}

$ postgres --version
postgres (PostgreSQL) 10.1

$ docker --version
Docker version 17.09.1-ce, build 19e2cf6

$ xcode-select --version                                                                                    xcode-select version 2349.

$ node --version
v9.3.0

$ npm --version
5.5.1

$ helm version
Client: &version.Version{SemVer:"v2.7.2", GitCommit:"8478fb4fc723885b155c924d1c8c410b7a9444e6", GitTreeState:"clean"}

$ next --version
v3.2.2
$ postgraphql --version
3.5.0
$ nightwatch --version
nightwatch v0.9.16
$ json --version
json 9.0.6

Git

We need no introduction to git.

However, when it comes to code and continuos integration gitlab stands unmatched. Use the following command to copy the repository into your ~/Projects folder; then change directory into it.

$ git clone git@gitlab.com:fleetgrid/fleetgrid.git
$ cd fleetgrid

Install

Install project dependancies into node_module folders. By running this from project's the root directory... it will jump into the subprojects (backend, frontend, etc) and install their dependacies as well.

$ npm install
...

Development Mode

If you intend to develop or run the app locally without containerizing it then running install and dev will get you going.

Start the project locally in a development enviornment. By running this from the project's root directory... it will also jump into the subprojects in order to deploy locally.

$ sudo npm run dev
...

Note: running in development mode has a quick startup time but slow page loads

Production Mode

If you intend to run the app locally with production flags then running install and start will get you going.

$ sudo npm run start

# wait for the the following signal...
# [frontend] > Ready on http://localhost:3000

Note: running in production mode has a slow startup and faster page loads

# Sometimes starting and stopping dev/production modes may leave a process running.
$ sudo lsof -iTCP -sTCP:LISTEN -n -P
Password:
COMMAND     PID    USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
rapportd    334 doorway    3u  IPv4 0x9c5dde6d7ad4ed9b      0t0  TCP *:56353 (LISTEN)
rapportd    334 doorway    4u  IPv6 0x9c5dde6d66957e33      0t0  TCP *:56353 (LISTEN)
Code H  2920 doorway   30u  IPv4 0x9c5dde6d69bc505b      0t0  TCP 127.0.0.1:9333 (LISTEN)
cupsd      7163    root    5u  IPv6 0x9c5dde6d66957873      0t0  TCP [::1]:631 (LISTEN)
cupsd      7163    root    6u  IPv4 0x9c5dde6d73a1d43b      0t0  TCP 127.0.0.1:631 (LISTEN)
postgres  12315 doorway    5u  IPv6 0x9c5dde6d66956cf3      0t0  TCP [::1]:5432 (LISTEN)
postgres  12315 doorway    6u  IPv6 0x9c5dde6d66959af3      0t0  TCP [fe80:1::1]:5432 (LISTEN)
postgres  12315 doorway    7u  IPv4 0x9c5dde6d73db56fb      0t0  TCP 127.0.0.1:5432 (LISTEN)
node      14975    root   15u  IPv6 0x9c5dde6d66958f73      0t0  TCP *:1337 (LISTEN)
node      15151    root   11u  IPv4 0x9c5dde6d732d243b      0t0  TCP 127.0.0.1:80 (LISTEN)

# kill -9 <PID>
$ kill -9 14975

Hosts

In order to access the application through the browser without having to use IP addresses and ports we use an npm package named hostile to manage TLD names locally.

# The following is an example adding TLD names to our local hosts file from the `./hosts.txt` file...
$ sudo npm run load-hosts

Added 6 hosts!


# Likewise you can run the opposite to remove them...
$ sudo npm run unload-hosts

Removed 6 hosts!

Database

From the project root directory the following commands have been exposed; for complete details see ./database/README.md.

# jump into the database folder
$ cd database

# initialize the development database (drop/create database)
$ npm run dev:init

# go back to the root directory
$ cd ..

# run build-schema and build-data then execute development
$ npm run database:dev

likewise similar commands are available for production...

# no ned to jump into the database folder in order to (drop/create database) 
# see deploying to production, dow below, for more info.

# run build-schema and build-data then execute production
$ npm run database:prod

Check the browser

# you should be able to login with the following credentials
username: demo@demo.com
password: demo

Note: you can run the tests with the app running in development mode or production mode

Docker

First log in to GitLab’s Container Registry using your GitLab username and password. If you have 2FA enabled you need to use a personal access token:

# login
$ docker login registry.gitlab.com

Docker is used if you intend to deploy the app further than just running it locally.

# Build the project for containerization.
$ npm run docker:build

# Run the project inside a docker container.
$ npm run docker:run

# Push the project to gitlab registry.
$ npm run docker:push

# Push the project to gcr using gcloud.
$ npm run docker:push:gcr

Versioning

npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]

'npm [-v | --version]' to print npm version
'npm view <pkg> version' to view a package's published version
'npm ls' to inspect current package/dependency versions
Description

Run this in a package directory to bump the version and write the new data back to package.json and, if present, npm-shrinkwrap.json.

The newversion argument should be a valid semver string, a valid second argument to semver.inc (one of patch, minor, major, prepatch, preminor, premajor, prerelease), or from-git. In the second case, the existing version will be incremented by 1 in the specified field. from-git will try to read the latest git tag, and use that as the new npm version.

For full details follow the following link: https://docs.npmjs.com/cli/version

Deploy a new version of fleetgrid (update/upgrade/release)

Container Engine's rolling update mechanism ensures that your application remains up and available even as the system replaces instances of your old container image with your new one across all the running replicas.

# check everything into git
$ git add .
$ git commit -m "<commit message here>"
$ git push

# use this in order to update the applications version 
# npm version [<newversion> | major | minor | patch | ...] 
$ npm version v2.0.0

# Build the project for gcr containerization.
$ npm run docker:build:gcr
# --- or ---
# Build the project for gitlab containerization.
$ npm run docker:build

# Push the project to gcr using gcloud.
$ npm run docker:push:gcr
# --- or --- 
# Push the project to gitlab registry
$ sudo npm run docker:push

Helm: Kubernetes Package Manager

Helm is a tool for managing Kubernetes charts. Charts are packages of pre-configured Kubernetes resources.

Checkout the helm repo for more information: https://github.com/kubernetes/helm

Checkout our README for using Helm to deploy fleetgrid to production: ./chart/README.md

  

About

We are technologically disrupting industries by focusing on one thing; field service.

fleetgrid is owned and operated by the Burandt family.

This site is copyright © fleetgrid 2018. Design and logo copyright © fleetgrid 2018.

v0.0.28

3

What are you waiting for?

Get started with fleetgrid today. It takes minutes to fill in our signup form then just seconds to add your first customer; you will be scheduling work orders and getting paid before you know it.

fleetgrid

fleetgrid

8
3