Node.js v7.6.0
npm v4.1.2
MySQL v14.14
Redis-Server v3.2.8
gem v2.5.2 (for running ruby script to create redis cluster)
sudo apt-get update
sudo add-apt-repository ppa:chris-lea/redis-server
sudo apt-get update
sudo apt-get -y install redis-server
sudo apt-get -y install mysql
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install npm
sudo apt-get install ruby
sudo apt-get install gem
sudo gem install redis
sudo apt-get install git
sudo apt-get install nodejs-legacy
, and use n
to upgrade to v7.6.0
Below are the global dependencies this project depends on.
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
run npm install
to install local dependencies from package.json
run npm list -g --depth=0
to view globally installed packages
run ncu -u
to view outdated dependencies
run npm update --save
to update outdated dependencies
Make sure MySQL is running. sudo service mysql start
To enable MySQL server at boot time, run sudo systemctl enable
Make sure Redis is properly installed. redis-cli -v
should output version number
A .env
file at the root of the project is required for the project to run.
.env
bundles all the environment variables referenced by the project into a single file.
The following variables are required:
HOST=localhost
- host
PORT=3000
- port to listen on (default is 3000)
NODE_USER=root
- mysql user
MAIL_USER
- gmail address with which emails are sent from (leave blank if desired)
MAIL_PASS
- password to above gmail address
PASS={{your mysql password}}
- this is the user password needed to access mysql (in this case, user is root, but can be any user/password)
REDIS_MSG_LIMIT=25
- maximum number of messages stored in a chat before the job queue flushes it to the database
REDIS_NUM_FLUSH=10
- number of messages to flush
LOCK_DRIFT_FACTOR=0.2
- expected clock drift in redlock
LOCK_RETRY_COUNT=15
- maximum number of times redlock attempts to acquire lock before throwing error
LOCK_RETRY_DELAY=250
- delay (in milliseconds) between lock acquire attempts
LOCK_RETRY_JITTER=100
- maximum time (in milliseconds) added randomly to lock acquire attempts to avoid high contention
CONN_LIMIT=5
- maximum number of mysql pooled connections
NODE_ENV="dev"
- node environment
env="dev"
- environment
Run ./test.sh
in the root of the project. This will run the unit and integration tests.
Make sure test.sh
is executable. chmod +x test.sh
Run ./test.sh cover
to run code coverage. Istanbul is used to generate coverage reports, which is located in a newly generated coverage/ directory.
Run ./build.sh
to build project, install dependencies, bundle files, precompile Handlebar templates, run tests, etc.
Make sure redis cluster and MySQL are running. If MySQL tables don't exist, run all the sql files in app/databases
cd run/ && ./run.sh
. Make sure run.sh is executable with chmod +x run.sh
Go to localhost:3000
Use gulp watch
to monitor the following file changes. See gulpfile.js
for information.
Since Handlebar templates are precompiled into a javascript file, any changes to template files requires recompiling.
CSS files are minifed and concatenated into a single, minified file, which requires any changes to css files to be updated in the minifed file.
Use webpack --watch
to monitor the following file changes
These client javascript files use CommonJS module loader, which does not run natively in the browser. Therefore, webpack
is used to bundle these
files into javascript which can run on the browser. Any changes to any of these files requires webpack
to rebundle the modules. webpack --watch
will handle this
automatically. View webpack.config.js
.
To create the bundled files, run webpack
or gulp webpack
.
This README is still a very, very rough draft. I will continue to update it in the future.