From 15496ed2d28775798c1552a042849b3d8ce9f7eb Mon Sep 17 00:00:00 2001 From: Nicolas Iooss Date: Mon, 23 Jan 2017 23:14:07 +0100 Subject: [PATCH 1/4] Use double quote to fill /etc/apt/sources.list.d/nodesource.list The script was writing "${DISTRO}" as-is in /etc/apt/sources.list.d/nodesource.list, which prevented the system from installing node. --- vagrant_bootstrap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vagrant_bootstrap.sh b/vagrant_bootstrap.sh index fe45d12..13a44db 100644 --- a/vagrant_bootstrap.sh +++ b/vagrant_bootstrap.sh @@ -57,8 +57,8 @@ echo "${LINE_BREAK}" curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add - DISTRO="vivid" -echo 'deb https://deb.nodesource.com/node_5.x ${DISTRO} main' > /etc/apt/sources.list.d/nodesource.list -echo 'deb-src https://deb.nodesource.com/node_5.x ${DISTRO} main' >> /etc/apt/sources.list.d/nodesource.list +echo "deb https://deb.nodesource.com/node_5.x ${DISTRO} main" > /etc/apt/sources.list.d/nodesource.list +echo "deb-src https://deb.nodesource.com/node_5.x ${DISTRO} main" >> /etc/apt/sources.list.d/nodesource.list apt-get install -yqq nodejs npm cd /vagrant/frontend From a19bb3632715610f716c404b34e080bc145b2585 Mon Sep 17 00:00:00 2001 From: Nicolas Iooss Date: Mon, 23 Jan 2017 23:24:53 +0100 Subject: [PATCH 2/4] Fix Django installation The installation failed when installing Django 1.9 because six was not automatically upgraded: django-rest-swagger==0.3.6 : pkg_resources.VersionConflict: (six 1.5.2 (/usr/lib/python3/dist-packages), Requirement.parse('six>=1.10.0')) Fix this by upgrading six by hand. Moreover Django wants debug_toolbar.middleware.DebugToolbarMiddleware into its MIDDLEWARE apps, as https://github.com/ProjetSigma/backend/commit/37fc065bd390d34e2098320287c89fe582922d66 did in some branch of the backend. Otherwise Django was complaining: ==> default: + python3 manage.py migrate ==> default: SystemCheckError: System check identified some issues: ==> default: ==> default: ERRORS: ==> default: ?: debug_toolbar.middleware.DebugToolbarMiddleware is missing from MIDDLEWARE_CLASSES. ==> default: HINT: Add debug_toolbar.middleware.DebugToolbarMiddleware to MIDDLEWARE_CLASSES. --- vagrant_bootstrap.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vagrant_bootstrap.sh b/vagrant_bootstrap.sh index 13a44db..e5dbc35 100644 --- a/vagrant_bootstrap.sh +++ b/vagrant_bootstrap.sh @@ -33,13 +33,18 @@ class contains_all_list(list): def __contains__(self, key): return True -INTERNAL_IPS = contains_all_list()" > sigma/settings.py +INTERNAL_IPS = contains_all_list() + +MIDDLEWARE = [ + 'debug_toolbar.middleware.DebugToolbarMiddleware', +]" > sigma/settings.py echo "${LINE_BREAK_UP}" echo '# 2/6 Backend setup - pip requirements' echo "${LINE_BREAK}" sudo chown -R vagrant:vagrant /vagrant/backend +pip3 install 'six>=1.10.0' pip3 install -r requirements/dev.txt pip3 install -r requirements/prod.txt From 92e77516b2eab939c37aba2c156df43b29b9aad5 Mon Sep 17 00:00:00 2001 From: Nicolas Iooss Date: Mon, 23 Jan 2017 23:51:05 +0100 Subject: [PATCH 3/4] apt-get update before installing Node 5 The Node package from Ubuntu 14.04 is too old so install Node 5 when running "apt-get install -yqq nodejs". Moreover do not install npm as it is provided by nodejs package. --- vagrant_bootstrap.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vagrant_bootstrap.sh b/vagrant_bootstrap.sh index e5dbc35..179f5c6 100644 --- a/vagrant_bootstrap.sh +++ b/vagrant_bootstrap.sh @@ -61,10 +61,11 @@ echo '# 4/6 Frontend setup - apt packages' echo "${LINE_BREAK}" curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add - -DISTRO="vivid" +DISTRO="trusty" echo "deb https://deb.nodesource.com/node_5.x ${DISTRO} main" > /etc/apt/sources.list.d/nodesource.list echo "deb-src https://deb.nodesource.com/node_5.x ${DISTRO} main" >> /etc/apt/sources.list.d/nodesource.list -apt-get install -yqq nodejs npm +apt-get update +apt-get install -yqq nodejs cd /vagrant/frontend # Remove old modules from previous install / host machine From f1fb8bba4ccbdb4aa2a995ee4faa2c537c3d526e Mon Sep 17 00:00:00 2001 From: Nicolas Iooss Date: Mon, 23 Jan 2017 23:55:02 +0100 Subject: [PATCH 4/4] Add set -x -e to provisionning script In order to make it easier to find bugs/failures, stop the provisionning as soon as an error happens. --- vagrant_bootstrap.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vagrant_bootstrap.sh b/vagrant_bootstrap.sh index 179f5c6..092defd 100644 --- a/vagrant_bootstrap.sh +++ b/vagrant_bootstrap.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -x -e + # pour le proxy à polytechnique, lignes à décommenter si vous y êtes # export HTTP_PROXY="http://129.104.247.2:8080"