Page MenuHomec4science

start-instance.sh
No OneTemporary

File Metadata

Created
Mon, Jun 24, 11:35

start-instance.sh

#!/usr/bin/env bash
#
# This file is part of Invenio.
# Copyright (C) 2015, 2016, 2017 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Invenio is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
# check environment variables:
if [ "${INVENIO_WEB_HOST}" = "" ]; then
echo "[ERROR] Please set environment variable INVENIO_WEB_HOST before runnning this script."
echo "[ERROR] Example: export INVENIO_WEB_HOST=192.168.50.10"
exit 1
fi
if [ "${INVENIO_WEB_INSTANCE}" = "" ]; then
echo "[ERROR] Please set environment variable INVENIO_WEB_INSTANCE before runnning this script."
echo "[ERROR] Example: export INVENIO_WEB_INSTANCE=invenio"
exit 1
fi
if [ "${INVENIO_WEB_VENV}" = "" ]; then
echo "[ERROR] Please set environment variable INVENIO_WEB_VENV before runnning this script."
echo "[ERROR] Example: export INVENIO_WEB_VENV=invenio"
exit 1
fi
if [ "${INVENIO_USER_EMAIL}" = "" ]; then
echo "[ERROR] Please set environment variable INVENIO_USER_EMAIL before runnning this script."
echo "[ERROR] Example: export INVENIO_USER_EMAIL=info@inveniosoftware.org"
exit 1
fi
if [ "${INVENIO_USER_PASS}" = "" ]; then
echo "[ERROR] Please set environment variable INVENIO_USER_PASS before runnning this script."
echo "[ERROR] Example: export INVENIO_USER_PASS=uspass123"
exit 1
fi
if [ "${INVENIO_POSTGRESQL_HOST}" = "" ]; then
echo "[ERROR] Please set environment variable INVENIO_POSTGRESQL_HOST before runnning this script."
echo "[ERROR] Example: export INVENIO_POSTGRESQL_HOST=192.168.50.11"
exit 1
fi
if [ "${INVENIO_POSTGRESQL_DBNAME}" = "" ]; then
echo "[ERROR] Please set environment variable INVENIO_POSTGRESQL_DBNAME before runnning this script."
echo "[ERROR] Example: INVENIO_POSTGRESQL_DBNAME=invenio"
exit 1
fi
if [ "${INVENIO_POSTGRESQL_DBUSER}" = "" ]; then
echo "[ERROR] Please set environment variable INVENIO_POSTGRESQL_DBUSER before runnning this script."
echo "[ERROR] Example: INVENIO_POSTGRESQL_DBUSER=invenio"
exit 1
fi
if [ "${INVENIO_POSTGRESQL_DBPASS}" = "" ]; then
echo "[ERROR] Please set environment variable INVENIO_POSTGRESQL_DBPASS before runnning this script."
echo "[ERROR] Example: INVENIO_POSTGRESQL_DBPASS=dbpass123"
exit 1
fi
if [ "${INVENIO_REDIS_HOST}" = "" ]; then
echo "[ERROR] Please set environment variable INVENIO_REDIS_HOST before runnning this script."
echo "[ERROR] Example: export INVENIO_REDIS_HOST=192.168.50.12"
exit 1
fi
if [ "${INVENIO_ELASTICSEARCH_HOST}" = "" ]; then
echo "[ERROR] Please set environment variable INVENIO_ELASTICSEARCH_HOST before runnning this script."
echo "[ERROR] Example: export INVENIO_ELASTICSEARCH_HOST=192.168.50.13"
exit 1
fi
if [ "${INVENIO_RABBITMQ_HOST}" = "" ]; then
echo "[ERROR] Please set environment variable INVENIO_RABBITMQ_HOST before runnning this script."
echo "[ERROR] Example: export INVENIO_RABBITMQ_HOST=192.168.50.14"
exit 1
fi
if [ "${INVENIO_WORKER_HOST}" = "" ]; then
echo "[ERROR] Please set environment variable INVENIO_WORKER_HOST before runnning this script."
echo "[ERROR] Example: export INVENIO_WORKER_HOST=192.168.50.15"
exit 1
fi
# load virtualenvrapper:
# shellcheck source=/dev/null
source "$(which virtualenvwrapper.sh)"
# switch virtual environment:
workon "${INVENIO_WEB_VENV}"
# quit on errors and unbound symbols:
set -o errexit
set -o nounset
# sphinxdoc-start-application-begin
${INVENIO_WEB_INSTANCE} run -h 0.0.0.0 &
# sphinxdoc-start-application-end
# runs as root or needs sudo?
if [[ "$EUID" -ne 0 ]]; then
sudo='sudo'
else
sudo=''
fi
if [ ! -f /.dockerinit ] && [ ! -f /.dockerenv ]; then
# sphinxdoc-start-nginx-begin
$sudo service nginx restart
# sphinxdoc-start-nginx-end
fi

Event Timeline