From dc2fdde6f8d364aa7cf01e1b891e1eeeb51aeb41 Mon Sep 17 00:00:00 2001 From: James Baster Date: Thu, 15 Aug 2019 16:13:11 +0100 Subject: [PATCH] Vagrant Add virtualenvs Change sed to match current values Still can't build docs tho? --- README.md | 1 + Vagrantfile | 2 +- vagrant/bootstrap.sh | 24 ++++++++++++++++-------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 63d1a2d..456bafe 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,7 @@ NOTE: This is not in full working order and needs tweaks! See pull request. vagrant up vagrant ssh cd /vagrant + source .ve/bin/activate python3 ocds-doc-search-cli.py -u http://localhost:6060/ # this indexes to elasticsearch python3 manage.py runserver 0.0.0.0:5000 diff --git a/Vagrantfile b/Vagrantfile index 9b6109b..ce51fa5 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,6 +1,6 @@ Vagrant.configure(2) do |config| - config.vm.box = "ubuntu/xenial64" + config.vm.box = "ubuntu/bionic64" config.vm.network "forwarded_port", guest: 9200, host: 9200 config.vm.network "forwarded_port", guest: 6060, host: 6060 diff --git a/vagrant/bootstrap.sh b/vagrant/bootstrap.sh index edbb4ab..5b5b63b 100644 --- a/vagrant/bootstrap.sh +++ b/vagrant/bootstrap.sh @@ -6,6 +6,8 @@ set -e apt-get update apt-get install -y apt-transport-https openjdk-8-jre python3-pip apache2 +pip3 install virtualenv + # Add Elasticsearch repo and install wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add - @@ -20,16 +22,22 @@ echo "network.host: 0.0.0.0" >> /etc/elasticsearch/elasticsearch.yml systemctl enable elasticsearch -# Install Python Libs -pip3 install -r /vagrant/requirements.txt -pip3 install flake8 - -# Install standard docs -git clone https://github.com/open-contracting/standard.git -cd standard +# Install Virtenv and Python Libs +cd /vagrant +virtualenv .ve -p python3 +source .ve/bin/activate +pip3 install -r /vagrant/requirements_dev.txt +deactivate + +# Install standard docs (using virtualenv) +git clone https://github.com/open-contracting/standard.git /home/vagrant/standard +cd /home/vagrant/standard +virtualenv .ve -p python3 +source .ve/bin/activate pip3 install -r requirements.txt -sed -i 's/www.standard-search.default.opendataservices.uk0.bigv.io/localhost:5000/g' src/standard-theme/standard_theme/static/js/search.js +sed -i 's/standard-search.open-contracting.org/localhost:5000/g' .ve/src/standard-theme/standard_theme/static/js/search.js make +deactivate # Configure Apache cp /vagrant/vagrant/apache.conf /etc/apache2/sites-enabled/000-default.conf