forked from govtrack/govtrack.us-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
85 lines (65 loc) · 2.87 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# -*- mode: ruby -*-
# vi: set ft=ruby :
# If you are looking at this script to set up your computer for developing
# the GovTrack website, skip ahead to "START HERE". Thanks!
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.network "forwarded_port", guest: 8000, host: 8000
config.vm.provision "shell", inline: <<-SHELL
# Create a fake manage.py file in ~ so 'vagrant ssh' can find it easily.
ln -s /vagrant/build/vagrant_manage.py manage.py
cd /vagrant
###############
# Start here! #
###############
# These instructions are for Ubuntu 16.04. Where the instructions
# differ for OS X, we'll note those differences.
# Install system packages
#########################
# (Ubuntu only)
echo Installing system packages...
sudo apt-get update
sudo apt install -y -q \
git python-virtualenv python-lxml python-openid \
python-oauth2client python-iso8601 python-numpy python-scipy \
python-prctl python-pip python-xapian
# On OS X...
# ----------
# export CFLAGS=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libxml2
# pip install virtualenv lxml python-openid python-oauth2 iso-8601 numpy scipy
# Install Python packages
#########################
# If you're following these instructions manually, you should create
# a "virtualenv" for Python that will hold additional Python packages.
# With Vagrant, it's not necessary, so it's commented out. But you
# should run these two commands:
#
# virtualenv --system-site-packages .venv
# source .venv/bin/activate
# Install Python packages.
pip install --upgrade -r requirements.txt
# On OS X, install bcrypt:
# http://stackoverflow.com/questions/22875270/error-installing-bcrypt-with-pip-on-os-x-cant-find-ffi-h-libffi-is-installed
# Initialize the database.
./manage.py migrate --noinput
# Load some legislative data
############################
# Get our latest database dump of legislators, committees, and subject areas.
echo Downloading a partial database dump from GovTrack...
wget -q -N -P /tmp http://www.govtrack.us/data/db/django-fixture-{people,committees,billterms}.json
# And load them.
echo Loading data...
./manage.py loaddata /tmp/django-fixture-people.json
./manage.py loaddata /tmp/django-fixture-committees.json
./manage.py loaddata /tmp/django-fixture-billterms.json
# Fetch some data about bills and votes.
echo Fetching a subset of data files about bills and votes...
build/rsync.sh
echo And now am loading it into the database...
./parse.py bill --congress=115
./parse.py vote --congress=115
# Update search indexes.
echo "Initializing search indexes (this part takes a long while)..."
./manage.py update_index
SHELL
end