Maintenance: Remove deprecated and unmaintained script.

This commit is contained in:
Thorsten Eckel 2021-06-18 12:49:42 +00:00
parent d881558e6c
commit 52a8ad7db0
3 changed files with 0 additions and 310 deletions

View file

@ -1,127 +0,0 @@
#!/bin/bash
#
# init script build as PoC for
# 1) normal user (non root)
# 2) rvm support
# 3) pid files in user space
# 4) fedora os
# source function library
. /etc/rc.d/init.d/functions
# Get network config
. /etc/sysconfig/network
[ "${NETWORKING}" = "no" ] && exit 0
DAEMON_HOME=/home/kraftvoll/zammad/
#RAILS_ENV=production
RAILS_ENV=test
NAME=zammad
APP_PORT=3000
WS_PORT=6042
ZAMMAD_CONFIG=/etc/sysconfig/zammad
# Read config
[ -f "$ZAMMAD_CONFIG" ] && . "$ZAMMAD_CONFIG"
# Load RVM into a shell session *as a function*
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
# First try to load from a user install
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
# Then try to load from a root install
source "/usr/local/rvm/scripts/rvm"
else
printf "ERROR: An RVM installation was not found.\n"
exit 1
fi
rvm use ruby-2.0.0
RUBY=$(which ruby)
RAILS=$(which rails)
BUNDLE=$(which bundle)
APP_PIDFILE=$DAEMON_HOME/tmp/pids/puma.pid
WS_PIDFILE=$DAEMON_HOME/tmp/pids/websocket.pid
SCHEDULER_PIDFILE=$DAEMON_HOME/tmp/pids/scheduler_runner.pid
start() {
cd $DAEMON_HOME
# precompile assets
if [ "$RAILS_ENV" = "production" ]; then
echo -n $"Precompile assets for ${NAME}/${RAILS_ENV}"
$BUNDLE exec rake assets:precompile &> /dev/null && echo_success || echo_failure
echo
fi
# start web server
echo -n $"Starting ${NAME}/${RAILS_ENV} application server on port: ${APP_PORT}"
# $RAILS server -d -p $APP_PORT --pid $APP_PIDFILE &> /dev/null
# thin start --threaded -d -p $APP_PORT --pid $APP_PIDFILE
puma --pidfile $APP_PIDFILE -d -p $APP_PORT -e $RAILS_ENV &> /dev/null
sleep 2
status -p $APP_PIDFILE &> /dev/null && echo_success || echo_failure
echo
# start websocket server
echo -n $"Starting ${NAME}/${RAILS_ENV} web socket server on port: ${WS_PORT}"
script/websocket-server.rb start -d -p $WS_PORT -i $WS_PIDFILE &> /dev/null &
sleep 2
status -p $WS_PIDFILE &> /dev/null && echo_success || echo_failure
echo
# start scheduler worker
echo -n $"Starting ${NAME}/${RAILS_ENV} scheduler worker"
script/scheduler.rb start &> /dev/null && echo_success || echo_failure
echo
}
stop() {
# stop scheduler worker
echo -n $"Shutting down ${NAME}/${RAILS_ENV} scheduler worker"
script/scheduler.rb stop &> /dev/null && echo_success || echo_failure
echo
# stop websocket server
echo -n $"Shutting down ${NAME}/${RAILS_ENV} web socket server on port: ${WS_PORT}"
if test -e $WS_PIDFILE; then
killproc -p $WS_PIDFILE
fi
echo
# stop web server
echo -n $"Shutting down ${NAME}/${RAILS_ENV} application server on port: ${APP_PORT}"
if test -e $APP_PIDFILE; then
killproc -p $APP_PIDFILE
fi
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status -p $APP_PIDFILE "${NAME} ${RAILS_ENV} - application server"
status -p $WS_PIDFILE "${NAME} ${RAILS_ENV} - web socket server"
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|status}" >&2
exit 3
;;
esac

View file

@ -1,106 +0,0 @@
#!/bin/bash
USER=zammad
REPOURL=git@github.com:martini/zammad.git
DBNAME=zammad
DBUSER=zammad
function check_requirements() {
items="git useradd sudo getent curl bash gcc make svn apg"
for item in $items
do
which $item > /dev/null
if [ $? -ne 0 ]; then
echo Please install $item and start this script again.
exit 1
fi
done
}
function check_os()
{
# Debian
if [ -f /etc/debian_version ]; then
OS=Debian
local MAJOR
MAJOR=$(cut -d. /etc/debian_version -f1)
if [ $MAJOR -lt 7 ]; then
echo Please check the supported operating systems
exit 1
fi
fi
}
check_requirements
check_os
#
# @TODO Should the mysql user be created?
# @TODO Install Elasticsearch?
# @TODO Should the script create a VirtualHost or a config file to include for apache/nginx?
#
#
# Check for zammad user and create if needed
#
id -u "${USER}" > /dev/null 2>&1
if [ $? -ne 0 ]; then
useradd -c 'user running zammad' -m -s /bin/bash $USER
fi
#
# find the user's homedir and primary group name
#
HOMEDIR=$(getent passwd $USER | cut -d: -f 6)
GROUP=$(id -gn $USER)
cd "${HOMEDIR}" || exit 1
sudo -u "${USER}" -H git clone $REPOURL zammad
cd zammad || exit 1
LATEST=$(git tag --list|sort|tail -1)
git checkout tags/"${LATEST}"
chown -R "${USER}":"${GROUP}" .
#
# RVM
#
sudo -u "${USER}" -H bash -c 'curl -sSL https://get.rvm.io | bash -s stable'
#
# install Ruby
#
sudo -u "${USER}" -H bash -l -c 'rvm install 2.1.2'
sudo -u "${USER}" -H bash -l -c 'rvm alias create default 2.1.2'
#
# after rvm requirements
# Installing required packages: gawk, g++, libreadline6-dev, zlib1g-dev, libssl-dev, libyaml-dev, libsqlite3-dev, sqlite3, autoconf, libgdbm-dev, libncurses5-dev, automake, libtool, bison, pkg-config, libffi-dev................
sudo -u "${USER}" -H bash -l -c 'cd ~/zammad && gem install rails --no-ri --no-rdoc'
sudo -u "${USER}" -H bash -l -c 'cd ~/zammad && bundle install --jobs 8'
DBPASS=$(apg -x8|head -1)
echo Password $DBPASS
mysql -e "GRANT ALL ON ${DBNAME}.* to '${DBUSER}'@'localhost' IDENTIFIED BY '$DBPASS'";
sudo -u $USER -H cp ${HOMEDIR}/zammad/config/database.yml.dist ${HOMEDIR}/zammad/config/database.yml
sudo -u $USER -H sed -i s/some_pass/${DBPASS}/g ${HOMEDIR}/zammad/config/database.yml
sudo -u $USER -H sed -i s/some_user/${DBUSER}/g ${HOMEDIR}/zammad/config/database.yml
sudo -u $USER -H sed -i s/zammad_prod/zammad/g ${HOMEDIR}/zammad/config/database.yml
#
#
#
sudo -u "${USER}" -H bash -l -c 'cd ~/zammad && RAILS_ENV=production rake db:create'
sudo -u "${USER}" -H bash -l -c 'cd ~/zammad && RAILS_ENV=production rake db:migrate'
sudo -u "${USER}" -H bash -l -c 'cd ~/zammad && RAILS_ENV=production rake db:seed'
sudo -u "${USER}" -H bash -l -c 'cd ~/zammad && RAILS_ENV=production rake assets:precompile'
cp "${HOMEDIR}/zammad/script/init.d/zammad" /etc/init.d/zammad
chmod +x /etc/init.d/zammad
if [ "$OS" = "Debian" ]; then
update-rc.d zammad defaults
fi

View file

@ -1,77 +0,0 @@
#!/bin/bash
while true; do
read -p "Do you wish to drop the database and execute all browser tests?" yn
case $yn in
[Yy]* ) echo "Start tests..."; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
#export RAILS_ENV=test
export RAILS_ENV=production
export RAILS_SERVE_STATIC_FILES=true
export ZAMMAD_SETTING_TTL=15
export Z_LOCALES=en-us:de-de
bundle install --jobs 8
rm -rf tmp/screenshot*
rm -rf tmp/cache*
rm -f public/assets/*.css*
rm -f public/assets/*.js*
echo "rake assets:precompile"
time rake assets:precompile
echo "rake db:drop"
time rake db:drop
echo "rake db:create"
time rake db:create
echo "rake db:migrate"
time rake db:migrate
echo "rake db:seed"
time rake db:seed
# set system to develop mode
rails r "Setting.set('developer_mode', true)"
pumactl --pidfile tmp/pids/puma.pid stop
script/websocket-server.rb stop
#rails s puma -d --pid tmp/pids/puma.pid --bind 0.0.0.0 --port 4445
rails s puma --pid tmp/pids/puma.pid --bind 0.0.0.0 --port 4445 &
script/websocket-server.rb start -d
script/scheduler.rb start
sleep 16
#export REMOTE_URL='http://medenhofer:765d0dd4-994b-4e15-9f89-13f3aedeb462@ondemand.saucelabs.com:80/wd/hub' BROWSER_OS='Windows 2012' BROWSER_VERSION=35 BROWSER=firefox
#export REMOTE_URL='http://192.168.178.32:4444/wd/hub'
#export REMOTE_URL='http://192.168.178.45:4444/wd/hub'
#export REMOTE_URL='http://10.0.0.9:4444/wd/hub'
#export REMOTE_URL='http://10.8.0.22:4449/wd/hub'
export REMOTE_URL='http://localhost:4444/wd/hub'
export RAILS_ENV=test
echo "rake db:drop"
time rake db:drop
echo "rake db:create"
time rake db:create
echo "rake db:migrate"
time rake db:migrate
#rake test:browser["BROWSER_URL=http://10.8.0.6:3000"]
rake test:browser["BROWSER_URL=http://localhost:4445"]
#rake test:browser["BROWSER_URL=http://10.0.0.3:4445"]
#rake test:browser["BROWSER_URL=http://localhost:4445 BROWSER=chrome"]
script/scheduler.rb stop
script/websocket-server.rb stop
pumactl --pidfile tmp/pids/puma.pid stop
rm -f public/assets/*.css*
rm -f public/assets/*.js*