-
Clone this repository to your system.
-
Install NodeJS on your system. This comes with
npm
, the Node package manager. -
Install Ruby. This is required for Compass. You may already have this - macOS comes with Ruby.
-
Install and start MongoDB on your system. On macOS, installation with Homebrew is recommended.
-
Run
gem install compass
. If you get errors on Ubuntu, try this. -
Run
npm install -g pm2 nodemon bower grunt
. This installs several required npm packages globally on your system. -
Run
npm run setup
to setup dependencies for the API. -
Run
npm --prefix frontend run setup
to setup dependencies for the frontend.
If you just want a production instance on an Ubuntu VM, see "Installing Production on Ubuntu" below.
Note: If you have trouble building the frontend on a system with low memory (~1gb), it may be that Step 8 above is running out of memory and not installing all the npm dependencies properly. Try installing gifsicle
and optipng-bin
before calling run setup
.
When the app boots it will create a database and setup the default user.
Now see getting started to start using Kauri!
When running in development, it's easiest to run the frontend and API separately.
-
Run
nodemon
. -
Open another terminal window.
-
Run
grunt --base frontend --gruntfile frontend/Gruntfile.js serve
Frontend
- Port: 9000
- By default this uses the API prefix
http://localhost:3000/api
. - The page will refresh when changes are made.
See the frontend README for more details about running the frontend in development mode.
API
- Port: 3000
- Expects MongoDB to be available on
localhost
. - Uses nodemon to restart automatically when a change is made (excluding changes to the frontend, exports, etc.).
- Uses configuration in
nodemon.json
. - Has access to the StrongLoop API Explorer at
http://localhost:3000/explorer
.
In production the API's server is used to host the frontend. The frontend must first be built as a set of static files.
The recommended way to run the server in production is through PM2, as if the server crashes, PM2 will restart it.
-
Build the frontend with
grunt --base frontend --gruntfile frontend/Gruntfile.js build
. This builds to thefrontend/dist
directory and by default uses the API prefix/api
. -
Run
pm2 start pm2.json
. -
Run
pm2 startup
to start PM2 automatically at boot. -
Run
pm2 save
to save your current PM2 processes.
Use pm2 info Kauri
for status information or see the PM2 documentation for more information.
By default, the server will run at port 3000. Running an NGINX proxy which provides connectivity via HTTPS is recommended. LetsEncrypt allows you to obtain a free SSL certificate for this purpose.
See the frontend README for more details about building the frontend.
pm2.json
sets NODE_ENV
to production
. In production, the StrongLoop API Explorer is disabled and stack traces are not shown in errors.
If you wish to change settings like the database hostname or the server port, define a custom server/datasources.production.json
or server/config.production.json
file as per Loopback's environment specific configuration documentation.
There is already a handy Ubuntu install script which you can use. Clone the repo, cd
into the repo and run ./ubuntu-install.sh
.