Project

General

Profile

Support #905

Updated by Daniel Curtis over 2 years ago

This is a guide for installing PiCluster on Ubuntu 16.04.

h2. Prepare the Environment

* Switch to root:
<pre>
sudo -i
</pre>

* Make sure the system is up to date:
<pre>
apt-get update && apt-get upgrade
</pre>

* Install prerequisites:
<pre>
apt-get install docker git nodejs nodejs-legacy npm
</pre>

* Start and enable docker at boot:
<pre>
systemctl enable docker
systemctl start docker
</pre>

h2. Install PiCluster

* Download the latest PiCluster version from GitHub:
<pre>
git clone https://github.com/picluster/picluster.git https://github.com/rusher81572/picluster.git /opt/picluster
</pre>

* Edit the config.json file:
<pre>
vi config.json
</pre>
#* And edit the config file to suit your environment:
*NOTE*: Use the web_connect key to the value of the host systems IP address. Otherwise you will get connection errors while starting the agent.
<pre>
{
"token":"45FG9A23DE12045E20BB854AC",
"docker":"/opt/picluster/docker",
"server_port":"3000",
"agent_port": "3001",
"layout": [
{"node":"192.168.1.191", "mysql":"-p 3306:3306","nginx":"-p 80:80"},
{"node":"192.168.1.192", "openvpn":"-p 1194:1194"}],
"hb": [
{"node":"192.168.1.191","mysql":"3306", "nginx": "80"},
{"node":"192.168.1.192","openvpn":"1194"}
],
"vip": [
{"node":"192.168.1.191","vip_eth_device":"eth0", "slave": "192.168.1.192", "vip_ping_time": "10000"},
{"node":"192.168.1.192","vip_eth_device":"eth0","slave": "192.168.1.191", "vip_ping_time": "15000"}
],
"commandlist": [{
"SystemUpdate": "pacman -Syu --yes"
}],
"vip_ip": "192.168.1.202",
"autostart_containers": "enabled",
"rsyslog_logfile": "/var/log/syslog",
"rsyslog_host": "192.168.1.202",
"automatic_heartbeat": "enabled",
"heartbeat_interval": "300000",
"syslog": "dmesg",
"web_username": "admin",
"web_password":"admin",
"web_connect":"192.168.1.190",
"web_port":"3003"
}
</pre>

* Install and run server:
<pre>
cd /opt/picluster/ /opt/picluster/server
npm install
&lt;/pre&gt;

* Install and run agent:
&lt;pre&gt;
cd ../agent
npm install
&lt;/pre&gt;

* Install and run web console:
&lt;pre&gt;
cd ../web

npm install
</pre>

h2. Init with pm2

* Install pm2:
<pre>
npm install -g pm2
</pre>

* Install the pm2 systemd init script as the picluster user:
<pre>
pm2 startup systemd
</pre>

* Export the picluster config filepath environment variable:
<pre>
export PICLUSTER_CONFIG='/opt/picluster/config.json'
</pre>

* Start the server, agent, and webconsole scripts:
<pre>
pm2 start /opt/picluster/server/server.js
pm2 start /opt/picluster/agent/agent.js
pm2 start /opt/picluster/web/webconsole.js
</pre>

* Save the pm2 session to restart at boot:
<pre>
pm2 save
</pre>

* Enable pm2 at boot:
<pre>
systemctl enable pm2-root
</pre>

h2. Resources

* https://github.com/rusher81572/picluster

Back