first commit
This commit is contained in:
65
tools/push-script.sh
Executable file
65
tools/push-script.sh
Executable file
@ -0,0 +1,65 @@
|
||||
# This scripts copy the start service script into the server.
|
||||
# You need a ssh key with root permissions.
|
||||
|
||||
ENV=$1
|
||||
CUSTOM_ENV=$2
|
||||
|
||||
# Checking valid environment
|
||||
if [ "$ENV" != "prod" ] && [ "$ENV" != "dev" ] && [ "$ENV" != "demo" ] && [ "$ENV" != "open-demo" ]; then
|
||||
if [ "$CUSTOM_ENV" != "true" ]; then
|
||||
echo "Invalid environment $ENV";
|
||||
exit 0;
|
||||
fi
|
||||
echo "WARNING: you are using a custom env $CUSTOM_ENV"
|
||||
fi
|
||||
|
||||
echo "\033[0;31m"
|
||||
echo " *************************************************************************"
|
||||
echo " | |"
|
||||
echo " | >>> Make sure you already created an user \033[0;45m quantex \033[0m\033[0;31m |"
|
||||
echo " | on the $ENV server!!! |"
|
||||
echo " | |"
|
||||
echo " | Use: adduser --shell /bin/rbash --home /home/quantex quantex |"
|
||||
echo " | |"
|
||||
echo " | >>> and add \033[0;45m QUANTEX_PASS \033[0m\033[0;31m variable on GitLab |"
|
||||
echo " | |"
|
||||
echo " *************************************************************************"
|
||||
echo "\033[0m"
|
||||
|
||||
read -p "Press enter to continue"
|
||||
|
||||
echo "Pushing scripts to $ENV.quantex.com.ar"
|
||||
|
||||
ssh root@"$ENV".quantex.com.ar "mkdir -p /home/quantex/qfixpt; chown quantex:quantex /home/quantex/qfixpt"
|
||||
ssh root@"$ENV".quantex.com.ar "mkdir -p /home/quantex/qfixpt/logs; chown quantex:quantex /home/quantex/qfixpt/logs"
|
||||
|
||||
scp tools/unzip-qfixpt.sh root@"$ENV".quantex.com.ar:/usr/bin/
|
||||
ssh root@"$ENV".quantex.com.ar "chmod +x /usr/bin/unzip-qfixpt.sh"
|
||||
|
||||
scp tools/start root@"$ENV".quantex.com.ar:/home/quantex/qfixpt/
|
||||
ssh root@"$ENV".quantex.com.ar "chmod +x /home/quantex/qfixpt/start; chown quantex:quantex /home/quantex/qfixpt/start"
|
||||
|
||||
scp tools/stop root@"$ENV".quantex.com.ar:/home/quantex/qfixpt/
|
||||
ssh root@"$ENV".quantex.com.ar "chmod +x /home/quantex/qfixpt/stop; chown quantex:quantex /home/quantex/qfixpt/stop"
|
||||
|
||||
scp tools/backup.sh root@"$ENV".quantex.com.ar:/home/quantex/qfixpt/
|
||||
ssh root@"$ENV".quantex.com.ar "chmod +x /home/quantex/qfixpt/backup.sh; chown quantex:quantex /home/quantex/qfixpt/backup.sh"
|
||||
|
||||
scp tools/rollback.sh root@"$ENV".quantex.com.ar:/home/quantex/qfixpt/
|
||||
ssh root@"$ENV".quantex.com.ar "chmod +x /home/quantex/qfixpt/rollback.sh; chown quantex:quantex /home/quantex/qfixpt/rollback.sh"
|
||||
|
||||
scp tools/qfixpt.service root@"$ENV".quantex.com.ar:/etc/systemd/system/
|
||||
scp tools/qfixpt-watcher.path root@"$ENV".quantex.com.ar:/etc/systemd/system/
|
||||
scp tools/qfixpt-watcher.service root@"$ENV".quantex.com.ar:/etc/systemd/system/
|
||||
|
||||
ssh root@"$ENV".quantex.com.ar "systemctl enable qfixpt.service; systemctl start qfixpt.service"
|
||||
ssh root@"$ENV".quantex.com.ar "systemctl enable qfixpt-watcher.path; systemctl start qfixpt-watcher.path"
|
||||
|
||||
echo "\033[0;31m"
|
||||
echo " ************************************************"
|
||||
echo " | |"
|
||||
echo " | >>> Remember you need a \033[0;45m conf.toml \033[0m\033[0;31m file |"
|
||||
echo " | on the qfixpt folder!!! |"
|
||||
echo " | |"
|
||||
echo " ************************************************\033[0m"
|
||||
|
||||
Reference in New Issue
Block a user