mirror of
https://github.com/Retropex/apolloapi-v2.git
synced 2025-06-01 06:52:31 +02:00
Updater Fixes
This commit is contained in:
parent
493e509a74
commit
0fb2fdfb89
110
backend/image_update
Executable file
110
backend/image_update
Executable file
@ -0,0 +1,110 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
RED='\033[0;31m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
#This script assumes image_install has already been run previously
|
||||||
|
|
||||||
|
if [ "$EUID" -ne 0 ]
|
||||||
|
then echo -e "${RED}Update script must be run by root or with sudo${NC}"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
systemctl stop ckpool apollo-miner node apollo-api apollo-ui-v2
|
||||||
|
|
||||||
|
#### SYSTEM PACKAGES ####
|
||||||
|
#########################
|
||||||
|
echo -e "${YELLOW} ---> Installing and upgrading required system packages${NC}"
|
||||||
|
|
||||||
|
# Install required system packages
|
||||||
|
apt-get update
|
||||||
|
apt-get -y upgrade
|
||||||
|
|
||||||
|
|
||||||
|
APOLLO_DIR=/opt/apolloapi
|
||||||
|
|
||||||
|
git config --global --add safe.directory $APOLLO_DIR
|
||||||
|
git config --global --add safe.directory $APOLLO_DIR/apolloui-v2
|
||||||
|
|
||||||
|
chown -R futurebit $APOLLO_DIR
|
||||||
|
|
||||||
|
. /usr/local/nvm/nvm.sh
|
||||||
|
|
||||||
|
nvm use 21
|
||||||
|
|
||||||
|
### API ###
|
||||||
|
echo -e "${YELLOW} ---> Updating API modules${NC}"
|
||||||
|
|
||||||
|
cd $APOLLO_DIR
|
||||||
|
|
||||||
|
git reset --hard
|
||||||
|
git pull
|
||||||
|
|
||||||
|
yarn
|
||||||
|
|
||||||
|
### UI ###
|
||||||
|
echo -e "${YELLOW} ---> Updating UI modules${NC}"
|
||||||
|
|
||||||
|
cd $APOLLO_DIR/apolloui-v2
|
||||||
|
|
||||||
|
git reset --hard
|
||||||
|
git pull
|
||||||
|
|
||||||
|
yarn
|
||||||
|
|
||||||
|
echo -e "${YELLOW} ---> Building UI (could take few minutes)${NC}"
|
||||||
|
|
||||||
|
yarn build
|
||||||
|
|
||||||
|
chown -R futurebit $APOLLO_DIR
|
||||||
|
|
||||||
|
|
||||||
|
echo -e "${YELLOW} ---> Updating System binaries${NC}"
|
||||||
|
|
||||||
|
arch=$(uname -m)
|
||||||
|
|
||||||
|
cp $APOLLO_DIR/backend/apollo-miner/bin/$arch/apollo-miner $APOLLO_DIR/backend/apollo-miner/futurebit-miner
|
||||||
|
cp $APOLLO_DIR/backend/apollo-miner/bin/$arch/apollo-miner-v2 $APOLLO_DIR/backend/apollo-miner/futurebit-miner-v2
|
||||||
|
cp $APOLLO_DIR/backend/apollo-miner/bin/$arch/apollo-helper $APOLLO_DIR/backend/apollo-miner/
|
||||||
|
|
||||||
|
### Bitcoind ###
|
||||||
|
#########################
|
||||||
|
cp $APOLLO_DIR/backend/node/bin/$arch/bitcoind $APOLLO_DIR/backend/node/bitcoind
|
||||||
|
cp $APOLLO_DIR/backend/default-configs/bitcoin.conf $APOLLO_DIR/backend/node/
|
||||||
|
|
||||||
|
### ckpool ###
|
||||||
|
#########################
|
||||||
|
cp $APOLLO_DIR/backend/ckpool/bin/$arch/ckpool $APOLLO_DIR/backend/ckpool/
|
||||||
|
cp $APOLLO_DIR/backend/default-configs/ckpool.conf $APOLLO_DIR/backend/ckpool/
|
||||||
|
|
||||||
|
### SYSTEMD ###
|
||||||
|
echo -e "${YELLOW} ---> Updating systemd files${NC}"
|
||||||
|
|
||||||
|
cp $APOLLO_DIR/backend/systemd/apollo-api.service /etc/systemd/system/
|
||||||
|
cp $APOLLO_DIR/backend/systemd/apollo-ui-v2.service /etc/systemd/system/
|
||||||
|
cp $APOLLO_DIR/backend/systemd/apollo-miner.service /etc/systemd/system/
|
||||||
|
cp $APOLLO_DIR/backend/systemd/node.service /etc/systemd/system/
|
||||||
|
cp $APOLLO_DIR/backend/systemd/ckpool.service /etc/systemd/system/
|
||||||
|
|
||||||
|
#SWAP
|
||||||
|
cp $APOLLO_DIR/backend/systemd/swap.service /etc/systemd/system/
|
||||||
|
|
||||||
|
#RC LOCAL
|
||||||
|
cp $APOLLO_DIR/backend/rc.local /etc/
|
||||||
|
chmod +x /etc/rc.local
|
||||||
|
cp $APOLLO_DIR/backend/systemd/rc-local.service /etc/systemd/system/
|
||||||
|
|
||||||
|
echo -e "${YELLOW} ---> Reloading systemd${NC}"
|
||||||
|
systemctl daemon-reload
|
||||||
|
|
||||||
|
# Enable the services
|
||||||
|
systemctl enable apollo-api.service
|
||||||
|
systemctl enable apollo-ui-v2.service
|
||||||
|
systemctl enable swap.service
|
||||||
|
systemctl enable rc-local.service
|
||||||
|
systemctl enable apollo-miner.service
|
||||||
|
systemctl enable node.service
|
||||||
|
|
||||||
|
echo -e "${GREEN} ---> Image update complete${NC}"
|
@ -29,6 +29,16 @@ cp $APOLLO_DIR/backend/default-configs/bitcoin.conf $APOLLO_DIR/backend/node/
|
|||||||
cp $APOLLO_DIR/backend/ckpool/bin/$arch/ckpool $APOLLO_DIR/backend/ckpool/
|
cp $APOLLO_DIR/backend/ckpool/bin/$arch/ckpool $APOLLO_DIR/backend/ckpool/
|
||||||
cp $APOLLO_DIR/backend/default-configs/ckpool.conf $APOLLO_DIR/backend/ckpool/
|
cp $APOLLO_DIR/backend/default-configs/ckpool.conf $APOLLO_DIR/backend/ckpool/
|
||||||
|
|
||||||
|
### Write back the Bitcoin RPC password on conf file
|
||||||
|
PASS=`sqlite3 $APOLLO_DIR/futurebit.sqlite "SELECT node_rpc_password FROM settings ORDER BY id DESC LIMIT 1;"`
|
||||||
|
|
||||||
|
if [ -z "$PASS" ]
|
||||||
|
then
|
||||||
|
echo "Bitcoin password is empty will be generated by the app"
|
||||||
|
else
|
||||||
|
sed -i s/rpcpassword=futurebit/rpcpassword=${PASS}/ $APOLLO_DIR/backend/node/bitcoin.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Don't touch below this line
|
# Don't touch below this line
|
||||||
echo "90" > $TMPFILE
|
echo "90" > $TMPFILE
|
||||||
|
Loading…
Reference in New Issue
Block a user