mirror of
https://github.com/Retropex/apolloapi-v2.git
synced 2025-05-29 21:42:30 +02:00
Installation script TODO
This commit is contained in:
parent
85bb42e4f0
commit
f35c10e094
15
scripts/apollo.service
Normal file
15
scripts/apollo.service
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Apollo API & UI app
|
||||||
|
After=network.target
|
||||||
|
After=rc-local.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Environment=NODE_ENV=production
|
||||||
|
Type=simple
|
||||||
|
User=futurebit
|
||||||
|
ExecStart=/home/futurebit/.nvm/versions/node/v9.8.0/bin/node /opt/apolloapi/src/init.js
|
||||||
|
WorkingDirectory=/opt/apolloapi
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
15
scripts/bfgminer.service
Normal file
15
scripts/bfgminer.service
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=bgfminer
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=root
|
||||||
|
#Start:
|
||||||
|
ExecStart=/etc/miner_start.sh
|
||||||
|
WorkingDirectory=/opt/bfgminer
|
||||||
|
#Stop:
|
||||||
|
ExecStop=/etc/miner_stop.sh
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
32
scripts/install
Normal file
32
scripts/install
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||||
|
echo $DIR
|
||||||
|
### NVM ###
|
||||||
|
|
||||||
|
if [ -e ~/.nvm/nvm.sh ]
|
||||||
|
then
|
||||||
|
echo "nvm installed yet"
|
||||||
|
else
|
||||||
|
echo "Installing nvm"
|
||||||
|
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
|
||||||
|
fi
|
||||||
|
|
||||||
|
. ~/.nvm/nvm.sh
|
||||||
|
|
||||||
|
nvm install 9.8.0
|
||||||
|
nvm alias default 9.8.0
|
||||||
|
|
||||||
|
### SYSTEMD ###
|
||||||
|
|
||||||
|
sudo cp $DIR/apollo.service /etc/systemd/system/
|
||||||
|
sudo cp $DIR/bfgminer.service /etc/systemd/system/
|
||||||
|
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
|
||||||
|
sudo systemctl enable apollo
|
||||||
|
sudo systemctl enable bfgminer
|
||||||
|
|
||||||
|
grep -q -F '/opt/apolloapi/scripts/install' /etc/rc.local || sudo sed -i '\$i \/opt\/apolloapi\/scripts\/install' /etc/rc.local
|
||||||
|
|
||||||
|
echo -e "Installation complete"
|
@ -2,7 +2,7 @@ const { exec } = require('child_process')
|
|||||||
|
|
||||||
module.exports = ({ define }) => {
|
module.exports = ({ define }) => {
|
||||||
define('reboot', async (payload, { knex, errors, utils }) => {
|
define('reboot', async (payload, { knex, errors, utils }) => {
|
||||||
if (process.env.NODE_ENV === 'production') return exec('sudo shutdown -r now');
|
if (process.env.NODE_ENV === 'production') return exec('/etc/system_reboot.sh');
|
||||||
return;
|
return;
|
||||||
}, {
|
}, {
|
||||||
auth: true
|
auth: true
|
||||||
|
@ -2,7 +2,7 @@ const { exec } = require('child_process')
|
|||||||
|
|
||||||
module.exports = ({ define }) => {
|
module.exports = ({ define }) => {
|
||||||
define('shutdown', async (payload, { knex, errors, utils }) => {
|
define('shutdown', async (payload, { knex, errors, utils }) => {
|
||||||
if (process.env.NODE_ENV === 'production') return exec('sudo shutdown now')
|
if (process.env.NODE_ENV === 'production') return exec('/etc/system_shutdown.sh')
|
||||||
return;
|
return;
|
||||||
}, {
|
}, {
|
||||||
auth: true
|
auth: true
|
||||||
|
Loading…
Reference in New Issue
Block a user