Support #898
Updated by Daniel Curtis over 7 years ago
This is a guide for installing PiCluster on Arch Linux ARM using a Raspberry Pi 3. h2. Prepare the Environment * Make sure the system is up to date: <pre> pacman -Syu </pre> * Install prerequisites: <pre> pacman -S docker git nodejs npm python2 </pre> * Use npm to install node-gyp globally: <pre> npm install -g node-gyp </pre> * Add the picluster user: <pre> useradd -m -g users -s /bin/bash picluster </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/rusher81572/picluster.git /opt/picluster </pre> * Change the ownership of picluster directory: <pre> chown -R picluster /opt/picluster </pre> * Switch to the picluster user and switch to the picluster directory: <pre> su - 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: *NOTE*: There is currently a problem with the @npm install@ step not installing microtime. This can safely be ignored. <pre> cd server npm install node server.js </pre> * Install and run agent: *NOTE*: There is currently a problem with the @npm install@ step not installing microtime. This can safely be ignored. <pre> cd ../agent npm install node agent.js </pre> * Install and run web console: <pre> cd ../web npm install node webconsole.js </pre> h3. systemd services h2. Init with pm2 * Install pm2: <pre> pacman -S pm2 </pre> * Install the pm2 systemd init script as the picluster user: script: <pre> pm2 startup systemd -u picluster --hp /opt/picluster/server </pre> * Switch to the picluster user: <pre> su - picluster </pre> *NOTE*: I needed to set the config file path in the server.js, agent.js, and webconsole.js scripts to the absolute config path: <pre> cd /opt/picluster/server sed -i.bak -e "s/..\/config.json/\/opt\/picluster\/config.json/g" server.js cd ../agent sed -i.bak -e "s/..\/config.json/\/opt\/picluster\/config.json/g" agent.js cd ../web sed -i.bak -e "s/..\/config.json/\/opt\/picluster\/config.json/g" webconsole.js </pre> * Start the server, agent, and webconsole scripts: <pre> cd /opt/picluster/server pm2 start server.js cd ../agent pm2 start agent.js cd ../web pm2 start webconsole.js </pre> * Save the pm2 session to restart at boot: <pre> pm2 save </pre> h2. Resources * https://github.com/rusher81572/picluster