Production Deployment
The previous steps deploy MiningOS locally for testing. To deploy MiningOS in a production environment, make the following updates
Run all commands with production environment
Run all commands with the environment variable set to production instead of development.
Example:
pm2 -s start worker.js --name 'ork-0' -- --wtype wrk-ork-proc-aggr --env production --cluster cluster-1Register devices
In production, register all devices using their actual IP address, port, and password.
Configure nginx
Configure a standard Nginx server block using your domain. Add the following Nginx configuration to route App-node API traffic to the local MiningOS service.
upstream miningos-dev {
server 127.0.0.1:3000 max_fails=0;
keepalive 16;
}
server {
...
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://miningos-dev;
}
}Configure DHCP for auto IP assignment (optional)
To automatically assign IP addresses to devices, deploy the DHCP worker connected to KEA.
Deploy DHCP
git clone https://github.com/tetherto/miningos-wrk-dhcp.git
cd miningos-wrk-dhcp
npm ci
sh setup-config.shEdit config/kea.config.json to set the KEA server url.
# start dhcp worker
pm2 -s start worker.js --name 'dhcp-1' -- --wtype wrk-dhcp --env production --cluster cluster-1Copy the rpcPublicKey from status/wrk-dhcp.json
Update DHCP RPC Key
Configure the DHCP rpcPublicKey on all device workers that require auto IP assignment. The DHCP configuration file for all repositories is located at:
config/facs/miningos-net.config.jsonNote
The worker must be restarted for any configuration changes to take effect.