#!/bin/bash set -e set -x # Make /home/travis world-readable so the `zulip` user will be able to # read it. sudo chmod a+rX /home/travis # Uninstall the unnecessary extra versions of postgres that Travis CI # installs since if we don't do this, doing apt upgrades can fail due # to conflicts over which version of postgres should be running. sudo apt-get remove postgresql-9.1 postgresql-client-9.1 postgresql-9.1-postgis-2.2 postgresql-contrib-9.1 postgresql-9.1-postgis-2.2-scripts postgresql-9.2 postgresql-client-9.2 postgresql-9.2-postgis-2.2 postgresql-9.2-postgis-2.2-scripts postgresql-contrib-9.2 postgresql-9.4 postgresql-9.4-postgis-2.2-scripts postgresql-client-9.4 postgresql-9.5 postgresql-9.5-postgis-2.2 postgresql-9.5-postgis-2.2-scripts postgresql-contrib-9.5 postgresql-client-9.5 postgresql-9.6 postgresql-9.6-postgis-2.2 postgresql-9.6-postgis-2.2-scripts postgresql-contrib-9.6 postgresql-client-9.6 -y tools/provision --travis --production-travis cp -a tools/travis/success-http-headers.txt ~/ source tools/travis/activate-venv # Force OpenJDK 8 JRE. This is a workaround for Travis CI having # broken their java install, but also nicely provides consistency. sudo ln -nsf /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java /usr/bin/java py_version="$(python -c 'import sys; print(sys.version_info[0])')" if [ "$py_version" = 2 ]; then build_options=() else build_options=(--py3) fi if ! env TRAVIS=1 ./tools/build-release-tarball "${build_options[@]}" travis; then echo "Attempting to output failure logging data" cat /tmp/tmp.*/update-prod-static.log || true exit 1 fi mv /tmp/tmp.*/zulip-server-travis.tar.gz ./ # Remove zulip-npm-cache to ensure we install node_modules correctly rm -rf /home/travis/zulip-npm-cache # Shut down all services so that restarting postgres and rebuilding # the postgres database to match the prod installation setup will work. sudo supervisorctl stop all # Clear memcached to avoid contamination between development and prod # environments. sudo /etc/init.d/memcached restart # Drop any open connections to the development postgres installation. sudo "$(dirname "$0")/../../scripts/setup/terminate-psql-sessions" postgres zulip zulip_base # Remove and recreate the postgres database sudo pg_ctlcluster 9.3 main stop sudo pg_dropcluster 9.3 main sudo rm -rf /etc/postgresql/9.3/main /var/lib/postgresql/9.3/main sudo pg_createcluster 9.3 main