diff --git a/docs/conf.py b/docs/conf.py index 3febdd084..13726587d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -78,7 +78,13 @@ # file that is read. This is the right place to add substitutions that should be # available in every file. branch = pbr.git._run_git_command(['rev-parse', '--abbrev-ref', 'HEAD'], pbr.git._get_git_directory()) -branch = 'dev' if branch == 'HEAD' else branch +on_rtd = os.environ.get('READTHEDOCS') == 'True' +if on_rtd: + # Hack to try to get the branch name if possible, otherwise assume 'release' + branch = pbr.git._run_git_command(['branch'], pbr.git._get_git_directory()).split('*')[-1].split('\n')[0].strip(')').split('/') + branch = branch[-1] if len(branch) == 2 else 'release' + print(branch) + rst_epilog = """ .. |branch| replace:: {branch} """.format(branch=branch) diff --git a/environment_py2.yml b/environment_py2.yml index 03532c8aa..fc4f63eb5 100644 --- a/environment_py2.yml +++ b/environment_py2.yml @@ -21,7 +21,7 @@ dependencies: - sqlalchemy=1.1* - requests=2.18* - selenium=3.4* -- coverage=4.4* +- coverage=4* - docker-py<1.10 - geoalchemy2=0.4* - owslib=0.14* diff --git a/scripts/install_tethys.bat b/scripts/install_tethys.bat index 0d7eedfce..b488af7ed 100644 --- a/scripts/install_tethys.bat +++ b/scripts/install_tethys.bat @@ -261,7 +261,7 @@ IF NOT "!ALLOWED_HOST!"=="127.0.0.1" ( SET ALLOWED_HOST_OPT=--allowed-host !ALLOWED_HOST! ) -tethys gen settings -d "!TETHYS_HOME!\src\tethys_apps" !ALLOWED_HOST_OPT! --db-username !TETHYS_DB_USERNAME! --db-password !TETHYS_DB_PASSWORD! --db-port !TETHYS_DB_PORT! +tethys gen settings !ALLOWED_HOST_OPT! --db-username !TETHYS_DB_USERNAME! --db-password !TETHYS_DB_PASSWORD! --db-port !TETHYS_DB_PORT! IF %ERRORLEVEL% NEQ 0 ( ECHO Error occured while setting up the !CONDA_ENV_NAME! environment. @@ -309,7 +309,7 @@ ECHO DOSKEY tstartdb=pg_ctl -U postgres -D "%%TETHYS_HOME%%\psql\data" -l "%%TET ECHO DOSKEY tethys_stop_db=pg_ctl -U postgres -D "%%TETHYS_HOME%%\psql\data" stop >>"!ACTIVATE_SCRIPT!" ECHO DOSKEY tstopdb=pg_ctl -U postgres -D "%%TETHYS_HOME%%\psql\data" stop >> "!ACTIVATE_SCRIPT!" ECHO DOSKEY tms=tethys manage start -p !ALLOWED_HOST!:%%TETHYS_PORT%% >> "!ACTIVATE_SCRIPT!" -ECHO DOSKEY tstart=tstartdb & tms >> "!ACTIVATE_SCRIPT!" +ECHO DOSKEY tstart=pg_ctl -U postgres -D "%%TETHYS_HOME%%\psql\data" -l "%%TETHYS_HOME%%\psql\logfile" start -o "-p %%TETHYS_DB_PORT%%" $T tethys manage start -p !ALLOWED_HOST!:%%TETHYS_PORT%% >> "!ACTIVATE_SCRIPT!" ECHO @ECHO OFF>> "!DEACTIVATE_SCRIPT!" ECHO SET TETHYS_HOME=>> "!DEACTIVATE_SCRIPT!" diff --git a/scripts/install_tethys.sh b/scripts/install_tethys.sh index 5ecba112e..567c6787a 100644 --- a/scripts/install_tethys.sh +++ b/scripts/install_tethys.sh @@ -298,109 +298,16 @@ then echo "# Tethys Platform" >> ~/${BASH_PROFILE} echo "alias t='. ${CONDA_HOME}/bin/activate ${CONDA_ENV_NAME}'" >> ~/${BASH_PROFILE} - - echo "Tethys installation complete!" - echo - echo "NOTE: to enable the new alias 't' which activates the tethys environment you must run '. ~/${BASH_PROFILE}'" - fi # Install Docker (if flag is set) set +e # don't exit on error anymore -installation_warning(){ - echo "WARNING: installing docker on $1 is not officially supported by the Tethys install script. Attempting to install with $2 script." -} - -finalize_docker_install(){ - sudo groupadd docker - sudo gpasswd -a ${USER} docker - . ${CONDA_HOME}/bin/activate ${CONDA_ENV_NAME} - sg docker -c "tethys docker init ${DOCKER_OPTIONS}" - . deactivate - echo "Docker installation finished!" - echo "You must re-login for Docker permissions to be activated." - echo "(Alternatively you can run 'newgrp docker')" -} - -ubuntu_debian_docker_install(){ - if [ "${LINUX_DISTRIBUTION}" != "ubuntu" ] && [ ${LINUX_DISTRIBUTION} != "debian" ] - then - installation_warning ${LINUX_DISTRIBUTION} "Ubuntu" - fi - - sudo apt-get update - sudo apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common - curl -fsSL https://download.docker.com/linux/${LINUX_DISTRIBUTION}/gpg | sudo apt-key add - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/${LINUX_DISTRIBUTION} $(lsb_release -cs) stable" - sudo apt-get update - sudo apt-get install -y docker-ce - - finalize_docker_install -} - -centos_docker_install(){ - if [ "${LINUX_DISTRIBUTION}" != "centos" ] - then - installation_warning ${LINUX_DISTRIBUTION} "CentOS" - fi - - sudo yum -y install yum-utils - sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo - sudo yum makecache fast - sudo yum -y install docker-ce - sudo systemctl start docker - sudo systemctl enable docker - - finalize_docker_install -} - -fedora_docker_install(){ - if [ "${LINUX_DISTRIBUTION}" != "fedora" ] - then - installation_warning ${LINUX_DISTRIBUTION} "Fedora" - fi - - sudo dnf -y install -y dnf-plugins-core - sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo - sudo dnf makecache fast - sudo dnf -y install docker-ce - sudo systemctl start docker - sudo systemctl enable docker - - finalize_docker_install -} - -if [ -n "${LINUX_DISTRIBUTION}" -a "${INSTALL_DOCKER}" = "true" ] -then - # prompt for sudo - echo "Docker installation requires some commands to be run with sudo. Please enter password:" - sudo echo "Installing Docker..." - - case ${LINUX_DISTRIBUTION} in - debian) - ubuntu_debian_docker_install - ;; - ubuntu) - ubuntu_debian_docker_install - ;; - centos) - centos_docker_install - ;; - redhat) - centos_docker_install - ;; - fedora) - fedora_docker_install - ;; - *) - echo "Automated Docker installation on ${LINUX_DISTRIBUTION} is not supported. Please see https://docs.docker.com/engine/installation/ for more information on installing Docker." - ;; - esac -fi - - +# Rename some variables for reference after deactivating tethys environment. +TETHYS_CONDA_HOME=${CONDA_HOME} +TETHYS_CONDA_ENV_NAME=${CONDA_ENV_NAME} +# Install Production configuration if flag is set ubuntu_debian_production_install() { sudo apt update @@ -476,6 +383,7 @@ then ;; esac + . ${CONDA_HOME}/bin/activate ${CONDA_ENV_NAME} pg_ctl -U postgres -D "${TETHYS_HOME}/psql/data" -l "${TETHYS_HOME}/psql/logfile" start -o "-p ${TETHYS_DB_PORT}" echo "Waiting for databases to startup..."; sleep 5 @@ -526,6 +434,108 @@ then echo "unalias trs" >> "${DEACTIVATE_SCRIPT}" fi + +# Install Docker (if flag is set + +installation_warning(){ + echo "WARNING: installing docker on $1 is not officially supported by the Tethys install script. Attempting to install with $2 script." +} + +finalize_docker_install(){ + sudo groupadd docker + sudo gpasswd -a ${USER} docker + . ${TETHYS_CONDA_HOME}/bin/activate ${TETHYS_CONDA_ENV_NAME} + sg docker -c "tethys docker init ${DOCKER_OPTIONS}" + . deactivate + echo "Docker installation finished!" + echo "You must re-login for Docker permissions to be activated." + echo "(Alternatively you can run 'newgrp docker')" +} + +ubuntu_debian_docker_install(){ + if [ "${LINUX_DISTRIBUTION}" != "ubuntu" ] && [ ${LINUX_DISTRIBUTION} != "debian" ] + then + installation_warning ${LINUX_DISTRIBUTION} "Ubuntu" + fi + + sudo apt-get update + sudo apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common + curl -fsSL https://download.docker.com/linux/${LINUX_DISTRIBUTION}/gpg | sudo apt-key add - + sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/${LINUX_DISTRIBUTION} $(lsb_release -cs) stable" + sudo apt-get update + sudo apt-get install -y docker-ce + + finalize_docker_install +} + +centos_docker_install(){ + if [ "${LINUX_DISTRIBUTION}" != "centos" ] + then + installation_warning ${LINUX_DISTRIBUTION} "CentOS" + fi + + sudo yum -y install yum-utils + sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo + sudo yum makecache fast + sudo yum -y install docker-ce + sudo systemctl start docker + sudo systemctl enable docker + + finalize_docker_install +} + +fedora_docker_install(){ + if [ "${LINUX_DISTRIBUTION}" != "fedora" ] + then + installation_warning ${LINUX_DISTRIBUTION} "Fedora" + fi + + sudo dnf -y install -y dnf-plugins-core + sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo + sudo dnf makecache fast + sudo dnf -y install docker-ce + sudo systemctl start docker + sudo systemctl enable docker + + finalize_docker_install +} + +if [ -n "${LINUX_DISTRIBUTION}" -a "${INSTALL_DOCKER}" = "true" ] +then + # prompt for sudo + echo "Docker installation requires some commands to be run with sudo. Please enter password:" + sudo echo "Installing Docker..." + + case ${LINUX_DISTRIBUTION} in + debian) + ubuntu_debian_docker_install + ;; + ubuntu) + ubuntu_debian_docker_install + ;; + centos) + centos_docker_install + ;; + redhat) + centos_docker_install + ;; + fedora) + fedora_docker_install + ;; + *) + echo "Automated Docker installation on ${LINUX_DISTRIBUTION} is not supported. Please see https://docs.docker.com/engine/installation/ for more information on installing Docker." + ;; + esac +fi + + +if [ -z "${SKIP_TETHYS_INSTALL}" ] +then + echo "Tethys installation complete!" + echo + echo "NOTE: to enable the new alias 't' which activates the tethys environment you must run '. ~/${BASH_PROFILE}'" +fi + on_exit(){ set +e set +x diff --git a/setup.py b/setup.py index a2e5db80f..1f0e5c9fd 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ requires = [] -version = '2.0.0' +version = '2.0.1' setup( name='tethys_platform',