Skip to content
This repository was archived by the owner on Jun 9, 2021. It is now read-only.

Commit 0815221

Browse files
author
raylu
committed
vagrant setup
1 parent 123f194 commit 0815221

File tree

4 files changed

+43
-3
lines changed

4 files changed

+43
-3
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
__pycache__/
2+
.vagrant/
23
config.yaml

Diff for: README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# LPMC Site
2-
3-
### Getting Started
1+
### Getting started
42

53
1. Install python 3.3 and postgresql (we use a [new generator feature only available in 3.3](http://www.python.org/download/releases/3.3.4/))
64

@@ -43,3 +41,9 @@ The authorization callback URL should probably be `http://localhost:8888/github_
4341
1. You can now run the server
4442
`./server.py`
4543
Visit `http://localhost:8888` or the specified port in `config.yaml`
44+
45+
#### Using Vagrant
46+
47+
If you want to set up a virtual machine for this project using [Vagrant](http://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/),
48+
simply follow step 2 to clone the project and run `vagrant up`.
49+
Once complete you can skip to step 10 and do the rest of the steps in `vagrant ssh`.

Diff for: Vagrantfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
Vagrant.configure("2") do |config|
5+
config.vm.box = "raylu/debian-testing"
6+
config.vm.network "forwarded_port", guest: 8888, host: 8888
7+
config.vm.provision :shell, :path => "vagrant.sh"
8+
config.vm.provider "virtualbox" do |vb|
9+
vb.name = "lpmc-site"
10+
end
11+
end
12+

Diff for: vagrant.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
sudo aptitude update
6+
sudo aptitude --quiet --assume-yes install python3.3 python3.3-dev postgresql-9.3 libpq-dev
7+
8+
pyvenv-3.3 venv
9+
source venv/bin/activate
10+
wget --no-verbose https://raw.github.com/pypa/pip/master/contrib/get-pip.py
11+
python3 get-pip.py
12+
pip3 install -r /vagrant/requirements.txt
13+
cat <<EOF >> /home/vagrant/.bashrc
14+
VIRTUAL_ENV="/home/vagrant/env"
15+
PATH=\$VIRTUAL_ENV/bin:\$PATH
16+
EOF
17+
18+
sudo sed 's/\(local\s\+all\s\+all\s\+\)peer/\1trust/' -i /etc/postgresql/9.3/main/pg_hba.conf
19+
sudo invoke-rc.d postgresql restart
20+
sudo -u postgres psql --command "CREATE USER lpmc;"
21+
sudo -u postgres psql --command "CREATE DATABASE lpmc;"
22+
sudo -u postgres psql --command "GRANT ALL PRIVILEGES ON DATABASE lpmc to lpmc;"
23+
psql -U lpmc < /vagrant/schema.sql

0 commit comments

Comments
 (0)