Skip to content

Commit

Permalink
fix travis
Browse files Browse the repository at this point in the history
  • Loading branch information
atarkowska committed Aug 28, 2016
1 parent 7d7981e commit a8040f2
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 83 deletions.
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ matrix:
- os: osx
osx_image: xcode7.3
env:
- OS=osx ICE=3.6 OMEROVER=OMERO-DEV-breaking-build
- os: osx
osx_image: xcode7
env:
- OS=osx ICE=3.6 OMEROVER=OMERO-DEV-breaking-build
- OS=osx ICE=3.6 OMEROVER=OMERO-DEV-breaking-build WEBPORT=8080 WEBPREFIX=/omero

before_install:
- python --version
Expand Down
13 changes: 1 addition & 12 deletions .travis/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,6 @@ if [[ $TRAVIS_OS_NAME == 'linux' ]]; then

else


OMERO_USER=${OMERO_USER:-}
HOME_DIR=$(eval echo ~"$OMERO_USER")

./run.sh

until [ -f ${HOME_DIR}/OMERO.py/var/django.pid ]; do
>&2 echo "OMERO.web is unavailable - sleeping"
sleep 5
done

curl -I http://localhost/webclient/login/
./test/test_osx.sh

fi
9 changes: 8 additions & 1 deletion common/omeroweb_configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@ set -e -u -x

OMERO_USER=${OMERO_USER:-}

WEBPREFIX=${WEBPREFIX:-}
WEBPORT=${WEBPORT:-80}
WEBSERVER_CONF=${WEBSERVER_CONF:-nginx}

set +u
source $(eval echo ~"${OMERO_USER}")/omerowebvenv/bin/activate
set -u

if [[ $WEBPREFIX = *[!\ ]* ]]; then
$(eval echo ~"${OMERO_USER}")/OMERO.py/bin/omero config set omero.web.prefix "${WEBPREFIX}"
$(eval echo ~"${OMERO_USER}")/OMERO.py/bin/omero config set omero.web.static_url "${WEBPREFIX}/static/"
fi

#start-config
$(eval echo ~"${OMERO_USER}")/OMERO.py/bin/omero config set omero.web.application_server wsgi-tcp
$(eval echo ~"${OMERO_USER}")/OMERO.py/bin/omero web config nginx --http "$WEBPORT" >$(eval echo ~"${OMERO_USER}")/nginx.conf.tmp
$(eval echo ~"${OMERO_USER}")/OMERO.py/bin/omero web config "${WEBSERVER_CONF}" --http "${WEBPORT}" --servername 'localhost' >$(eval echo ~"${OMERO_USER}")/nginx.conf.tmp

cat $(eval echo ~"${OMERO_USER}")/nginx.conf.tmp
2 changes: 1 addition & 1 deletion common/virtualenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ $(eval echo ~"${OMERO_USER}")/omerowebvenv/bin/omego download --ice $ICEVER --br
zip=$(ls OMERO.py*.zip)
zipname=${zip%.zip}
rm -f $zip
mv $(find . -name 'OMERO.py*' -type d) OMERO.py
mv $(find . -name 'OMERO.py*' -type d) $(eval echo ~"${OMERO_USER}")/OMERO.py

pip install -r $(eval echo ~"${OMERO_USER}")/OMERO.py/share/web/requirements-py27-trial.txt
5 changes: 3 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ OS=${OS:-centos7}
OMEROVER=${OMEROVER:-latest}
WEBSESSION=${WEBSESSION:-}
ICEVER=${ICEVER:-3.6}
WEBPREFIX=${WEBPREFIX:-}
WEBPORT=${WEBPORT:-80}

WEBSERVER_CONF=${WEBSERVER_CONF:-nginx}

path=`dirname $0`

Expand All @@ -33,7 +34,7 @@ fi

if [[ $OMERO_USER = *[!\ ]* ]]; then
su - ${OMERO_USER} -c "OMERO_USER=$OMERO_USER ICEVER=$ICEVER OMEROVER=$OMEROVER bash $path/common/virtualenv.sh"
su - ${OMERO_USER} -c "OMERO_USER=$OMERO_USER WEBPORT=$WEBPORT bash $path/common/omeroweb_configure.sh"
su - ${OMERO_USER} -c "WEBPREFIX=$WEBPREFIX WEBSERVER_CONF=$WEBSERVER_CONF OMERO_USER=$OMERO_USER WEBPORT=$WEBPORT bash $path/common/omeroweb_configure.sh"
else
bash $path/common/virtualenv.sh
bash $path/common/omeroweb_configure.sh
Expand Down
7 changes: 7 additions & 0 deletions osx/nginx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@

set -e -u -x

OMERO_USER=${OMERO_USER:-}

brew install nginx

mv $(eval echo ~"${OMERO_USER}")/nginx.conf.tmp /usr/local/etc/nginx/servers/omeroweb-nginx.conf

# Restart webserver
brew services restart nginx
3 changes: 0 additions & 3 deletions osx/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,3 @@ set -u

# Start OMERO.web
$(eval echo ~"${OMERO_USER}")/OMERO.py/bin/omero web start

# Start webserver
sudo nginx -c $(eval echo ~"${OMERO_USER}")/omeroweb-nginx.conf
1 change: 0 additions & 1 deletion test/Dockerfile_ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ RUN OMERO_USER=$OMERO_USER OS=$OS \
EXPOSE 22 80

CMD ["/bin/bash", "-e", "/tmp/omeroweb-install/omeroweb-install-test/ubuntu/run.sh"]

16 changes: 16 additions & 0 deletions test/test_osx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e -u -x

WEBPORT=${WEBPORT:-80}
WEBPREFIX=${WEBPREFIX:-}

path=`dirname $0`

bash $path/../run.sh

sleep 5

curl -I http://localhost:${WEBPORT}${WEBPREFIX}/webclient/login/

curl -I http://localhost:4080${WEBPREFIX}/webclient/login/
21 changes: 12 additions & 9 deletions test/test_services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,29 @@ OS=${OS:-centos7}
OMEROVER=${OMEROVER:-latest}
WEBSESSION=${WEBSESSION:-}
ICEVER=${ICEVER:-3.6}
WEBPORT=${WEBPORT:-80}


CNAME=omeroweb_install_test_$OS

# start docker container
if [[ "darwin" == "${OSTYPE//[0-9.]/}" ]]; then
WEBPORT=8888
docker run -d --privileged -p ${WEBPORT}:80 --name $CNAME $CNAME
docker run -d --privileged -p 8888:80 --name $CNAME $CNAME
else
docker run -d --name $CNAME -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /run $CNAME
fi

sleep 5

# check if container is running
docker inspect -f {{.State.Running}} $CNAME

sleep 5

curl -I http://localhost:${WEBPORT}/webclient/login/
# Log in to OMERO.web
if [[ "darwin" == "${OSTYPE//[0-9.]/}" ]]; then
curl -I http://localhost:8888/webclient/login/
else
DOCKER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CNAME)
curl -I http://${DOCKER_IP}/webclient/login/
fi

# stop and cleanup
docker stop $CNAME
docker rm $CNAME
#docker stop $CNAME
#docker rm $CNAME
65 changes: 33 additions & 32 deletions ubuntu/omero-web-init.d
Original file line number Diff line number Diff line change
Expand Up @@ -22,52 +22,53 @@ prog=omero-web

# Read configuration variable file if it is present
[ -r /etc/default/$prog ] && . /etc/default/$prog
# also read the omero config
[ -r /etc/default/omero ] && . /etc/default/omero


OMERO_PY=${OMERO_PY:-/home/omero/OMERO.py}
OMERO_USER=${OMERO_USER:-omero}
py_dir="/home/${OMERO_USER}/OMERO.py"
OMERO_PY=${OMERO_PY:-$py_dir}
OMERO=${OMERO_PY}/bin/omero
VENVDIR=${VENVDIR:-/home/omero/omerowebvenv}

start() {
echo -n $"Starting $prog:"
su - ${OMERO_USER} -c "${OMERO} web start" &> /dev/null && echo -n ' OMERO.web'
RETVAL=$?
[ "$RETVAL" = 0 ]
start() {
echo -n $"Starting $prog:"
su - ${OMERO_USER} -c "source $VENVDIR/bin/activate; ${OMERO} web start" &> /dev/null && echo -n ' OMERO.web'
sleep 5
ls $OMERO_PY/var/log
RETVAL=$?
[ "$RETVAL" = 0 ]
echo
}

stop() {
echo -n $"Stopping $prog:"
su - ${OMERO_USER} -c "${OMERO} web stop" &> /dev/null && echo -n ' OMERO.web'
RETVAL=$?
[ "$RETVAL" = 0 ]
echo -n $"Stopping $prog:"
su - ${OMERO_USER} -c "source $VENVDIR/bin/activate; ${OMERO} web stop" &> /dev/null && echo -n ' OMERO.web'
RETVAL=$?
[ "$RETVAL" = 0 ]
echo
}

status() {
echo -n $"Status $prog:"
su - ${OMERO_USER} -c "${OMERO} web status"
RETVAL=$?
echo -n $"Status $prog:"
su - ${OMERO_USER} -c "source $VENVDIR/bin/activate; ${OMERO} web status"
RETVAL=$?
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
RETVAL=1
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
RETVAL=1
esac
exit $RETVAL
20 changes: 3 additions & 17 deletions ubuntu/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,12 @@

set -e -u -x

while [[ $# > 1 ]]
do
key="$1"
WEBSESSION=${WEBSESSION:-}

case $key in
-w|--websession)
WEBSESSION="$2"
shift # past argument
;;
*)
# unknown option
;;
esac
shift # past argument or value
done

service postgresql start
if [[ $WEBSESSION = *[!\ ]* ]]; then
service redis start
service redis start
fi

#service crond start # Doesn't work in Docker
cron
service nginx start
Expand Down

0 comments on commit a8040f2

Please sign in to comment.