Skip to content

Instantly share code, notes, and snippets.

@tingletech
Last active May 24, 2017 04:08
Show Gist options
  • Save tingletech/5854506 to your computer and use it in GitHub Desktop.
Save tingletech/5854506 to your computer and use it in GitHub Desktop.
install Gate One on an EC2/Amazon Linux AMI
set -eu
yum -y update
yum -y install git
yum -y groupinstall "Development Tools"
yum -y install python-devel
yum -y install ncurses-devel
yum -y install dialog
yum -y install openssl-devel
yum -y install libjpeg-devel
yum -y install freetype-devel
yum -y install libtiff-devel
yum -y install lcms-devel
easy_install pip
pip install virtualenv
pip install Pillow
sudo yum -y install http://fr2.rpmfind.net/linux/dag/redhat/el5/en/x86_64/dag/RPMS/daemonize-1.6.0-1.el5.rf.x86_64.rpm
useradd gateone
# setcap 'cap_net_bind_service=+ep' /home/gateone/bin/python2.6
#!/bin/sh
### BEGIN INIT INFO
# Provides: gateone
# Required-Start: networking
# Required-Stop: networking
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start gate one
# Description: Start gate one using daemonize(1) http://software.clapper.org/daemonize/
### END INIT INFO
set -e
# AS_HOME has a default or can be read from environment
PIDFILE=$HOME/gateone/gateone.pid
AS_HOME=${AS_HOME-"$HOME/daemonize"}
LOCKFILE=$AS_HOME/log/daemonize.lock
OUTFILE=$AS_HOME/log/stdout.txt
ERRFILE=$AS_HOME/log/stderr.txt
case "$1" in
start)
set -u
/usr/sbin/daemonize -a -c /home/gateone -e $ERRFILE -o $OUTFILE -l $LOCKFILE \
/home/gateone/bin/python2.6 gateone/gateone.py --pid_file="$PIDFILE"
;;
stop)
PID=`cat $PIDFILE`
if [ -f $PIDFILE ]; then
kill -HUP $PID
printf "%s\n" "Ok"
rm -f $PIDFILE
else
printf "%s\n" "pidfile not found"
fi
;;
restart)
$0 stop
$0 start
;;
status)
# if pidof -o %PPID rpc.mountd > /dev/null; then
# echo "Running"
# exit 0
# else
# echo "Not running"
# exit 1
# fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
# sudo yum -y install http://fr2.rpmfind.net/linux/dag/redhat/el5/en/x86_64/dag/RPMS/daemonize-1.6.0-1.el5.rf.x86_64.rpm
set -e
set -o pipefail
mkdir -p src
cd src
curl -L http://prdownloads.sourceforge.net/dtach/dtach-0.8.tar.gz | tar zxf -
cd dtach-0.8
./configure --prefix=$HOME
make
mkdir -p $HOME/bin
cp dtach $HOME/bin
cd
virtualenv --system-site-packages .
. bin/activate
pip install tornado==2.4.1
pip install ordereddict
git clone https://github.com/liftoff/GateOne
cd GateOne/
git checkout v1.1
python setup.py install --prefix=$HOME
cd $HOME/gateone
openssl req -new -x509 -nodes -out certificate.pem -keyout keyfile.pem -batch
# as root: # setcap 'cap_net_bind_service=+ep' /home/gateone/bin/python2.6
# back as user: python gateone.py --pid_file=$HOME/gateone/gateone.pid
# or install gateone.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment