Skip to content

Commit

Permalink
Update the script to kuda repo.
Browse files Browse the repository at this point in the history
  • Loading branch information
afiniel committed Jan 18, 2023
1 parent c2ae7f3 commit dd3761e
Show file tree
Hide file tree
Showing 16 changed files with 1,228 additions and 191 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# yiimpool_yiimp_single
Installation files for Yiimpool Yiimp v2.0
Installation files for Yiimpool Yiimp v2.1

#### These files do nothing on their own please go to https://github.com/Afiniel-tech/Yiimpool-Installer
68 changes: 46 additions & 22 deletions db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,40 @@
source /etc/functions.sh
source /etc/yiimpool.conf
source $STORAGE_ROOT/yiimp/.yiimp.conf
source $HOME/yiimpool/yiimp_single/.wireguard.install.cnf
source $HOME/yiimp_install_script/yiimp_single/.wireguard.install.cnf

set -eu -o pipefail

function print_error {
read line file <<<$(caller)
echo "An error occurred in line $line of file $file:" >&2
sed "${line}q;d" "$file" >&2
read line file <<<$(caller)
echo "An error occurred in line $line of file $file:" >&2
sed "${line}q;d" "$file" >&2
}
trap print_error ERR

term_art
if [[ ("$wireguard" == "true") ]]; then
source $STORAGE_ROOT/yiimp/.wireguard.conf
source $STORAGE_ROOT/yiimp/.wireguard.conf
fi

echo -e "$YELLOW Installing MariaDB 10.4...$COL_RESET"
echo -e "$MAGENTA <----------------------------->$COL_RESET"
echo -e "$YELLOW <-- Installing MariaDB 10.4 -->$COL_RESET"
echo -e "$MAGENTA <----------------------------->$COL_RESET"

MARIADB_VERSION='10.4'
sudo debconf-set-selections <<< "maria-db-$MARIADB_VERSION mysql-server/root_password password $DBRootPassword"
sudo debconf-set-selections <<< "maria-db-$MARIADB_VERSION mysql-server/root_password_again password $DBRootPassword"
sudo debconf-set-selections <<<"maria-db-$MARIADB_VERSION mysql-server/root_password password $DBRootPassword"
sudo debconf-set-selections <<<"maria-db-$MARIADB_VERSION mysql-server/root_password_again password $DBRootPassword"
apt_install mariadb-server mariadb-client
echo -e "$GREEN MariaDB build complete...$COL_RESET"
echo -e "$YELLOW Creating DB users for YiiMP...$COL_RESET"
echo -e "$GREEN => MariaDB build complete <= $COL_RESET"
echo
echo -e "$YELLOW => Creating DB users for YiiMP <= $COL_RESET"

if [[ ("$wireguard" == "false") ]]; then
Q1="CREATE DATABASE IF NOT EXISTS ${YiiMPDBName};"
Q2="GRANT ALL ON ${YiiMPDBName}.* TO '${YiiMPPanelName}'@'localhost' IDENTIFIED BY '$PanelUserDBPassword';"
Q3="GRANT ALL ON ${YiiMPDBName}.* TO '${StratumDBUser}'@'localhost' IDENTIFIED BY '$StratumUserDBPassword';"
Q4="FLUSH PRIVILEGES;"
SQL="${Q1}${Q2}${Q3}${Q4}"
sudo mysql -u root -p"${DBRootPassword}" -e "$SQL"
sudo mysql -u root -p"${DBRootPassword}" -e "$SQL"

else
Q1="CREATE DATABASE IF NOT EXISTS ${YiiMPDBName};"
Expand All @@ -47,9 +51,9 @@ else
sudo mysql -u root -p"${DBRootPassword}" -e "$SQL"
fi

echo -e "$GREEN Database creation complete...$COL_RESET"
echo -e "$GREEN => Database creation complete <= $COL_RESET"

echo -e "$YELLOW Creating my.cnf...$COL_RESET"
echo -e "$YELLOW => Creating my.cnf <= $COL_RESET"

if [[ ("$wireguard" == "false") ]]; then
echo '[clienthost1]
Expand Down Expand Up @@ -85,17 +89,37 @@ password='"${DBRootPassword}"'
fi

sudo chmod 0600 $STORAGE_ROOT/yiimp/.my.cnf
echo -e "$GREEN Passwords can be found in $RED $STORAGE_ROOT/yiimp/.my.cnf $COL_RESET $COL_RESET"

echo -e "$YELLOW Importing YiiMP Default database values...$COL_RESET"
echo -e "$YELLOW => Importing YiiMP Default database values <= $COL_RESET"
cd $STORAGE_ROOT/yiimp/yiimp_setup/yiimp/sql
# import SQL dump
sudo zcat 2019-11-10-yiimp.sql.gz | sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}"
sudo zcat 2020-11-10-yaamp.sql.gz | sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}"
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2016-04-24-market_history.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2016-04-27-settings.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2016-05-11-coins.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2016-05-15-benchmarks.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2016-05-23-bookmarks.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2016-06-01-notifications.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2016-06-04-bench_chips.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2016-11-23-coins.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2017-02-05-benchmarks.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2017-03-31-earnings_index.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2017-05-accounts_case_swaptime.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2017-06-payouts_coinid_memo.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2017-09-notifications.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2017-10-bookmarks.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2017-11-segwit.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2018-01-stratums_ports.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2018-02-coins_getinfo.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2018-09-22-workers.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2019-03-coins_thepool_life.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2020-06-03-blocks.sql
echo -e "$YELLOW Datebase import $GREEN complete...$COL_RESET"
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2022-10-14-shares_solo.sql
sudo mysql -u root -p"${DBRootPassword}" "${YiiMPDBName}" --force < 2022-10-29-blocks_effort.sql
echo -e "$YELLOW <-- Datebase import $GREEN complete -->$COL_RESET"

echo -e "$YELLOW Tweaking MariaDB for better performance...$COL_RESET"
echo
echo -e "$YELLOW => Tweaking MariaDB for better performance <= $COL_RESET"
if [[ ("$wireguard" == "false") ]]; then
sudo sed -i '/max_connections/c\max_connections = 800' /etc/mysql/my.cnf
sudo sed -i '/thread_cache_size/c\thread_cache_size = 512' /etc/mysql/my.cnf
Expand All @@ -113,8 +137,8 @@ else
sudo sed -i 's/#bind-address=0.0.0.0/bind-address='${DBInternalIP}'/g' /etc/mysql/my.cnf
fi

echo -e "$GREEN Database tweak complete...$COL_RESET"
# Restart MariaDB
restart_service mysql
echo -e "$GREEN Database build complete...$COL_RESET"

set +eu +o pipefail
cd $HOME/yiimpool/yiimp_single
cd $HOME/yiimpool/yiimp_single
2 changes: 1 addition & 1 deletion menu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

source /etc/functions.sh

RESULT=$(dialog --stdout --default-item 1 --title "Yiimpool Yiimp installer v2.0" --menu "Choose one" -1 60 6 \
RESULT=$(dialog --stdout --default-item 1 --title "Yiimpool Yiimp installer v2.1" --menu "Choose one" -1 60 6 \
' ' "- Without wireguard installed use the following option -" \
1 "YiiMP - server without wireguard installed" \
' ' "- If you plan on adding more servers later use the following option -" \
Expand Down
12 changes: 6 additions & 6 deletions questions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ source $STORAGE_ROOT/yiimp/.wireguard.conf
fi

if [[ ("$wireguard" == "true") ]]; then
message_box "Yiimpool Yiimp installer v2.0" \
"You have choosen to install Yiimpool Yiimp v2.0 with WireGuard!
message_box "Yiimpool Yiimp installer v2.1" \
"You have choosen to install Yiimpool Yiimp v2.1 with WireGuard!
\n\nThis option will install all componets of YiiMP on a single server along with WireGuard so you can easily add additional servers in the future.
\n\nPlease make sure any domain name or sub domain names are pointed to this servers IP prior to running this installer.
\n\nAfter answering the following questions, setup will be automated.
\n\nNOTE: If installing on a system with less then 8 GB of RAM you may experience system issues!"
else
message_box "Yiimpool Yiimp installer v2.0" \
"You have choosen to install Yiimpool Yiimp v2.0!
message_box "Yiimpool Yiimp installer v2.1" \
"You have choosen to install Yiimpool Yiimp v2.1!
\n\nThis option will install all componets of YiiMP on a single server.
\n\nPlease make sure any domain name or sub domain names are pointed to this servers IP prior to running this installer.
\n\nAfter answering the following questions, setup will be automated.
Expand Down Expand Up @@ -273,7 +273,7 @@ StratumDBUser='"${StratumDBUser}"'
StratumUserDBPassword='"'"''"${StratumUserDBPassword}"''"'"'
# Unless you do some serious modifications this installer will not work with any other repo of yiimp!
YiiMPRepo='https://github.com/Afiniel-tech/yiimp.git'
YiiMPRepo='https://github.com/Kudaraidee/yiimp.git'
' | sudo -E tee $STORAGE_ROOT/yiimp/.yiimp.conf >/dev/null 2>&1
else
echo 'STORAGE_USER='"${STORAGE_USER}"'
Expand Down Expand Up @@ -301,7 +301,7 @@ StratumUserDBPassword='"'"''"${StratumUserDBPassword}"''"'"'
YiiMPStratumName='"${YiiMPStratumName}"'
# Unless you do some serious modifications this installer will not work with any other repo of yiimp!
YiiMPRepo='https://github.com/Afiniel-tech/yiimp.git'
YiiMPRepo='https://github.com/Kudaraidee/yiimp.git'
' | sudo -E tee $STORAGE_ROOT/yiimp/.yiimp.conf >/dev/null 2>&1
fi;;
1)
Expand Down
4 changes: 2 additions & 2 deletions server_cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fi
# #
# Program: yiimp screen startup script #
# #
# BTC Donation: bc1qpnxtg3dvtglrvfllfk3gslt6h5zffkf069nh8r #
# BTC Donation: bc1q582gdvyp09038hp9n5sfdtp0plkx5x3yrhq05y #
# #
################################################################################
sudo chmod 777 $STORAGE_ROOT/yiimp/site/log/.
Expand All @@ -60,7 +60,7 @@ echo '#!/usr/bin/env bash
# #
# Program: yiimp stratum startup script #
# #
# BTC Donation: bc1qpnxtg3dvtglrvfllfk3gslt6h5zffkf069nh8r #
# BTC Donation: bc1q582gdvyp09038hp9n5sfdtp0plkx5x3yrhq05y #
# #
################################################################################
source /etc/yiimpool.conf
Expand Down
20 changes: 11 additions & 9 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ source nginx_upgrade.sh
source web.sh
source stratum.sh
source daemon.sh
if [[ ("$UsingDomain" == "yes") ]]; then
source send_mail.sh
fi

# if [[ ("$UsingDomain" == "yes") ]]; then
# source send_mail.sh
# fi

source server_cleanup.sh
source motd.sh
source server_harden.sh
Expand All @@ -60,7 +62,7 @@ source $STORAGE_ROOT/yiimp/.yiimp.conf
clear

if [[ ("$UsingDomain" == "yes") ]]; then
echo -e "Installation of your Yiimpool Yiimp v2.0 is now completed."
echo -e "Installation of your Yiimpool Yiimp v2.1 is now completed."
echo -e "You $RED*MUST REBOOT*$COL_RESET the machine to finalize the machine updates and folder permissions! $MAGENTA YiiMP will not function until a reboot is performed!$COL_RESET"
echo
echo -e "$YELLOW Important!$COL_RESET After first reboot it may take up to 1 minute for the main|loop2|blocks|debug screens to start!"
Expand All @@ -71,7 +73,7 @@ if [[ ("$UsingDomain" == "yes") ]]; then
echo -e "$RED By default all stratum ports are blocked by the firewall.$COL_RESET To allow a port through, from the command prompt type $GREEN sudo ufw allow port number.$COL_RESET"
echo "Database user names and passwords can be found in $STORAGE_ROOT/yiimp_setup/.my.cnf"
else
echo -e "Installation of your Yiimpool Yiimp v2.0 is now completed."
echo -e "Installation of your Yiimpool Yiimp v2.1 is now completed."
echo -e "You $RED*MUST REBOOT*$COL_RESET the machine to finalize the machine updates and folder permissions! $MAGENTA YiiMP will not function until a reboot is performed!$COL_RESET"
echo
echo -e "$YELLOW Important!$COL_RESET After first reboot it may take up to 1 minute for the main|loop2|blocks|debug screens to start!"
Expand All @@ -88,14 +90,14 @@ echo
echo -e "$YELLOW Happy mining $COL_RESET"
echo "----------------------------------------------------------------------------"
echo
echo -e "$GREEN Thank you for using Afiniel Yiimpool Installer v2.0!$COL_RESET"
echo -e "$GREEN Thank you for using Afiniel Yiimpool Installer v2.1!$COL_RESET"
echo
echo -e "$YELLOW To run this installer anytime simply type, $GREEN yiimpool $COL_RESET"
echo -e "$YELLOW If you want to support by donate, use wallet below $COL_RESET"
echo
echo -e "$YELLOW BTC:$COL_RESET $GREEN bc1qpnxtg3dvtglrvfllfk3gslt6h5zffkf069nh8r $COL_RESET"
echo -e "$YELLOW BCH:$COL_RESET $GREEN qpy2ehcxtddkfrrxqyq5skrvace66wvuqyuyzc87sc $COL_RESET"
echo -e "$YELLOW BTC:$COL_RESET $GREEN bc1q582gdvyp09038hp9n5sfdtp0plkx5x3yrhq05y $COL_RESET"
echo -e "$YELLOW BCH:$COL_RESET $GREEN qzz0aff2k0xnwyzg7k9fcxlndtaj4wa65uxteqe84m $COL_RESET"
echo -e "$YELLOW ETH:$COL_RESET $GREEN 0x50C7d0BF9714dBEcDc1aa6Ab0E72af8e6Ce3b0aB $COL_RESET"
echo -e "$YELLOW DOGE:$COL_RESET $GREEN DCj73fKJbHeDTJx7arz4z7bbknWkSDpD8h $COL_RESET"
echo -e "$YELLOW DOGE:$COL_RESET $GREEN DSzcmyCRi7JeN4XUiV2qYhRQAydNv7A1Yb $COL_RESET"
echo "----------------------------------------------------------------------------"
exit 0
57 changes: 37 additions & 20 deletions stratum.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,45 @@
#!/usr/bin/env bash

#####################################################
# Created by Afiniel for Yiimpool use...
#####################################################
##########################################
# Created by Afiniel for Yiimpool use... #
##########################################

source /etc/functions.sh
source $STORAGE_ROOT/yiimp/.yiimp.conf
source $HOME/yiimpool/yiimp_single/.wireguard.install.cnf
source /etc/yiimpool.conf
source /home/crypto-data/yiimp/.yiimp.conf
source $HOME/yiimp_install_script/yiimp_single/.wireguard.install.cnf

echo -e "$YELLOW Building blocknotify and stratum...$COL_RESET"
term_art
echo -e "$MAGENTA <--------------------->$COL_RESET"
echo -e "$YELLOW <-- Compile Stratum -->$COL_RESET"
echo -e "$MAGENTA <--------------------->$COL_RESET"
cd /home/crypto-data/yiimp/yiimp_setup

cd $STORAGE_ROOT/yiimp/yiimp_setup/yiimp
cd $STORAGE_ROOT/yiimp/yiimp_setup/yiimp/blocknotify
# Starting the build progress of the stratum
echo -e "$YELLOW => Building blocknotify , iniparser , stratum... <= $COL_RESET"

# Generating Random Password for stratum
blckntifypass=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`
sudo sed -i 's/tu8tu5/'${blckntifypass}'/' blocknotify.cpp
hide_output sudo make
cd $STORAGE_ROOT/yiimp/yiimp_setup/yiimp/stratum/iniparser
hide_output sudo make
cd $STORAGE_ROOT/yiimp/yiimp_setup/yiimp/stratum
if [[ ("$AutoExchange" == "yes") ]]; then
sudo sed -i 's/CFLAGS += -DNO_EXCHANGE/#CFLAGS += -DNO_EXCHANGE/' $STORAGE_ROOT/yiimp/yiimp_setup/yiimp/stratum/Makefile

# Compil Blocknotify
cd /home/crypto-data/yiimp/yiimp_setup/yiimp/blocknotify
sudo sed -i 's/tu8tu5/'$blckntifypass'/' blocknotify.cpp
hide_output make -j$((`nproc`+1))

# Compil Stratum
cd /home/crypto-data/yiimp/yiimp_setup/yiimp/stratum
hide_output git submodule init && hide_output git submodule update
hide_output sudo make -C algos
hide_output sudo make -C sha3
hide_output sudo make -C iniparser
cd secp256k1 && chmod +x autogen.sh && hide_output ./autogen.sh && hide_output ./configure --enable-experimental --enable-module-ecdh --with-bignum=no --enable-endomorphism && hide_output make -j$((`nproc`+1))
if [[ ("$AutoExchange" == "y" || "$AutoExchange" == "Y") ]]; then
sudo sed -i 's/CFLAGS += -DNO_EXCHANGE/#CFLAGS += -DNO_EXCHANGE/' $HOME/yiimp/stratum/Makefile
fi
hide_output sudo make
cd /home/crypto-data/yiimp/yiimp_setup/yiimp/stratum
hide_output make -j$((`nproc`+1))

echo -e "$YELLOW Building stratum folder structure and copying files...$COL_RESET"
echo -e "$CYAN => Building stratum folder structure and copying files... <= $COL_RESET"
cd $STORAGE_ROOT/yiimp/yiimp_setup/yiimp/stratum
sudo cp -a config.sample/. $STORAGE_ROOT/yiimp/site/stratum/config
sudo cp -r stratum $STORAGE_ROOT/yiimp/site/stratum
Expand Down Expand Up @@ -54,7 +70,7 @@ cd '""''"${STORAGE_ROOT}"''""'/yiimp/site/stratum/config/ && ./run.sh $*
' | sudo -E tee $STORAGE_ROOT/yiimp/site/stratum/run.sh >/dev/null 2>&1
sudo chmod +x $STORAGE_ROOT/yiimp/site/stratum/run.sh

echo -e " Updating stratum config files with database connection info...$COL_RESET"
echo -e "$YELLOW => Updating stratum config files with database$GREEN connection$YELLOW info <= $COL_RESET"
cd $STORAGE_ROOT/yiimp/site/stratum/config

sudo sed -i 's/password = tu8tu5/password = '${blckntifypass}'/g' *.conf
Expand All @@ -72,5 +88,6 @@ sudo sed -i 's/password = patofpaq/password = '${StratumUserDBPassword}'/g' *.co
sudo setfacl -m u:$USER:rwx $STORAGE_ROOT/yiimp/site/stratum/
sudo setfacl -m u:$USER:rwx $STORAGE_ROOT/yiimp/site/stratum/config

echo -e "$GREEN Stratum build complete...$COL_RESET"
cd $HOME/yiimpool/yiimp_single
sleep 1.5
term_art
echo -e "$GREEN => Stratum build complete $COL_RESET"
Loading

0 comments on commit dd3761e

Please sign in to comment.