Skip to content

Commit 5ffd65c

Browse files
author
Grant Miner
committed
Open source release
1 parent f912763 commit 5ffd65c

File tree

180 files changed

+31148
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+31148
-0
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
charset = utf-8
11+
indent_style = tab

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build/
2+
node_modules
3+
npm-debug.log

.jshintrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"asi": true,
3+
"node": true,
4+
"browser": true,
5+
"eqnull": true,
6+
"laxbreak": true
7+
}

.vscode/launch.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Launch",
6+
"type": "node",
7+
"request": "launch",
8+
"program": "app/web/server.js",
9+
"stopOnEntry": false,
10+
"args": [],
11+
"cwd": "./app/web",
12+
"runtimeExecutable": null,
13+
"runtimeArgs": [
14+
"--nolazy"
15+
],
16+
"env": {
17+
"NODE_ENV": "development"
18+
},
19+
"externalConsole": false,
20+
"sourceMaps": false,
21+
"outDir": null
22+
},
23+
{
24+
"name": "Attach",
25+
"type": "node",
26+
"request": "attach",
27+
"port": 5858
28+
}
29+
]
30+
}

.vscode/tasks.json

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
// Available variables which can be used inside of strings.
2+
// ${workspaceRoot}: the root folder of the team
3+
// ${file}: the current opened file
4+
// ${fileBasename}: the current opened file's basename
5+
// ${fileDirname}: the current opened file's dirname
6+
// ${fileExtname}: the current opened file's extension
7+
// ${cwd}: the current working directory of the spawned process
8+
9+
// A task runner that calls the Typescript compiler (tsc) and
10+
// Compiles a HelloWorld.ts program
11+
{
12+
"version": "0.1.0",
13+
14+
// The command is tsc. Assumes that tsc has been installed using npm install -g typescript
15+
"command": "tsc",
16+
17+
// The command is a shell script
18+
"isShellCommand": true,
19+
20+
// Show the output window only if unrecognized errors occur.
21+
"showOutput": "silent",
22+
23+
// args is the HelloWorld program to compile.
24+
"args": ["HelloWorld.ts"],
25+
26+
// use the standard tsc problem matcher to find compile problems
27+
// in the output.
28+
"problemMatcher": "$tsc"
29+
}
30+
31+
// A task runner that calls the Typescript compiler (tsc) and
32+
// compiles based on a tsconfig.json file that is present in
33+
// the root of the folder open in VSCode
34+
/*
35+
{
36+
"version": "0.1.0",
37+
38+
// The command is tsc. Assumes that tsc has been installed using npm install -g typescript
39+
"command": "tsc",
40+
41+
// The command is a shell script
42+
"isShellCommand": true,
43+
44+
// Show the output window only if unrecognized errors occur.
45+
"showOutput": "silent",
46+
47+
// Tell the tsc compiler to use the tsconfig.json from the open folder.
48+
"args": ["-p", "."],
49+
50+
// use the standard tsc problem matcher to find compile problems
51+
// in the output.
52+
"problemMatcher": "$tsc"
53+
}
54+
*/
55+
56+
// A task runner configuration for gulp. Gulp provides a less task
57+
// which compiles less to css.
58+
/*
59+
{
60+
"version": "0.1.0",
61+
"command": "gulp",
62+
"isShellCommand": true,
63+
"tasks": [
64+
{
65+
"taskName": "less",
66+
// Make this the default build command.
67+
"isBuildCommand": true,
68+
// Show the output window only if unrecognized errors occur.
69+
"showOutput": "silent",
70+
// Use the standard less compilation problem matcher.
71+
"problemMatcher": "$lessCompile"
72+
}
73+
]
74+
}
75+
*/
76+
77+
// Uncomment the following section to use jake to build a workspace
78+
// cloned from https://github.com/Microsoft/TypeScript.git
79+
/*
80+
{
81+
"version": "0.1.0",
82+
// Task runner is jake
83+
"command": "jake",
84+
// Need to be executed in shell / cmd
85+
"isShellCommand": true,
86+
"showOutput": "silent",
87+
"tasks": [
88+
{
89+
// TS build command is local.
90+
"taskName": "local",
91+
// Make this the default build command.
92+
"isBuildCommand": true,
93+
// Show the output window only if unrecognized errors occur.
94+
"showOutput": "silent",
95+
// Use the redefined Typescript output problem matcher.
96+
"problemMatcher": [
97+
"$tsc"
98+
]
99+
}
100+
]
101+
}
102+
*/
103+
104+
// Uncomment the section below to use msbuild and generate problems
105+
// for csc, cpp, tsc and vb. The configuration assumes that msbuild
106+
// is available on the path and a solution file exists in the
107+
// workspace folder root.
108+
/*
109+
{
110+
"version": "0.1.0",
111+
"command": "msbuild",
112+
"args": [
113+
// Ask msbuild to generate full paths for file names.
114+
"/property:GenerateFullPaths=true"
115+
],
116+
"taskSelector": "/t:",
117+
"showOutput": "silent",
118+
"tasks": [
119+
{
120+
"taskName": "build",
121+
// Show the output window only if unrecognized errors occur.
122+
"showOutput": "silent",
123+
// Use the standard MS compiler pattern to detect errors, warnings
124+
// and infos in the output.
125+
"problemMatcher": "$msCompile"
126+
}
127+
]
128+
}
129+
*/
130+
131+
// Uncomment the following section to use msbuild which compiles Typescript
132+
// and less files.
133+
/*
134+
{
135+
"version": "0.1.0",
136+
"command": "msbuild",
137+
"args": [
138+
// Ask msbuild to generate full paths for file names.
139+
"/property:GenerateFullPaths=true"
140+
],
141+
"taskSelector": "/t:",
142+
"showOutput": "silent",
143+
"tasks": [
144+
{
145+
"taskName": "build",
146+
// Show the output window only if unrecognized errors occur.
147+
"showOutput": "silent",
148+
// Use the standard MS compiler pattern to detect errors, warnings
149+
// and infos in the output.
150+
"problemMatcher": [
151+
"$msCompile",
152+
"$lessCompile"
153+
]
154+
}
155+
]
156+
}
157+
*/
158+
// A task runner example that defines a problemMatcher inline instead of using
159+
// a predfined one.
160+
/*
161+
{
162+
"version": "0.1.0",
163+
"command": "tsc",
164+
"isShellCommand": true,
165+
"args": ["HelloWorld.ts"],
166+
"showOutput": "silent",
167+
"problemMatcher": {
168+
// The problem is owned by the typescript language service. Ensure that the problems
169+
// are merged with problems produced by Visual Studio's language service.
170+
"owner": "typescript",
171+
// The file name for reported problems is relative to the current working directory.
172+
"fileLocation": ["relative", "${cwd}"],
173+
// The actual pattern to match problems in the output.
174+
"pattern": {
175+
// The regular expression. Matches HelloWorld.ts(2,10): error TS2339: Property 'logg' does not exist on type 'Console'.
176+
"regexp": "^([^\\s].*)\\((\\d+|\\d+,\\d+|\\d+,\\d+,\\d+,\\d+)\\):\\s+(error|warning|info)\\s+(TS\\d+)\\s*:\\s*(.*)$",
177+
// The match group that denotes the file containing the problem.
178+
"file": 1,
179+
// The match group that denotes the problem location.
180+
"location": 2,
181+
// The match group that denotes the problem's severity. Can be omitted.
182+
"severity": 3,
183+
// The match group that denotes the problem code. Can be omitted.
184+
"code": 4,
185+
// The match group that denotes the problem's message.
186+
"message": 5
187+
}
188+
}
189+
}
190+
*/

README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Agile GPS: Open Source Fleet Tracking
2+
3+
## Installation Guide
4+
5+
### Environment Setup
6+
1. You need at a minimum Node.js 4.0.
7+
8+
1. Install the babel-cli: ```npm i -g babel-cli```
9+
10+
1. Install RethinkDB.
11+
12+
1. Start a RethinkDB instance. To start a rethinkdb instance, run the command:
13+
14+
```
15+
rethinkdb
16+
```
17+
18+
19+
20+
It will creates its working files in the current directory.
21+
22+
1. Verify you can access the RethinkDB admin console at http://localhost:8080
23+
24+
## Project Setup
25+
26+
1. In the cloned *agilegps* folder, run ```npm install``` to install the dependencies from package.json.
27+
28+
2. Run ```npm run webpack```. This builds the front end based on the package.json scripts section which is using webpack.
29+
30+
## Schema Setup
31+
32+
1. ```cd agilegps/src/tools```
33+
34+
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.
35+
36+
1. Run ```babel-node createAnAdmin.js admin password``` to create an Admin user.
37+
38+
## Building the Front End
39+
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.
40+
1. ```npm run webpack``` from the root of the project runs webpack once, to rebuild the front end a single time.
41+
42+
43+
## Building the Back End
44+
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*.
45+
46+
## Running the Application
47+
48+
1. ```cd agilegps/src/server```
49+
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.
50+
1. ```babel-node server``` starts the server without listening for file system changes.
51+
1. ```babel-node debug server``` runs the server in the debugger.
52+
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
53+
1. You should be able to access and login to the app at http://localhost:3000
54+
55+
## Running the Message Listener
56+
57+
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.
58+
59+
1. ```cd agilegps/src/listener```
60+
1. Run: ```babel-node listen.js```
61+
1. To debug, ```babel-node debug listen.js```
62+
63+
## Deploying to Production
64+
65+
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.
66+
67+
1. Put your Google Maps API key in ```config/geocoding.js```
68+
69+
1. Configure *agilegps/config/web.json*
70+
1. isReverseProxied - if you are behind a reverse proxy, set this to true
71+
1. cluster - true to use all CPUs
72+
1. jwtSecret - you should generate a random long string here. This string is used to sign the JWT tokens.
73+
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.
74+
75+
1. Configure *agilegps/config/listener.js*
76+
77+
1. ```pm2 start processes.json```

config/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pem

config/database.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict';
2+
3+
module.exports = {
4+
"servers": [
5+
{ "host": "localhost", "port": 28015 }
6+
],
7+
"db": "agilegps",
8+
"discovery": true
9+
}

config/faker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
faker-local.js

config/geocoding.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
module.exports = {
4+
GOOGLE_API_KEY: 'inserthere',
5+
PROVIDER: "local"
6+
// PROVIDER: "google"
7+
}

0 commit comments

Comments
 (0)