mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-08 11:52:44 +00:00
Add HB service file
Update install.sh to create service and set to start automatically
This commit is contained in:
13
install/ubuntu/etc/systemd/system/homebrewery.service
Normal file
13
install/ubuntu/etc/systemd/system/homebrewery.service
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Homebrewery Web Server
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=root
|
||||||
|
After=mongodb
|
||||||
|
Environment=NODE_ENV=local
|
||||||
|
WorkingDirectory=/usr/local/homebrewery
|
||||||
|
ExecStart=node server.js
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
@@ -1,16 +1,34 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Install CURL and add required NodeJS source to package repo
|
||||||
|
echo ::Install CURL
|
||||||
apt install -y curl
|
apt install -y curl
|
||||||
|
echo ::Add NodeJS source to package repo
|
||||||
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
|
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
|
||||||
|
|
||||||
|
# Install required packages
|
||||||
|
echo ::Install Homebrewery requirements
|
||||||
apt satisfy -y git nodejs npm mongodb
|
apt satisfy -y git nodejs npm mongodb
|
||||||
|
|
||||||
NODE_ENV=local
|
# Clone Homebrewery repo
|
||||||
export NODE_ENV
|
echo ::Get Homebrewery files
|
||||||
|
cd /usr/local/
|
||||||
git clone https://github.com/naturalcrit/homebrewery.git
|
git clone https://github.com/naturalcrit/homebrewery.git
|
||||||
|
|
||||||
|
# Install Homebrewery
|
||||||
|
echo ::Install Homebrewery
|
||||||
cd homebrewery
|
cd homebrewery
|
||||||
npm install
|
npm install
|
||||||
npm audit fix
|
npm audit fix
|
||||||
npm run postinstall
|
npm run postinstall
|
||||||
|
|
||||||
|
# Create Homebrewery service
|
||||||
|
echo ::Create Homebrewery service
|
||||||
|
ln -s /usr/local/homebrewery/install/ubuntu/etc/systemd/system/homebrewery.service /etc/systemd/system/homebrewery.service
|
||||||
|
systemctl daemon-reload
|
||||||
|
echo ::Set Homebrewery to start automatically
|
||||||
|
systemctl enable homebrewery
|
||||||
|
|
||||||
|
# Start Homebrewery
|
||||||
|
echo ::Start Homebrewery
|
||||||
|
systemctl start homebrewery
|
||||||
Reference in New Issue
Block a user