From d06a72224e529e5fb869bf385a12f94ae0f7b7c4 Mon Sep 17 00:00:00 2001 From: Imdad Ahad Date: Thu, 20 Jul 2017 11:29:31 +0100 Subject: [PATCH] Don't create wheels for dependencies but store offline: Previously we used AWS which meant that we could create wheels from our requirements and then install them offline which made deployments quicker. We're no longer using AWS so let's remove that. Although CloudFoundry supports installing dependencies in an offline environment as documented here: http://docs.cloudfoundry.org/buildpacks/python/#vendoring To achieve this we create a vendor/ directory which will contain the packages to install. This uses --no-index and --find-links so will not resolve for any dependencies from pypi. For this reason there is assumed confidence that the vendor/ directory will contain all of the dependencies we need. --- .gitignore | 2 +- Makefile | 6 ++++-- scripts/aws_install_dependencies.sh | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 827c22381..178739382 100644 --- a/.gitignore +++ b/.gitignore @@ -23,7 +23,7 @@ var/ .installed.cfg *.egg venv/ -wheelhouse/ +vendor/ # PyInstaller # Usually these files are written by a python script from a template diff --git a/Makefile b/Makefile index 56200d921..d1b7695b0 100644 --- a/Makefile +++ b/Makefile @@ -85,7 +85,9 @@ generate-version-file: ## Generates the app version file .PHONY: build build: dependencies generate-version-file ## Build project npm run build - . venv/bin/activate && PIP_ACCEL_CACHE=${PIP_ACCEL_CACHE} pip-accel wheel --wheel-dir=wheelhouse -r requirements.txt + . venv/bin/activate && PIP_ACCEL_CACHE=${PIP_ACCEL_CACHE} pip-accel install -r requirements.txt + mkdir -p vendor/ + cp -r ${PIP_ACCEL_CACHE}/sources/ vendor/ .PHONY: cf-build cf-build: dependencies generate-version-file ## Build project @@ -199,7 +201,7 @@ clean-docker-containers: ## Clean up any remaining docker containers .PHONY: clean clean: - rm -rf node_modules cache target venv .coverage wheelhouse + rm -rf node_modules cache target venv .coverage vendor .PHONY: cf-login cf-login: ## Log in to Cloud Foundry diff --git a/scripts/aws_install_dependencies.sh b/scripts/aws_install_dependencies.sh index c2c658c99..ccf5a6578 100755 --- a/scripts/aws_install_dependencies.sh +++ b/scripts/aws_install_dependencies.sh @@ -2,4 +2,4 @@ echo "Install dependencies" cd /home/notify-app/notifications-admin; -pip3 install --find-links=wheelhouse -r /home/notify-app/notifications-admin/requirements.txt +pip3 install --find-links=vendor -r /home/notify-app/notifications-admin/requirements.txt