These instructions are for installing locally. If you'd like to have containerised setup, see INSTALL-DOCKER.md instead.
Make sure you have installed all these prerequisites:
- Unix operating system, like Linux or MacOS. If you use Windows, please look into installing via Docker instead.
- Git (
git --version
, preinstalled on MacOS) - Node.js version 8 or 10 and the NPM v5+ (
node --version && npm --version
). We recommend managing Node.js versions using NVM. - MongoDB v3.6 - 4.0. (
mongod --version
). - Some of the NPM modules require compiling native code, which might require installing X-Code's Command line tools on MacOS or
build-essential
andmake
on Linux. On MacOS you can install or confirm they're installed by runningxcode-select --install
- GraphicsMagick. In MacOS, you can simply use Homebrew to install it:
brew install graphicsmagick
git clone https://github.com/Trustroots/trustroots.git
cd trustroots
mongod
Optional: If you need to modify connection settings, see config/env/local.js
config file.
npm start
🎉 Open localhost:3000 in your browser.
- Run the app by typing
npm start
- Stop the app by hitting
Ctrl+C
- To skip checking Bower modules on start (useful if you're offline), type
npm run start:skipBower
- When you change any file, they get recompiled and the browser is refreshed.
- Keep an eye on console in case of compiling errors.
- Read more
- You can start clean by running
npm run distclean && npm run dropdb
Add any configurations you want to keep out of version control to config/env/local.js
file. It's created for you on first start and overrides anything in config/env/local.js
MailDev is there for viewing and testing emails during development
MailDev will be running at localhost:1080
Agendash is a dashboard & inspector for Agenda, our job scheduling library.
Agendash (background job dashboard) at localhost:1081.
The standard node inspector runs on each start for the main app (port 5858) and the worker (port 5859).
To debug using Chrome:
- Run 'npm start'
- Open
chrome://inspect/#devices
. Note the "Remote Target" list should be empty to start - Press "Open dedicated DevTools for Node"
- Press "Add connection" and add both
localhost:5858
andlocalhost:5859
- They will now appear in "Remote Target" list
- Press 'inspect' on whichever process you want to debug
- You should now have console/profiler etc available.
More information can be found in the NodeJS debug documentation.
npm test
(both client & server)npm run test:client
npm run test:client:watch
(run + watch for changes)npm run test:server
npm run test:server:watch
(run + watch for changes)
To lint files, run npm run lint
There's a script that can generate mock user data. It's highly recommended you run this script after installation, that way you'll have something to look at.
- Run
node scripts/fillTestData.js 1000 adminusername
— that will create 1000 users and hosting offers.adminusername
is optional (a-z0-9) and will create an admin user. - It can take up to 5 minutes. Mongoose might complain about duplicates — just ignore these errors.
- To see the result, log in with your chosen username and password
password123
.
To drop your database, run:
npm run dropdb
-
Create FCM account
-
Go to FCM console and create a new project
-
Open the project and hit small gear next to "Overview" at the sidebar so that you get to "project settings" page
-
Choose choose "Cloud messaging" tab, copy "Sender ID" number
-
Choose choose "Service accounts" tab
-
Either "create new service account" via "Manage all service accounts" link or choose existing one from the list (for development "Firebase Admin SDK" account is fine)
-
"Generate new private key" button
-
Choose "json" format and you'll get a file to download
-
Add contents from that file to your
./config/env/local.js
:fcm: { senderId: 'PASTE_YOUR_SENDER_ID_NUMBER_HERE', serviceAccount: PASTE_YOUR_JSON_CONFIG_HERE },
-
To stop eslint complaining, you might need to convert double quotes to single quotes. (
"
→'
)
-
Install InfluxDB v1.0+ and run it (type
influxd
) -
Add InfluxDB configuration to your
./config/env/local.js
:influxdb: { enabled: true, options: { host: 'localhost', port: 8086, // default 8086 protocol: 'http', // default 'http' // username: '', // password: '', database: 'trustroots' } }
-
You can observe data through InfluxDB admin panel: localhost:8083 or optionally install Grafana and connect it to InfluxDB.
-
Read more about the collected data and metrics
If you prefer ImageMagick over GraphicsMagick:
-
In MacOS, you can simply use Homebrew to install it:
brew install imagemagick
-
Change
imageProcessor
setting from./configs/env/local.js
toimagemagic
.
Run these to get most recent version:
$ git pull # Get the latest code for the current branch
$ npm update # Update NPM
$ npm run migrate # Migrate database up
...or simply ./scripts/update.sh
which does this all for you.
- Check troubleshooting.
- Check and open issues at GitHub
- Contact us