-
Notifications
You must be signed in to change notification settings - Fork 2
Getting started
Before installing Raspbot, please ensure that the following prerequisites are met:
Required:
- Node Package Manager (recommended version 5.7.1+)
- NodeJS (recommended version 10.4.1+)
- Python (developed for version 2.7.10)
- psutil library (developed using version 5.4.3)
Optional:
- PM2 (only required to use the Bootstrapper app)
Clone this repository on your Raspberry Pi:
$ git clone https://github.com/pkrll/Raspy
And run make install
in the project root folder to install and set up the server:
$ cd Raspy
$ make install
The folder dist
inside ./raspbot
already contains the latest build of the client. Running the server will use the files there. You can also manually build the client app, by typing make build
in the root folder. This might take a while, so grab a snack and wait for the installation and build processes to finish.
After installing all dependencies and setting up the server, you can run the server with make server
in the root folder.
It is, though, recommended to use a process manager to run the server.
To daemonize the application, you can use PM2
, which is a process manager for NodeJS applications. If you do not have PM2
already, install it:
$ sudo npm install -g pm2
Use make start
to run the server in the background. The NODE_ENV
will automatically be set to "production" when using the start
rule.
$ make start
[PM2] Applying action restartProcessId on app [server](ids: 0)
[PM2] [server](0) β
[PM2] Process successfully started
ββββββββββββ¬βββββ¬βββββββ¬ββββββββ¬βββββββββ¬ββββββββββ¬βββββββββ¬ββββββ¬ββββββββββββ¬ββββββββ¬βββββββββββ
β App name β id β mode β pid β status β restart β uptime β cpu β mem β user β watching β
ββββββββββββΌβββββΌβββββββΌββββββββΌβββββββββΌββββββββββΌβββββββββΌββββββΌββββββββββββΌββββββββΌβββββββββββ€
β Raspbot β 0 β fork β 13141 β online β 0 β 0s β 66% β 13.9 MB β pkrll β disabled β
ββββββββββββ΄βββββ΄βββββββ΄ββββββββ΄βββββββββ΄ββββββββββ΄βββββββββ΄ββββββ΄ββββββββββββ΄ββββββββ΄βββββββββββ
Use `pm2 show <id|name>` to get more details about an app
Use make stop
to stop the server.
Follow these steps to make PM2
run on startup.
- Start the application with
make start
(if not already running). - Save the current process list with
pm2 save
. - Run
pm2 startup systemd
and copy and paste the command produced by the script.
Example
$ make start
$ pm2 save
[PM2] Saving current process list...
[PM2] Successfully saved in /home/pkrll/.pm2/dump.pm2
$ pm2 startup systemd
[PM2] Init System found: systemd
[PM2] To setup the Startup Script, copy/paste the following command:
sudo env PATH=$PATH:[...] startup systemd -u USER --hp /home/USER
$ sudo env PATH=$PATH:[...] startup systemd -u USER --hp /home/USER
For more information on how to use PM2, check out the official documentation or this quickstart guide.