-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Grant Miner
committed
Feb 1, 2017
1 parent
f912763
commit 5ffd65c
Showing
180 changed files
with
31,148 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
charset = utf-8 | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build/ | ||
node_modules | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"asi": true, | ||
"node": true, | ||
"browser": true, | ||
"eqnull": true, | ||
"laxbreak": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch", | ||
"type": "node", | ||
"request": "launch", | ||
"program": "app/web/server.js", | ||
"stopOnEntry": false, | ||
"args": [], | ||
"cwd": "./app/web", | ||
"runtimeExecutable": null, | ||
"runtimeArgs": [ | ||
"--nolazy" | ||
], | ||
"env": { | ||
"NODE_ENV": "development" | ||
}, | ||
"externalConsole": false, | ||
"sourceMaps": false, | ||
"outDir": null | ||
}, | ||
{ | ||
"name": "Attach", | ||
"type": "node", | ||
"request": "attach", | ||
"port": 5858 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
// Available variables which can be used inside of strings. | ||
// ${workspaceRoot}: the root folder of the team | ||
// ${file}: the current opened file | ||
// ${fileBasename}: the current opened file's basename | ||
// ${fileDirname}: the current opened file's dirname | ||
// ${fileExtname}: the current opened file's extension | ||
// ${cwd}: the current working directory of the spawned process | ||
|
||
// A task runner that calls the Typescript compiler (tsc) and | ||
// Compiles a HelloWorld.ts program | ||
{ | ||
"version": "0.1.0", | ||
|
||
// The command is tsc. Assumes that tsc has been installed using npm install -g typescript | ||
"command": "tsc", | ||
|
||
// The command is a shell script | ||
"isShellCommand": true, | ||
|
||
// Show the output window only if unrecognized errors occur. | ||
"showOutput": "silent", | ||
|
||
// args is the HelloWorld program to compile. | ||
"args": ["HelloWorld.ts"], | ||
|
||
// use the standard tsc problem matcher to find compile problems | ||
// in the output. | ||
"problemMatcher": "$tsc" | ||
} | ||
|
||
// A task runner that calls the Typescript compiler (tsc) and | ||
// compiles based on a tsconfig.json file that is present in | ||
// the root of the folder open in VSCode | ||
/* | ||
{ | ||
"version": "0.1.0", | ||
|
||
// The command is tsc. Assumes that tsc has been installed using npm install -g typescript | ||
"command": "tsc", | ||
|
||
// The command is a shell script | ||
"isShellCommand": true, | ||
|
||
// Show the output window only if unrecognized errors occur. | ||
"showOutput": "silent", | ||
|
||
// Tell the tsc compiler to use the tsconfig.json from the open folder. | ||
"args": ["-p", "."], | ||
|
||
// use the standard tsc problem matcher to find compile problems | ||
// in the output. | ||
"problemMatcher": "$tsc" | ||
} | ||
*/ | ||
|
||
// A task runner configuration for gulp. Gulp provides a less task | ||
// which compiles less to css. | ||
/* | ||
{ | ||
"version": "0.1.0", | ||
"command": "gulp", | ||
"isShellCommand": true, | ||
"tasks": [ | ||
{ | ||
"taskName": "less", | ||
// Make this the default build command. | ||
"isBuildCommand": true, | ||
// Show the output window only if unrecognized errors occur. | ||
"showOutput": "silent", | ||
// Use the standard less compilation problem matcher. | ||
"problemMatcher": "$lessCompile" | ||
} | ||
] | ||
} | ||
*/ | ||
|
||
// Uncomment the following section to use jake to build a workspace | ||
// cloned from https://github.com/Microsoft/TypeScript.git | ||
/* | ||
{ | ||
"version": "0.1.0", | ||
// Task runner is jake | ||
"command": "jake", | ||
// Need to be executed in shell / cmd | ||
"isShellCommand": true, | ||
"showOutput": "silent", | ||
"tasks": [ | ||
{ | ||
// TS build command is local. | ||
"taskName": "local", | ||
// Make this the default build command. | ||
"isBuildCommand": true, | ||
// Show the output window only if unrecognized errors occur. | ||
"showOutput": "silent", | ||
// Use the redefined Typescript output problem matcher. | ||
"problemMatcher": [ | ||
"$tsc" | ||
] | ||
} | ||
] | ||
} | ||
*/ | ||
|
||
// Uncomment the section below to use msbuild and generate problems | ||
// for csc, cpp, tsc and vb. The configuration assumes that msbuild | ||
// is available on the path and a solution file exists in the | ||
// workspace folder root. | ||
/* | ||
{ | ||
"version": "0.1.0", | ||
"command": "msbuild", | ||
"args": [ | ||
// Ask msbuild to generate full paths for file names. | ||
"/property:GenerateFullPaths=true" | ||
], | ||
"taskSelector": "/t:", | ||
"showOutput": "silent", | ||
"tasks": [ | ||
{ | ||
"taskName": "build", | ||
// Show the output window only if unrecognized errors occur. | ||
"showOutput": "silent", | ||
// Use the standard MS compiler pattern to detect errors, warnings | ||
// and infos in the output. | ||
"problemMatcher": "$msCompile" | ||
} | ||
] | ||
} | ||
*/ | ||
|
||
// Uncomment the following section to use msbuild which compiles Typescript | ||
// and less files. | ||
/* | ||
{ | ||
"version": "0.1.0", | ||
"command": "msbuild", | ||
"args": [ | ||
// Ask msbuild to generate full paths for file names. | ||
"/property:GenerateFullPaths=true" | ||
], | ||
"taskSelector": "/t:", | ||
"showOutput": "silent", | ||
"tasks": [ | ||
{ | ||
"taskName": "build", | ||
// Show the output window only if unrecognized errors occur. | ||
"showOutput": "silent", | ||
// Use the standard MS compiler pattern to detect errors, warnings | ||
// and infos in the output. | ||
"problemMatcher": [ | ||
"$msCompile", | ||
"$lessCompile" | ||
] | ||
} | ||
] | ||
} | ||
*/ | ||
// A task runner example that defines a problemMatcher inline instead of using | ||
// a predfined one. | ||
/* | ||
{ | ||
"version": "0.1.0", | ||
"command": "tsc", | ||
"isShellCommand": true, | ||
"args": ["HelloWorld.ts"], | ||
"showOutput": "silent", | ||
"problemMatcher": { | ||
// The problem is owned by the typescript language service. Ensure that the problems | ||
// are merged with problems produced by Visual Studio's language service. | ||
"owner": "typescript", | ||
// The file name for reported problems is relative to the current working directory. | ||
"fileLocation": ["relative", "${cwd}"], | ||
// The actual pattern to match problems in the output. | ||
"pattern": { | ||
// The regular expression. Matches HelloWorld.ts(2,10): error TS2339: Property 'logg' does not exist on type 'Console'. | ||
"regexp": "^([^\\s].*)\\((\\d+|\\d+,\\d+|\\d+,\\d+,\\d+,\\d+)\\):\\s+(error|warning|info)\\s+(TS\\d+)\\s*:\\s*(.*)$", | ||
// The match group that denotes the file containing the problem. | ||
"file": 1, | ||
// The match group that denotes the problem location. | ||
"location": 2, | ||
// The match group that denotes the problem's severity. Can be omitted. | ||
"severity": 3, | ||
// The match group that denotes the problem code. Can be omitted. | ||
"code": 4, | ||
// The match group that denotes the problem's message. | ||
"message": 5 | ||
} | ||
} | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Agile GPS: Open Source Fleet Tracking | ||
|
||
## Installation Guide | ||
|
||
### Environment Setup | ||
1. You need at a minimum Node.js 4.0. | ||
|
||
1. Install the babel-cli: ```npm i -g babel-cli``` | ||
|
||
1. Install RethinkDB. | ||
|
||
1. Start a RethinkDB instance. To start a rethinkdb instance, run the command: | ||
|
||
``` | ||
rethinkdb | ||
``` | ||
|
||
|
||
|
||
It will creates its working files in the current directory. | ||
|
||
1. Verify you can access the RethinkDB admin console at http://localhost:8080 | ||
|
||
## Project Setup | ||
|
||
1. In the cloned *agilegps* folder, run ```npm install``` to install the dependencies from package.json. | ||
|
||
2. Run ```npm run webpack```. This builds the front end based on the package.json scripts section which is using webpack. | ||
|
||
## Schema Setup | ||
|
||
1. ```cd agilegps/src/tools``` | ||
|
||
1. Run ```babel-node schema.js``` to create the DB, tables, and indexes. It’s safe to run this multiple times because it does not drop any DB objects. Verify that the tables exist in the RethinkDB admin console. It should only take a few seconds to run. | ||
|
||
1. Run ```babel-node createAnAdmin.js admin password``` to create an Admin user. | ||
|
||
## Building the Front End | ||
1. ```npm run watch``` from the root of the project will run webpack in watch mode, continually rebuilding the front end as changes are made. | ||
1. ```npm run webpack``` from the root of the project runs webpack once, to rebuild the front end a single time. | ||
|
||
|
||
## Building the Back End | ||
1. ```npm run build``` from the root of the project will run babel. The built version is used by processes.json for production usage since it uses less memory than *node-babel*. | ||
|
||
## Running the Application | ||
|
||
1. ```cd agilegps/src/server``` | ||
1. ```node runner``` starts the web server, listening for file system code changes and automatically restarting the web server process on change, for easier development. | ||
1. ```babel-node server``` starts the server without listening for file system changes. | ||
1. ```babel-node debug server``` runs the server in the debugger. | ||
2. Node 6.3.0 and later has V8 Inspector integration which allows attaching Chrome DevTools to Node.js instances for debugging and profiling: https://nodejs.org/api/debugger.html#debugger_v8_inspector_integration_for_node_js | ||
1. You should be able to access and login to the app at http://localhost:3000 | ||
|
||
## Running the Message Listener | ||
|
||
The message listener (also known as the message gateway or just gateway) receives messages from tracker devices and inserts into the database. The message listener can be started and stopped independently of the web server. | ||
|
||
1. ```cd agilegps/src/listener``` | ||
1. Run: ```babel-node listen.js``` | ||
1. To debug, ```babel-node debug listen.js``` | ||
|
||
## Deploying to Production | ||
|
||
The *processes.json* file is pre-configured for PM2 which is a convenient way to run the app in production. PM2 can be installed to automatically run the app at system startup, log process output, etc. | ||
|
||
1. Put your Google Maps API key in ```config/geocoding.js``` | ||
|
||
1. Configure *agilegps/config/web.json* | ||
1. isReverseProxied - if you are behind a reverse proxy, set this to true | ||
1. cluster - true to use all CPUs | ||
1. jwtSecret - you should generate a random long string here. This string is used to sign the JWT tokens. | ||
1. cookieKeys - you should generate an array of two strings. These are used to sign the session cookies. The array allows you to rotate in new keys. | ||
|
||
1. Configure *agilegps/config/listener.js* | ||
|
||
1. ```pm2 start processes.json``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
"servers": [ | ||
{ "host": "localhost", "port": 28015 } | ||
], | ||
"db": "agilegps", | ||
"discovery": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
faker-local.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
GOOGLE_API_KEY: 'inserthere', | ||
PROVIDER: "local" | ||
// PROVIDER: "google" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
"port": 33333, // listen port | ||
"host": "0.0.0.0", // listen on host | ||
"insertrawevents": true, // insert the raw events to the DB | ||
"geocode": true, // reverse geocode on or off | ||
"sack": true // send SACK on or off | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
"proxy": false, | ||
"isReverseProxied": false, | ||
"port": 3000, | ||
"tlsport": 3443, | ||
"cluster": false, | ||
"spdy": false, | ||
"https": false, | ||
"jwtSecret": "seecret", | ||
"cookieKeys": [ | ||
"seecret1", | ||
"seecret2" | ||
], | ||
"longStackTraces": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES6", | ||
"module": "commonjs" | ||
} | ||
} |
Oops, something went wrong.