From 837fe1a4c9a44183de785b5a31b734febd43ccbe Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Sat, 2 Apr 2016 11:27:59 +0200 Subject: [PATCH 01/23] Added support for newer app versions --- README.md | 68 +++++++++++++++++++++--- Vagrantfile | 38 +++++++------ config/vagrant/build_dependency_setup.sh | 6 ++- config/vagrant/elixir_setup.sh | 20 +++++-- config/vagrant/git_setup.sh | 5 +- config/vagrant/nodejs_setup.sh | 3 +- config/vagrant/phoenix_setup.sh | 9 ++-- config/vagrant/postgresql_setup.sh | 13 ++--- 8 files changed, 120 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 29b7d8d..2684caa 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,68 @@ Based off project: https://github.com/jackdb/pg-app-dev-vm -* Ubuntu 14.04 LTS -* Elixir 1.0.5 -* Phoenix 1.0.0 -* PosgreSQL 9.4.4 -* NodeJS 0.12.7 -* Git 1.9.1 +* Ubuntu 15.10 +* Elixir 1.2.4 (latest version) +* Phoenix 1.1.4 (latest version) +* PosgreSQL 9.5 (latest version 9.5.x) +* NodeJS 5.x (latest version 5.x) +* Git 2.8.0 (latest version) This box is published in Atlas as 'lazygray/phoenix-postgres' and can be used simply by adding `config.vm.box = 'lazygray/phoenix-postgres'` to your `Vagrantfile`. + +## For Vagrant users on Windows +On Windows platforms with Vagrant version 1.8.0 and 1.8.1 there are issues +getting rsync to work. + +Perhaps a newer version of Vagrant might resolve this issue on Windows. +- https://github.com/mitchellh/vagrant/issues/6702 +- https://github.com/mitchellh/vagrant/issues/3230 + +If on Windows, and you are not able to get rsync to work, the following code +in the `Vagrantfile` can be commented out +``` +config.vm.synced_folder( + '.', + '/vagrant', + type: 'rsync', + rsync__exclude: [ + '.git/', + '.vagrant/', + 'log/*', + 'tmp/' + ] +) +``` + +and replaced with the code below. + +Use the following on Windows to 'resolve' the rsync issue above. +``` +config.vm.synced_folder "..", "/vagrant_data" +``` + +Your file structure on windows will then be as follows: + +``` +project +| +└─── vagrant-phoenix-postgres-master + │ .gitignore + │ README.mde + │ Vagrantfile + | + ├─── .vagrant + | | ... + ├─── config + | + ├─── vagrant + | build_dependency_setup.sh + | elixir_setup.sh + | git_setup.sh + | phoenix_setup.sh + | postgresql_setup.sh +``` + +The fixes in the issues above seem to relate the use of rsync in relation to +CygWin. I tried using cwRsync (https://www.itefix.net/cwrsync) on Windows, but was not able to get that rsync to work. diff --git a/Vagrantfile b/Vagrantfile index f855099..e721eff 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -17,19 +17,27 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provision 'shell', inline: $script # Every Vagrant virtual environment requires a box to build off of. - config.vm.box = 'ubuntu/trusty64' - - config.vm.synced_folder( - '.', - '/vagrant', - type: 'rsync', - rsync__exclude: [ - '.git/', - '.vagrant/', - 'log/*', - 'tmp/' - ] - ) + config.vm.box = 'ubuntu/wily64' + + # On Windows there are problems using rsync, which is why I commented out this + # original code. Here the github references for Vagrant 1.8.1 . + # Perhaps a newer version of Vagrant might resolve this issue on Windows. + # https://github.com/mitchellh/vagrant/issues/6702 + # https://github.com/mitchellh/vagrant/issues/3230 + # config.vm.synced_folder( + # '.', + # '/vagrant', + # type: 'rsync', + # rsync__exclude: [ + # '.git/', + # '.vagrant/', + # 'log/*', + # 'tmp/' + # ] + # ) + + # Use the following on Windows to 'resolve' the rsync issue above. + config.vm.synced_folder "..", "/vagrant_data" config.vm.provision :shell, path: 'config/vagrant/build_dependency_setup.sh' config.vm.provision :shell, path: 'config/vagrant/git_setup.sh' @@ -39,8 +47,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provision :shell, path: 'config/vagrant/phoenix_setup.sh', privileged: false # PostgreSQL Server port forwarding - config.vm.network :forwarded_port, host: 4000, guest: 4000 - config.vm.network :forwarded_port, host: 5432, guest: 5432 + config.vm.network :forwarded_port, host: 4004, guest: 4000 + config.vm.network :forwarded_port, host: 5434, guest: 5432 # Disable automatic box update checking. If you disable this, then # boxes will only be checked for updates when the user runs diff --git a/config/vagrant/build_dependency_setup.sh b/config/vagrant/build_dependency_setup.sh index 509776e..7204302 100644 --- a/config/vagrant/build_dependency_setup.sh +++ b/config/vagrant/build_dependency_setup.sh @@ -1,9 +1,11 @@ #!/usr/bin/env bash +echo "======================================================================" echo "=== Begin Vagrant Provisioning using 'config/vagrant/build_dependency_setup.sh'" # Install build dependencies for a sane build environment -apt-get -y update -apt-get -y install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev +sudo apt-get -y update +sudo apt-get -y install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev libgtk2.0-0 libgtk2.0-bin libgtk2.0-common +sudo apt-get -y install libwxbase2.8-0 libwxgtk2.8-0 echo "=== End Vagrant Provisioning using 'config/vagrant/build_dependency_setup.sh'" diff --git a/config/vagrant/elixir_setup.sh b/config/vagrant/elixir_setup.sh index d921896..4d862f7 100644 --- a/config/vagrant/elixir_setup.sh +++ b/config/vagrant/elixir_setup.sh @@ -1,17 +1,27 @@ #!/usr/bin/env bash +echo "======================================================================" echo "=== Begin Vagrant Provisioning using 'config/vagrant/elixir_setup.sh'" PHOENIX_VERSION=0.17.0 -# Install Git if not available +# Install elixir if not available +# Note: the URL of erlang will if [ -z `which elixir` ]; then echo "===== Installing Elixir" - wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && sudo dpkg -i erlang-solutions_1.0_all.deb - apt-get -y update - apt-get -y install elixir + # https://www.erlang-solutions.com/resources/download.html + # We have to use the more complex alternative erlang install as the + # standard install does not detect the Ubuntu codename correctly. + # Even if you have Ubuntu wily installed, the codename squeezy is + # prompted, and used for the insall, and the installation of erlang fails. + wget http://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc + sudo apt-key add erlang_solutions.asc + sudo add-apt-repository "deb http://packages.erlang-solutions.com/ubuntu $(lsb_release -s -c) contrib" + sudo apt-get update + yes Y | sudo apt-get install esl-erlang + sudo apt-get install elixir yes Y | mix local.hex - yes Y | mix archive.install "https://github.com/phoenixframework/phoenix/releases/download/v0.17.0/phoenix_new-$PHOENIX_VERSION.ez" + yes Y | mix archive.install "https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez" fi echo "=== End Vagrant Provisioning using 'config/vagrant/elixir_setup.sh'" diff --git a/config/vagrant/git_setup.sh b/config/vagrant/git_setup.sh index 54a8be9..9331889 100644 --- a/config/vagrant/git_setup.sh +++ b/config/vagrant/git_setup.sh @@ -1,12 +1,13 @@ #!/usr/bin/env bash +echo "======================================================================" echo "=== Begin Vagrant Provisioning using 'config/vagrant/git_setup.sh'" # Install Git if not available if [ -z `which git` ]; then echo "===== Installing Git" - apt-get -y update - apt-get -y install git-core + sudo apt-get -y update + sudo apt-get -y install git-core fi echo "=== End Vagrant Provisioning using 'config/vagrant/git_setup.sh'" diff --git a/config/vagrant/nodejs_setup.sh b/config/vagrant/nodejs_setup.sh index 884ddf6..d11a554 100644 --- a/config/vagrant/nodejs_setup.sh +++ b/config/vagrant/nodejs_setup.sh @@ -1,11 +1,12 @@ #!/usr/bin/env bash +echo "======================================================================" echo "=== Begin Vagrant Provisioning using 'config/vagrant/nodejs_setup.sh'" if [ -z `which nodejs` ]; then # Instructions from: # https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories - curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash - + curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash - sudo apt-get install -y nodejs fi diff --git a/config/vagrant/phoenix_setup.sh b/config/vagrant/phoenix_setup.sh index 6477a2f..b4c0a06 100644 --- a/config/vagrant/phoenix_setup.sh +++ b/config/vagrant/phoenix_setup.sh @@ -1,14 +1,13 @@ #!/usr/bin/env bash +echo "======================================================================" echo "=== Begin Vagrant Provisioning using 'config/vagrant/phoenix_setup.sh'" -PHOENIX_VERSION=1.0.0 +PHOENIX_VERSION=1.1.4 -# Install Git if not available -# if [ -z `which elixir` ]; then +# Install the latest version of Phoenix echo "===== Installing Phoenix" yes Y | mix local.hex - yes Y | mix archive.install "https://github.com/phoenixframework/phoenix/releases/download/v$PHOENIX_VERSION/phoenix_new-$PHOENIX_VERSION.ez" -# fi + yes Y | mix archive.install "https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez" echo "=== End Vagrant Provisioning using 'config/vagrant/phoenix_setup.sh'" diff --git a/config/vagrant/postgresql_setup.sh b/config/vagrant/postgresql_setup.sh index 472dea1..38371d1 100755 --- a/config/vagrant/postgresql_setup.sh +++ b/config/vagrant/postgresql_setup.sh @@ -1,5 +1,6 @@ #!/bin/sh -e +echo "======================================================================" echo "=== Begin Vagrant Provisioning using 'config/vagrant/postgresql_setup.sh'" # Edit the following to change the name of the database user that will be created: @@ -10,7 +11,7 @@ APP_DB_PASS=$APP_DB_USER # APP_DB_NAME=${APP_DB_USER}_unused # Edit the following to change the version of PostgreSQL that is installed -PG_VERSION=9.4 +PG_VERSION=9.5 ########################################################### # Changes below this line are probably not necessary @@ -55,18 +56,18 @@ PG_REPO_APT_SOURCE=/etc/apt/sources.list.d/pgdg.list if [ ! -f "$PG_REPO_APT_SOURCE" ] then # Add PG apt repo: - echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > "$PG_REPO_APT_SOURCE" + echo "deb http://apt.postgresql.org/pub/repos/apt/ wily-pgdg main" > "$PG_REPO_APT_SOURCE" # Add PGDG repo key: wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add - fi # Update package list and upgrade all packages -apt-get update -apt-get -y upgrade +sudo apt-get update +sudo apt-get -y upgrade -apt-get -y install "postgresql-$PG_VERSION" "postgresql-contrib-$PG_VERSION" -apt-get -y install libpq-dev # For building ruby 'pg' gem +sudo apt-get -y install "postgresql-$PG_VERSION" "postgresql-contrib-$PG_VERSION" +sudo apt-get -y install libpq-dev # For building ruby 'pg' gem PG_CONF="/etc/postgresql/$PG_VERSION/main/postgresql.conf" PG_HBA="/etc/postgresql/$PG_VERSION/main/pg_hba.conf" From 24abdc109bf3409d7bb7a3277cb89b55135e3df6 Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Sat, 2 Apr 2016 18:46:31 +0200 Subject: [PATCH 02/23] Clean up Remove unnecessary references. The latest version is always installed. --- config/vagrant/elixir_setup.sh | 2 -- config/vagrant/phoenix_setup.sh | 2 -- 2 files changed, 4 deletions(-) diff --git a/config/vagrant/elixir_setup.sh b/config/vagrant/elixir_setup.sh index 4d862f7..5bbff88 100644 --- a/config/vagrant/elixir_setup.sh +++ b/config/vagrant/elixir_setup.sh @@ -3,8 +3,6 @@ echo "======================================================================" echo "=== Begin Vagrant Provisioning using 'config/vagrant/elixir_setup.sh'" -PHOENIX_VERSION=0.17.0 - # Install elixir if not available # Note: the URL of erlang will if [ -z `which elixir` ]; then diff --git a/config/vagrant/phoenix_setup.sh b/config/vagrant/phoenix_setup.sh index b4c0a06..b813fbc 100644 --- a/config/vagrant/phoenix_setup.sh +++ b/config/vagrant/phoenix_setup.sh @@ -3,8 +3,6 @@ echo "======================================================================" echo "=== Begin Vagrant Provisioning using 'config/vagrant/phoenix_setup.sh'" -PHOENIX_VERSION=1.1.4 - # Install the latest version of Phoenix echo "===== Installing Phoenix" yes Y | mix local.hex From d3556f997ed0d40949eccfbe61f64da527b57be9 Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Sat, 2 Apr 2016 18:46:51 +0200 Subject: [PATCH 03/23] View the version numbers of the installed software --- Vagrantfile | 1 + config/vagrant/check_versions.sh | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 config/vagrant/check_versions.sh diff --git a/Vagrantfile b/Vagrantfile index e721eff..acc8417 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -45,6 +45,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provision :shell, path: 'config/vagrant/postgresql_setup.sh' config.vm.provision :shell, path: 'config/vagrant/elixir_setup.sh' config.vm.provision :shell, path: 'config/vagrant/phoenix_setup.sh', privileged: false + config.vm.provision :shell, path: 'config/vagrant/check_versions.sh' # PostgreSQL Server port forwarding config.vm.network :forwarded_port, host: 4004, guest: 4000 diff --git a/config/vagrant/check_versions.sh b/config/vagrant/check_versions.sh new file mode 100644 index 0000000..3d323e6 --- /dev/null +++ b/config/vagrant/check_versions.sh @@ -0,0 +1,15 @@ +echo "======================================================================" +echo "=== Begin Vagrant Provisioning using 'config/vagrant/check_version.sh'" + +echo "git --version" +git --version +echo "node --version" +node --version +echo "psql --version" +psql --version +echo "cat /usr/lib/erlang/releases/RELEASES" +cat /usr/lib/erlang/releases/RELEASES +echo "elixir --version" +elixir --version + +echo "=== End Vagrant Provisioning using 'config/vagrant/check_version.sh'" From d710d2a436811482db1ae7b770b430f57db03290 Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Sat, 2 Apr 2016 18:49:57 +0200 Subject: [PATCH 04/23] Ports of the host back to default --- Vagrantfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index acc8417..9ad8f57 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -48,8 +48,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provision :shell, path: 'config/vagrant/check_versions.sh' # PostgreSQL Server port forwarding - config.vm.network :forwarded_port, host: 4004, guest: 4000 - config.vm.network :forwarded_port, host: 5434, guest: 5432 + config.vm.network :forwarded_port, host: 4000, guest: 4000 + config.vm.network :forwarded_port, host: 5432, guest: 5432 # Disable automatic box update checking. If you disable this, then # boxes will only be checked for updates when the user runs From 742863b5dde77c1fb59ec34de15a8aa7b65827b0 Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Mon, 11 Apr 2016 16:44:58 +0200 Subject: [PATCH 05/23] Cosmetic Make the sections between blocks more easy to identify --- config/vagrant/check_versions.sh | 9 +++++++++ config/vagrant/git_setup.sh | 2 ++ config/vagrant/nodejs_setup.sh | 2 ++ config/vagrant/phoenix_setup.sh | 2 ++ config/vagrant/postgresql_setup.sh | 2 ++ 5 files changed, 17 insertions(+) diff --git a/config/vagrant/check_versions.sh b/config/vagrant/check_versions.sh index 3d323e6..c4cbf1b 100644 --- a/config/vagrant/check_versions.sh +++ b/config/vagrant/check_versions.sh @@ -1,15 +1,24 @@ +#!/usr/bin/env bash + +echo "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" +echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" echo "======================================================================" echo "=== Begin Vagrant Provisioning using 'config/vagrant/check_version.sh'" echo "git --version" git --version +echo "" echo "node --version" node --version +echo "" echo "psql --version" psql --version +echo "" echo "cat /usr/lib/erlang/releases/RELEASES" cat /usr/lib/erlang/releases/RELEASES +echo "" echo "elixir --version" elixir --version +echo "" echo "=== End Vagrant Provisioning using 'config/vagrant/check_version.sh'" diff --git a/config/vagrant/git_setup.sh b/config/vagrant/git_setup.sh index 9331889..400be19 100644 --- a/config/vagrant/git_setup.sh +++ b/config/vagrant/git_setup.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +echo "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" +echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" echo "======================================================================" echo "=== Begin Vagrant Provisioning using 'config/vagrant/git_setup.sh'" diff --git a/config/vagrant/nodejs_setup.sh b/config/vagrant/nodejs_setup.sh index d11a554..86b9861 100644 --- a/config/vagrant/nodejs_setup.sh +++ b/config/vagrant/nodejs_setup.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +echo "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" +echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" echo "======================================================================" echo "=== Begin Vagrant Provisioning using 'config/vagrant/nodejs_setup.sh'" diff --git a/config/vagrant/phoenix_setup.sh b/config/vagrant/phoenix_setup.sh index b813fbc..63f4957 100644 --- a/config/vagrant/phoenix_setup.sh +++ b/config/vagrant/phoenix_setup.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +echo "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" +echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" echo "======================================================================" echo "=== Begin Vagrant Provisioning using 'config/vagrant/phoenix_setup.sh'" diff --git a/config/vagrant/postgresql_setup.sh b/config/vagrant/postgresql_setup.sh index 38371d1..a82bef7 100755 --- a/config/vagrant/postgresql_setup.sh +++ b/config/vagrant/postgresql_setup.sh @@ -1,5 +1,7 @@ #!/bin/sh -e +echo "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" +echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" echo "======================================================================" echo "=== Begin Vagrant Provisioning using 'config/vagrant/postgresql_setup.sh'" From a7091c5fe41a52f7abd2dc139bf5ca0291ae6031 Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Mon, 11 Apr 2016 16:46:11 +0200 Subject: [PATCH 06/23] Remove the ubuntu installation log from git --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 8000dd9..da8b73f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .vagrant +ubuntu*.log From 1e2815065bf2cc1991c874d8588ccb829f0c1e6c Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Mon, 11 Apr 2016 16:46:47 +0200 Subject: [PATCH 07/23] No erlang dist version available specifically for xenial Hard code wily --- config/vagrant/elixir_setup.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/vagrant/elixir_setup.sh b/config/vagrant/elixir_setup.sh index 5bbff88..543765c 100644 --- a/config/vagrant/elixir_setup.sh +++ b/config/vagrant/elixir_setup.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +echo "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" +echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" echo "======================================================================" echo "=== Begin Vagrant Provisioning using 'config/vagrant/elixir_setup.sh'" @@ -14,7 +16,9 @@ if [ -z `which elixir` ]; then # prompted, and used for the insall, and the installation of erlang fails. wget http://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc sudo apt-key add erlang_solutions.asc - sudo add-apt-repository "deb http://packages.erlang-solutions.com/ubuntu $(lsb_release -s -c) contrib" + # There is as of now no erlang download for xenial, so we have to hard code wily. + sudo add-apt-repository "deb http://packages.erlang-solutions.com/ubuntu wily contrib" + # sudo add-apt-repository "deb http://packages.erlang-solutions.com/ubuntu $(lsb_release -s -c) contrib" sudo apt-get update yes Y | sudo apt-get install esl-erlang sudo apt-get install elixir From eb6a4769edcbfc5785a66ba0c4cdb37495cf3e02 Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Mon, 11 Apr 2016 16:47:54 +0200 Subject: [PATCH 08/23] Updated the scripts to support Ubuntu 16.04 Workaround bug for missing hosts entry Workaround missing dependencies when installing esl-erlang --- Vagrantfile | 2 +- config/vagrant/build_dependency_setup.sh | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 9ad8f57..281cba4 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -17,7 +17,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provision 'shell', inline: $script # Every Vagrant virtual environment requires a box to build off of. - config.vm.box = 'ubuntu/wily64' + config.vm.box = 'ubuntu/xenial64' # On Windows there are problems using rsync, which is why I commented out this # original code. Here the github references for Vagrant 1.8.1 . diff --git a/config/vagrant/build_dependency_setup.sh b/config/vagrant/build_dependency_setup.sh index 7204302..f02b225 100644 --- a/config/vagrant/build_dependency_setup.sh +++ b/config/vagrant/build_dependency_setup.sh @@ -1,11 +1,30 @@ #!/usr/bin/env bash +echo "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" +echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" echo "======================================================================" echo "=== Begin Vagrant Provisioning using 'config/vagrant/build_dependency_setup.sh'" +# https://bugs.launchpad.net/ubuntu/+bug/1561250 +if [ $(cat /etc/hosts | grep -co 'ubuntu-xenial') = 0 ]; then + echo 127.0.1.1 ubuntu-xenial >> /etc/hosts +fi + # Install build dependencies for a sane build environment sudo apt-get -y update sudo apt-get -y install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev libgtk2.0-0 libgtk2.0-bin libgtk2.0-common -sudo apt-get -y install libwxbase2.8-0 libwxgtk2.8-0 + +# Problem installing esl-erlang. +# Standard installation methods for libwxbase fail. +# http://packages.ubuntu.com/search?suite=default§ion=all&arch=any&keywords=libwxbase&searchon=names +# Even after the explicit installation of libwxbase3.0-0v5 the dependencies are not resolved, so +# this forces us to manually install libwxbase3 and libwxgtk3. +wget http://archive.ubuntu.com/ubuntu/pool/universe/w/wxwidgets3.0/libwxbase3.0-0_3.0.2-1_amd64.deb +yes Y | sudo dpkg -i libwxbase3.0-0_3.0.2-1*.deb +yes Y | sudo apt-get -f install + +wget http://archive.ubuntu.com/ubuntu/pool/universe/w/wxwidgets3.0/libwxgtk3.0-0_3.0.2-1_amd64.deb +yes Y | sudo dpkg -i libwxgtk3.0-0_3.0.2-1*.deb +yes Y | sudo apt-get -f install echo "=== End Vagrant Provisioning using 'config/vagrant/build_dependency_setup.sh'" From b6ef24d59012c636f2afd72d7493d7ae760833a2 Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Mon, 11 Apr 2016 21:06:52 +0200 Subject: [PATCH 09/23] Phoenix was not being installed correctly --- config/vagrant/phoenix_setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/vagrant/phoenix_setup.sh b/config/vagrant/phoenix_setup.sh index 63f4957..308eadd 100644 --- a/config/vagrant/phoenix_setup.sh +++ b/config/vagrant/phoenix_setup.sh @@ -7,7 +7,7 @@ echo "=== Begin Vagrant Provisioning using 'config/vagrant/phoenix_setup.sh'" # Install the latest version of Phoenix echo "===== Installing Phoenix" - yes Y | mix local.hex - yes Y | mix archive.install "https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez" + mix local.hex --force + mix archive.install "https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez" --force echo "=== End Vagrant Provisioning using 'config/vagrant/phoenix_setup.sh'" From 9a8304b8e9d618f90a12db835832ab9b20a3b52a Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Mon, 11 Apr 2016 21:07:08 +0200 Subject: [PATCH 10/23] Removed duplicate Phoenix install --- config/vagrant/elixir_setup.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/vagrant/elixir_setup.sh b/config/vagrant/elixir_setup.sh index 543765c..6cc5910 100644 --- a/config/vagrant/elixir_setup.sh +++ b/config/vagrant/elixir_setup.sh @@ -22,8 +22,6 @@ if [ -z `which elixir` ]; then sudo apt-get update yes Y | sudo apt-get install esl-erlang sudo apt-get install elixir - yes Y | mix local.hex - yes Y | mix archive.install "https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez" fi echo "=== End Vagrant Provisioning using 'config/vagrant/elixir_setup.sh'" From 110d927298764a0e48ce23cb2779f99241aae920 Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Mon, 11 Apr 2016 21:07:41 +0200 Subject: [PATCH 11/23] Added test for Phoenix install Added empty lines between tests to make the result a little easier to read --- config/vagrant/check_versions.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/vagrant/check_versions.sh b/config/vagrant/check_versions.sh index c4cbf1b..ba6e537 100644 --- a/config/vagrant/check_versions.sh +++ b/config/vagrant/check_versions.sh @@ -11,14 +11,19 @@ echo "" echo "node --version" node --version echo "" +echo "" echo "psql --version" psql --version echo "" echo "cat /usr/lib/erlang/releases/RELEASES" cat /usr/lib/erlang/releases/RELEASES echo "" +echo "" echo "elixir --version" elixir --version echo "" +echo "mix help phoenix.new" +mix help phoenix.new +echo "" echo "=== End Vagrant Provisioning using 'config/vagrant/check_version.sh'" From 503c3cbddf4fa66f5dbd98a45b93d9f4a472bdac Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Mon, 11 Apr 2016 21:10:37 +0200 Subject: [PATCH 12/23] Getting the folder sharing is a hassle for testing Moved the folder sharing to the end of the process, as the /etc/hosts fix needs to have run before the folder sharing is activated. Activating the folder sharing by default requires a more complex setup, and makes testing a problem, so I have deactivated the folder sharing. Added the option to specify the memory size and number of CPUs for the VirtualBox. Newer versions of Ubuntu work better with more RAM taking into account the software installed in the VirtualBox. --- Vagrantfile | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 281cba4..317e47b 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -9,16 +9,32 @@ SCRIPT # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = '2' +MEMORY_SIZE_MB = 1024 +NUMBER_OF_CPUS = 2 + Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # All Vagrant configuration is done here. The most common configuration # options are documented and commented below. For a complete reference, # please see the online documentation at vagrantup.com. + + config.vm.provider "virtualbox" do |v| + v.memory = MEMORY_SIZE_MB + v.cpus = NUMBER_OF_CPUS + end config.vm.provision 'shell', inline: $script # Every Vagrant virtual environment requires a box to build off of. config.vm.box = 'ubuntu/xenial64' + config.vm.provision :shell, path: 'config/vagrant/build_dependency_setup.sh' + config.vm.provision :shell, path: 'config/vagrant/git_setup.sh' + config.vm.provision :shell, path: 'config/vagrant/nodejs_setup.sh' + config.vm.provision :shell, path: 'config/vagrant/postgresql_setup.sh' + config.vm.provision :shell, path: 'config/vagrant/elixir_setup.sh' + config.vm.provision :shell, path: 'config/vagrant/phoenix_setup.sh', privileged: false + config.vm.provision :shell, path: 'config/vagrant/check_versions.sh' + # On Windows there are problems using rsync, which is why I commented out this # original code. Here the github references for Vagrant 1.8.1 . # Perhaps a newer version of Vagrant might resolve this issue on Windows. @@ -37,15 +53,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # ) # Use the following on Windows to 'resolve' the rsync issue above. - config.vm.synced_folder "..", "/vagrant_data" - - config.vm.provision :shell, path: 'config/vagrant/build_dependency_setup.sh' - config.vm.provision :shell, path: 'config/vagrant/git_setup.sh' - config.vm.provision :shell, path: 'config/vagrant/nodejs_setup.sh' - config.vm.provision :shell, path: 'config/vagrant/postgresql_setup.sh' - config.vm.provision :shell, path: 'config/vagrant/elixir_setup.sh' - config.vm.provision :shell, path: 'config/vagrant/phoenix_setup.sh', privileged: false - config.vm.provision :shell, path: 'config/vagrant/check_versions.sh' + # config.vm.synced_folder ".", "/vagrant" # PostgreSQL Server port forwarding config.vm.network :forwarded_port, host: 4000, guest: 4000 From 5060bd1d378ace1dc7c9b2be5eb0751fed67b0f4 Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Mon, 11 Apr 2016 21:36:04 +0200 Subject: [PATCH 13/23] Can't test Phoenix in priveleged mode Phoenix is installed as a normal user, so testing if it is installed also has to occur as a normal user --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 317e47b..c445285 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -33,7 +33,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provision :shell, path: 'config/vagrant/postgresql_setup.sh' config.vm.provision :shell, path: 'config/vagrant/elixir_setup.sh' config.vm.provision :shell, path: 'config/vagrant/phoenix_setup.sh', privileged: false - config.vm.provision :shell, path: 'config/vagrant/check_versions.sh' + config.vm.provision :shell, path: 'config/vagrant/check_versions.sh', privileged: false # On Windows there are problems using rsync, which is why I commented out this # original code. Here the github references for Vagrant 1.8.1 . From 7948a87153eb4439e4f43bd29bb8aba091d0f6b4 Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Mon, 11 Apr 2016 21:37:07 +0200 Subject: [PATCH 14/23] Better code to test if mix installed and which version --- config/vagrant/check_versions.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config/vagrant/check_versions.sh b/config/vagrant/check_versions.sh index ba6e537..175b13f 100644 --- a/config/vagrant/check_versions.sh +++ b/config/vagrant/check_versions.sh @@ -17,13 +17,14 @@ psql --version echo "" echo "cat /usr/lib/erlang/releases/RELEASES" cat /usr/lib/erlang/releases/RELEASES -echo "" -echo "" +echo " " +echo " " echo "elixir --version" elixir --version echo "" echo "mix help phoenix.new" -mix help phoenix.new +mix help phoenix.new | sed -e 3b -e '$!d' +strings ~/.mix/archives/phoenix_new.ez | grep '{vsn,' echo "" echo "=== End Vagrant Provisioning using 'config/vagrant/check_version.sh'" From c3896bdeb536af7746dd3944c5ab0e8eb8b91292 Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Mon, 11 Apr 2016 21:44:13 +0200 Subject: [PATCH 15/23] Clean up the display of the version display --- config/vagrant/check_versions.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/config/vagrant/check_versions.sh b/config/vagrant/check_versions.sh index 175b13f..936334f 100644 --- a/config/vagrant/check_versions.sh +++ b/config/vagrant/check_versions.sh @@ -5,26 +5,32 @@ echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" echo "======================================================================" echo "=== Begin Vagrant Provisioning using 'config/vagrant/check_version.sh'" +echo " " +echo " " echo "git --version" git --version -echo "" +echo " " +echo " " echo "node --version" node --version -echo "" -echo "" +echo " " +echo " " echo "psql --version" psql --version -echo "" +echo " " +echo " " echo "cat /usr/lib/erlang/releases/RELEASES" cat /usr/lib/erlang/releases/RELEASES echo " " echo " " echo "elixir --version" elixir --version -echo "" +echo " " +echo " " echo "mix help phoenix.new" mix help phoenix.new | sed -e 3b -e '$!d' strings ~/.mix/archives/phoenix_new.ez | grep '{vsn,' -echo "" +echo " " +echo " " echo "=== End Vagrant Provisioning using 'config/vagrant/check_version.sh'" From c18907e4137f73a0195df9cfbe5f5980d2b626f5 Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Tue, 12 Apr 2016 09:54:16 +0200 Subject: [PATCH 16/23] Moved installation of hex and rebar into the Elixir script For most Phoenix projects, or Elixir projects in general at least hex needs to be installed. And more often than not a project relies on Erlang packages that need rebar, so it might as well be installed proactively. --- config/vagrant/elixir_setup.sh | 2 ++ config/vagrant/phoenix_setup.sh | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/vagrant/elixir_setup.sh b/config/vagrant/elixir_setup.sh index 6cc5910..bb6ea34 100644 --- a/config/vagrant/elixir_setup.sh +++ b/config/vagrant/elixir_setup.sh @@ -22,6 +22,8 @@ if [ -z `which elixir` ]; then sudo apt-get update yes Y | sudo apt-get install esl-erlang sudo apt-get install elixir + mix local.hex --force + mix local.rebar --force fi echo "=== End Vagrant Provisioning using 'config/vagrant/elixir_setup.sh'" diff --git a/config/vagrant/phoenix_setup.sh b/config/vagrant/phoenix_setup.sh index 308eadd..f1f1e2d 100644 --- a/config/vagrant/phoenix_setup.sh +++ b/config/vagrant/phoenix_setup.sh @@ -7,7 +7,6 @@ echo "=== Begin Vagrant Provisioning using 'config/vagrant/phoenix_setup.sh'" # Install the latest version of Phoenix echo "===== Installing Phoenix" - mix local.hex --force mix archive.install "https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez" --force echo "=== End Vagrant Provisioning using 'config/vagrant/phoenix_setup.sh'" From 32016b309d4ffd37239360977392d25bf7e5b318 Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Tue, 12 Apr 2016 09:55:52 +0200 Subject: [PATCH 17/23] Added template files for additional installation steps One file for priveleged access, one for user access. Instead of users trying to append data to existing files the install steps could be placed here. --- Vagrantfile | 2 ++ config/vagrant/post_install_priveleged.sh | 13 +++++++++++++ config/vagrant/post_install_user.sh | 12 ++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 config/vagrant/post_install_priveleged.sh create mode 100644 config/vagrant/post_install_user.sh diff --git a/Vagrantfile b/Vagrantfile index c445285..6d8992d 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -33,6 +33,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provision :shell, path: 'config/vagrant/postgresql_setup.sh' config.vm.provision :shell, path: 'config/vagrant/elixir_setup.sh' config.vm.provision :shell, path: 'config/vagrant/phoenix_setup.sh', privileged: false + config.vm.provision :shell, path: 'config/vagrant/post_install_priveleged.sh' + config.vm.provision :shell, path: 'config/vagrant/post_install_user.sh', privileged: false config.vm.provision :shell, path: 'config/vagrant/check_versions.sh', privileged: false # On Windows there are problems using rsync, which is why I commented out this diff --git a/config/vagrant/post_install_priveleged.sh b/config/vagrant/post_install_priveleged.sh new file mode 100644 index 0000000..7a82853 --- /dev/null +++ b/config/vagrant/post_install_priveleged.sh @@ -0,0 +1,13 @@ + +echo "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" +echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" +echo "======================================================================" +echo "=== Begin Vagrant Provisioning using 'config/vagrant/post_install.sh'" + +# Here I can place post install commands to install stuff which I need for +# my project. This file is specifically for code that must be +# executed as the super-user. + +npm install -g elm + +echo "=== End Vagrant Provisioning using 'config/vagrant/post_install.sh'" diff --git a/config/vagrant/post_install_user.sh b/config/vagrant/post_install_user.sh new file mode 100644 index 0000000..ac0718c --- /dev/null +++ b/config/vagrant/post_install_user.sh @@ -0,0 +1,12 @@ + +echo "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" +echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" +echo "======================================================================" +echo "=== Begin Vagrant Provisioning using 'config/vagrant/post_install_priveleged.sh'" + +# Here I can place post install commands to install stuff which I need for +# my project. + +npm install -g elm + +echo "=== End Vagrant Provisioning using 'config/vagrant/post_install_priveleged.sh'" From 3d9f0b03ca58cd3e7c25376809a97cbd449d5d7e Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Tue, 12 Apr 2016 10:10:44 +0200 Subject: [PATCH 18/23] Corrected file names in echo scripts Also removed the duplicate install command for elm from the user script. npm install needs to be prefixed prefixed by sudo. --- config/vagrant/post_install_priveleged.sh | 8 ++++---- config/vagrant/post_install_user.sh | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/config/vagrant/post_install_priveleged.sh b/config/vagrant/post_install_priveleged.sh index 7a82853..b6d70de 100644 --- a/config/vagrant/post_install_priveleged.sh +++ b/config/vagrant/post_install_priveleged.sh @@ -2,12 +2,12 @@ echo "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" echo "======================================================================" -echo "=== Begin Vagrant Provisioning using 'config/vagrant/post_install.sh'" +echo "=== Begin Vagrant Provisioning using 'config/vagrant/post_install_priveleged.sh'" # Here I can place post install commands to install stuff which I need for -# my project. This file is specifically for code that must be +# my project. This file is specifically for code that must be # executed as the super-user. -npm install -g elm +sudo npm install -g elm -echo "=== End Vagrant Provisioning using 'config/vagrant/post_install.sh'" +echo "=== End Vagrant Provisioning using 'config/vagrant/post_install_priveleged.sh'" diff --git a/config/vagrant/post_install_user.sh b/config/vagrant/post_install_user.sh index ac0718c..e956c81 100644 --- a/config/vagrant/post_install_user.sh +++ b/config/vagrant/post_install_user.sh @@ -2,11 +2,10 @@ echo "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" echo "======================================================================" -echo "=== Begin Vagrant Provisioning using 'config/vagrant/post_install_priveleged.sh'" +echo "=== Begin Vagrant Provisioning using 'config/vagrant/post_install_user.sh'" # Here I can place post install commands to install stuff which I need for # my project. -npm install -g elm -echo "=== End Vagrant Provisioning using 'config/vagrant/post_install_priveleged.sh'" +echo "=== End Vagrant Provisioning using 'config/vagrant/post_install_user.sh'" From 0242fca0679dab5a8d6d31491f95f1e6dcd2bd43 Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Tue, 12 Apr 2016 10:33:20 +0200 Subject: [PATCH 19/23] mix needs to be executed in the context of the user Need to revert these changes. mix needs to be executed in the context of the user, and phoenix is installed in the context of the user "priveleged=false". --- config/vagrant/elixir_setup.sh | 2 -- config/vagrant/phoenix_setup.sh | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/vagrant/elixir_setup.sh b/config/vagrant/elixir_setup.sh index bb6ea34..6cc5910 100644 --- a/config/vagrant/elixir_setup.sh +++ b/config/vagrant/elixir_setup.sh @@ -22,8 +22,6 @@ if [ -z `which elixir` ]; then sudo apt-get update yes Y | sudo apt-get install esl-erlang sudo apt-get install elixir - mix local.hex --force - mix local.rebar --force fi echo "=== End Vagrant Provisioning using 'config/vagrant/elixir_setup.sh'" diff --git a/config/vagrant/phoenix_setup.sh b/config/vagrant/phoenix_setup.sh index f1f1e2d..5d1575e 100644 --- a/config/vagrant/phoenix_setup.sh +++ b/config/vagrant/phoenix_setup.sh @@ -7,6 +7,8 @@ echo "=== Begin Vagrant Provisioning using 'config/vagrant/phoenix_setup.sh'" # Install the latest version of Phoenix echo "===== Installing Phoenix" + mix local.hex --force + mix local.rebar --force mix archive.install "https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez" --force echo "=== End Vagrant Provisioning using 'config/vagrant/phoenix_setup.sh'" From 4d2c3efd64f2d599dd50acc734de5ed888ce1bb9 Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Tue, 12 Apr 2016 13:09:07 +0200 Subject: [PATCH 20/23] Improved the test for phoenix installation Cosmetic change to delimit tests and make clear which software is being tested. --- config/vagrant/check_versions.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/config/vagrant/check_versions.sh b/config/vagrant/check_versions.sh index 936334f..d497693 100644 --- a/config/vagrant/check_versions.sh +++ b/config/vagrant/check_versions.sh @@ -7,29 +7,45 @@ echo "=== Begin Vagrant Provisioning using 'config/vagrant/check_version.sh'" echo " " echo " " +echo "--- git" +echo "--------------------" echo "git --version" git --version echo " " echo " " +echo "--- node" +echo "--------------------" echo "node --version" node --version echo " " echo " " +echo "--- postgres" +echo "--------------------" echo "psql --version" psql --version echo " " echo " " +echo "--- erlang" +echo "--------------------" echo "cat /usr/lib/erlang/releases/RELEASES" cat /usr/lib/erlang/releases/RELEASES echo " " echo " " +echo "--- elixir" +echo "--------------------" echo "elixir --version" elixir --version echo " " echo " " +echo "--- phoenix" +echo "--------------------" echo "mix help phoenix.new" -mix help phoenix.new | sed -e 3b -e '$!d' -strings ~/.mix/archives/phoenix_new.ez | grep '{vsn,' +if [ $(strings ~/.mix/archives/phoenix_new.ez | grep -co '{vsn,') = 0 ]; then + echo "Error: unable to find installed phoenix" +else + mix help phoenix.new | sed -e 3b -e '$!d' + strings ~/.mix/archives/phoenix_new.ez | grep '{vsn,' +fi echo " " echo " " From 857f506fd14367a4b4f3c99ba3220af401cd1f27 Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Tue, 12 Apr 2016 13:13:35 +0200 Subject: [PATCH 21/23] Added a vbox name and linked_clone If more than one vagrant is started, it makes sense to link the clone so that there is no need to always download and install the base image. If more than one vagrant is installed , then the name ought to be different. If a name is not specified, then the name is that of the image, so if one has more than one vagrant setup that uses the same base image, without a name only one image could be installed. --- Vagrantfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 6d8992d..e7c39b1 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -11,15 +11,19 @@ VAGRANTFILE_API_VERSION = '2' MEMORY_SIZE_MB = 1024 NUMBER_OF_CPUS = 2 +VM_NAME = "vagrant-phoenix-postgres" +VM_LINKED = true Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # All Vagrant configuration is done here. The most common configuration # options are documented and commented below. For a complete reference, # please see the online documentation at vagrantup.com. - + config.vm.provider "virtualbox" do |v| v.memory = MEMORY_SIZE_MB v.cpus = NUMBER_OF_CPUS + v.name = VM_NAME + v.linked_clone = VM_LINKED end config.vm.provision 'shell', inline: $script @@ -36,7 +40,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provision :shell, path: 'config/vagrant/post_install_priveleged.sh' config.vm.provision :shell, path: 'config/vagrant/post_install_user.sh', privileged: false config.vm.provision :shell, path: 'config/vagrant/check_versions.sh', privileged: false - + # On Windows there are problems using rsync, which is why I commented out this # original code. Here the github references for Vagrant 1.8.1 . # Perhaps a newer version of Vagrant might resolve this issue on Windows. From 22ab3a593e8dad7d310e7d3261178d8dac458168 Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Tue, 12 Apr 2016 17:10:37 +0200 Subject: [PATCH 22/23] hosts was not being updated due to permissions issue --- config/vagrant/build_dependency_setup.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/vagrant/build_dependency_setup.sh b/config/vagrant/build_dependency_setup.sh index f02b225..ac738c8 100644 --- a/config/vagrant/build_dependency_setup.sh +++ b/config/vagrant/build_dependency_setup.sh @@ -7,7 +7,10 @@ echo "=== Begin Vagrant Provisioning using 'config/vagrant/build_dependency_setu # https://bugs.launchpad.net/ubuntu/+bug/1561250 if [ $(cat /etc/hosts | grep -co 'ubuntu-xenial') = 0 ]; then - echo 127.0.1.1 ubuntu-xenial >> /etc/hosts + echo "sudo sh -c ""echo '127.0.1.1 ubuntu-xenial' >> /etc/hosts""" + sudo sh -c "echo '127.0.1.1 ubuntu-xenial' >> /etc/hosts" +else + echo "Found entry 'ubuntu-xenial' in the /etc/hosts" fi # Install build dependencies for a sane build environment From 15f40f875f85d678c4a99f233ca1a90863e599bd Mon Sep 17 00:00:00 2001 From: Rudolf Bargholz Date: Thu, 14 Apr 2016 12:35:03 +0200 Subject: [PATCH 23/23] Xenial repo for postgres now available --- config/vagrant/postgresql_setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/vagrant/postgresql_setup.sh b/config/vagrant/postgresql_setup.sh index a82bef7..5ebaa96 100755 --- a/config/vagrant/postgresql_setup.sh +++ b/config/vagrant/postgresql_setup.sh @@ -58,10 +58,10 @@ PG_REPO_APT_SOURCE=/etc/apt/sources.list.d/pgdg.list if [ ! -f "$PG_REPO_APT_SOURCE" ] then # Add PG apt repo: - echo "deb http://apt.postgresql.org/pub/repos/apt/ wily-pgdg main" > "$PG_REPO_APT_SOURCE" + echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" > "$PG_REPO_APT_SOURCE" # Add PGDG repo key: - wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add - + wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add - fi # Update package list and upgrade all packages