hwsim
v1.5.26
Published
This guide provides step-by-step instructions to deploy the **Hardware Simulator** application on a Debian server. Now available as an npm package, you can easily install and run the simulator using Node.js.
Readme
Hardware Simulator Deployment Guide
This guide provides step-by-step instructions to deploy the Hardware Simulator application on a Debian server. Now available as an npm package, you can easily install and run the simulator using Node.js.
Table of Contents
- Prepare the Debian Server
- Install the Hardware Simulator Package
- Add Systemd Service for Automatic Start
- Configure Firewall
- Configure Reverse Proxy (Optional)
- Monitor Logs
- Configuration of the Simulator
1. Prepare the Debian Server
Everything as root.
Install npm:
apt update
apt install npm -yVerify Installation:
npm -v2. Install the Hardware Simulator Package
Install the npm Package:
npm install -g hwsimThis will download the latest version of Hardware Simulator.
Test Locally:
Run the Hardware Simulator using the built-in npm script:
npm run start-hwsimEnsure everything works as expected before proceeding.
Now you can run:
start-hwsim3. Add Systemd Service for Automatic Start
Create a Systemd Service File:
nano /etc/systemd/system/hwsim.serviceAdd the Following Configuration:
[Unit]
Description=Hardware Simulator Application
After=network.target
[Service]
ExecStart=/usr/bin/node /usr/local/lib/node_modules/hwsim/index.js
WorkingDirectory=/usr/local/lib/node_modules/hwsim
Restart=always
Environment=PORT=80
[Install]
WantedBy=multi-user.targetEnable and Start the Service:
systemctl enable hwsim
systemctl start hwsimCheck Service Status:
systemctl status hwsim4. Configure Firewall
If a firewall like UFW is enabled, allow access to port 80 (web) and 2101 (TCP server):
ufw allow 80/tcp
ufw allow 2101/tcp
ufw reload5. Configure Reverse Proxy (Optional)
For better security and easier domain name usage, configure a reverse proxy using Nginx.
Install Nginx:
apt install nginx -yCreate a New Nginx Configuration:
nano /etc/nginx/sites-available/hwsimAdd the Following:
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:80;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}Note: Replace
your-domain.comwith your actual domain name.
Enable the Configuration:
ln -s /etc/nginx/sites-available/hwsim /etc/nginx/sites-enabled/
nginx -t
systemctl restart nginx6. Monitor Logs
Check Systemd Logs:
journalctl -u hwsim -f7. Configuration
Access through a browser with the ip of the server, default on port 80. So just entering the ip is enough.
