aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-06-07 11:18:38 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-06-07 12:17:41 +0100
commitffbec97ee1b821119646df0ddd696c6317b9fa4b (patch)
tree3e0fe83d242976fb4cbfc904e78ad8af2ae1a1d5
parent660048ae58c9461b9816abdf06c5035626cc7e65 (diff)
Improve error handling of Vagrant installation.
It should now show a failure message on failure, rather than always show the success message, and not show a confusing error about general.yml if something went wrong before creating that file.
-rwxr-xr-xVagrantfile24
-rwxr-xr-xbin/install-as-user8
-rw-r--r--bin/site-specific-install.sh12
3 files changed, 24 insertions, 20 deletions
diff --git a/Vagrantfile b/Vagrantfile
index 4bb173874..31f645da7 100755
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -43,13 +43,23 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Fetch and run install script
wget -O install-site.sh --no-verbose https://github.com/mysociety/commonlib/raw/master/bin/install-site.sh
sh install-site.sh --dev fixmystreet vagrant 127.0.0.1.xip.io
- # We want to be on port 3000 for development
- sed -i -r -e "s,^( *BASE_URL: .*)',\\1:3000'," fixmystreet/conf/general.yml
- # All done
- echo "****************"
- echo "You can now ssh into your vagrant box: vagrant ssh"
- echo "The website code is found in: ~/fixmystreet"
- echo "You can run the dev server with: script/fixmystreet_app_server.pl [-d] [-r] [--fork]"
+ SUCCESS=$?
+ # Even if it failed somehow, we might as well update the port if possible
+ if [ -e fixmystreet/conf/general.yml ]; then
+ # We want to be on port 3000 for development
+ sed -i -r -e "s,^( *BASE_URL: .*)',\\1:3000'," fixmystreet/conf/general.yml
+ fi
+ if [ $SUCCESS -eq 0 ]; then
+ # All done
+ echo "****************"
+ echo "You can now ssh into your vagrant box: vagrant ssh"
+ echo "The website code is found in: ~/fixmystreet"
+ echo "You can run the dev server with: script/fixmystreet_app_server.pl [-d] [-r] [--fork]"
+ else
+ echo "Unfortunately, something appears to have gone wrong with the installation."
+ echo "Please see above for any errors, and do ask on our mailing list for help."
+ exit 1
+ fi
EOS
# Create a private network, which allows host-only access to the machine
diff --git a/bin/install-as-user b/bin/install-as-user
index 502cf0e3e..2730fe404 100755
--- a/bin/install-as-user
+++ b/bin/install-as-user
@@ -30,14 +30,6 @@ DB_NAME="fixmystreet"
# Check that the arguments we've been passed are sensible:
-IP_ADDRESS_FOR_HOST="$(dig +short $HOST)"
-
-if [ x = x"$IP_ADDRESS_FOR_HOST" ]
-then
- error_msg "The hostname $HOST didn't resolve to an IP address"
- exit 1
-fi
-
if ! id "$UNIX_USER" 2> /dev/null > /dev/null
then
error_msg "The user '$UNIX_USER' didn't exist."
diff --git a/bin/site-specific-install.sh b/bin/site-specific-install.sh
index 71bfc11ff..251c70e81 100644
--- a/bin/site-specific-install.sh
+++ b/bin/site-specific-install.sh
@@ -61,9 +61,11 @@ then
overwrite_rc_local
fi
-# Tell the user what to do next:
+if [ ! "$DEVELOPMENT_INSTALL" = true ]; then
+ # Tell the user what to do next:
-echo Installation complete - you should now be able to view the site at:
-echo http://$HOST/
-echo Or you can run the tests by switching to the "'$UNIX_USER'" user and
-echo running: $REPOSITORY/bin/run-tests t
+ echo Installation complete - you should now be able to view the site at:
+ echo http://$HOST/
+ echo Or you can run the tests by switching to the "'$UNIX_USER'" user and
+ echo running: $REPOSITORY/bin/run-tests t
+fi