1.0.0 • Published 6 years ago
rpi-garage-door v1.0.0
RPI Garage Door
Install
git clone https://github.com/Roaders/rpi-garage-door.git
cd rpi-garage-door
npm install
npm run buildCreate Users
npm run createUserVerify User
npm run checkUserGenerate Secret for Jwt
npm run generateSecretRun server (not as a service)
npm run start-prodRunning as a service
Get Status
sudo systemctl status garage-doorStart and stop
sudo systemctl stop garage-doorsudo systemctl start garage-doorSetup
Create /etc/systemd/system/garage-door.service:
[Service]
WorkingDirectory=/home/pi/git/rpi-garage-door
ExecStart=npm run start-prod
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=garage-door
User=pi
Group=pi
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.targetand enable the service:
sudo systemctl enable garage-door.serviceSecure Certificate
Install certbot:
sudo apt-get install certbotcreate certificate:
sudo certbot certonly --standalone(port 80 needs to be forwarded to your pi) follow instructions
If it works we get the following message:
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/MYDOMAIN/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/MYDOMAIN/privkey.pem
Your cert will expire on 2020-10-10. To obtain a new or tweaked
version of this certificate in the future, simply run certbot
again. To non-interactively renew *all* of your certificates, run
"certbot renew"copy /etc/letsencrypt/live/MYDOMAIN/fullchain.pem and /etc/letsencrypt/live/MYDOMAIN/privkey.pem into .env file in root of web server:
keyPath=/etc/letsencrypt/live/MYDOMAIN/privkey.pem
certificatePath=/etc/letsencrypt/live/MYDOMAIN/fullchain.pemmake cert files readable:
sudo chmod -R a+r /etc/letsencrypt/archive/MY_DOMAINedit deploy hook:
sudo nano /etc/letsencrypt/renewal-hooks/deploy/restart-garage-door.shand add the restart command:
systemctl restart garage-doorRenew Certificates:
(this should happen automatically)
sudo certbot renewdry run
sudo certbot renew --dry-runforce (to test server restart)
sudo certbot renew --force-renewalthis will only work a limited number of times a day due to rate limiting. Use dry run first.
1.0.0
6 years ago