Skip to content

Commit

Permalink
Fix #255: Ported development server to Vagrant. (#258)
Browse files Browse the repository at this point in the history
* Added Vagrantfile for vagrant configuration. #255

* Added vagrant setup script and system requirements file.

* Updated README.md and .gitignore.

* Fixed EOF issue.

* Updated BOX url.
  • Loading branch information
souravbadami authored and Sean Auriti committed Jun 8, 2017
1 parent c8b9f21 commit efd47a2
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 25 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ staticfiles
.env
db.sqlite3
.idea
/media
/media
.vagrant
55 changes: 31 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,55 @@

Live Site: [Bugheist](http://bugheist.com/)

## Dev Setup
**Step 1:**
## Setting Up Development Server (Vagrant)

If PostgreSQL is not installed, run
1. Get [Vagrant](https://www.vagrantup.com/)

`brew install postgresql` (Mac)
2. Get [Virtualbox](https://www.virtualbox.org/)

`sudo apt-get install postgresql` (Ubuntu)
3. Navigate to the directory with source code and type `vagrant up`. (It takes time during the first run, so go get a coffee!).

**Step 2:**
4. Now, type `vagrant ssh`.

`cd BLT`
5. Run `python BLT/manage.py migrate`.

**Step 3:**
6. Run `python BLT/manage.py createsuperuser`.

If virtualenv is not installed, run `sudo apt-get install virtualenv` followed by
7. Start the server using `python BLT/manage.py runserver 0.0.0.0:8000` and visit `http://localhost:8000`.

`virtualenv venv` (Ubuntu)
8. Then go to http://127.0.0.1:8000/admin/socialaccount/socialapp/) and add filler information for social auth accounts. Add a Domain with the name 'owasp.com'.

`venv\Scripts\activate` (Windows)
**Note:** In case you encounter an error with vagrant's vbguest module, run `vagrant plugin install vagrant-vbguest` from the host machine.

`source venv/bin/activate` (Mac)
## Setting Up Development Server (Virtual Environment)

**Step 4:**
1. If PostgreSQL is not installed, run:

`pip install -r requirements.txt`
* `brew install postgresql` (Mac).

**Step 5:**
* `sudo apt-get install postgresql` (Ubuntu).

`python manage.py migrate`
2. Type `cd BLT`.

**Step 6:**
3. If virtualenv is not installed, run `sudo apt-get install virtualenv` followed by:

`python manage.py createsuperuser`
* `virtualenv venv` (Ubuntu).

then go to http://127.0.0.1:8000/admin/socialaccount/socialapp/) and add filler information for social auth accounts.Add a Domain with the name 'owasp.com' .
* `venv\Scripts\activate` (Windows).

**Step 7:**
* `source venv/bin/activate` (Mac).

Start the server using `python manage.py runserver` and visit http://localhost:8000
4. Run `pip install -r requirements.txt`.

**Note:** In case you encounter an error, run `sudo apt-get install libpq-dev`
5. Run `python manage.py migrate`.

6. Run `python manage.py createsuperuser`.

7. Then go to http://127.0.0.1:8000/admin/socialaccount/socialapp/) and add filler information for social auth accounts. Add a Domain with the name 'owasp.com'.

8. Start the server using `python manage.py runserver` and visit `http://localhost:8000`.

**Note:** In case you encounter an error, run `sudo apt-get install libpq-dev`.

## Resources

Expand All @@ -57,6 +64,6 @@ Start the server using `python manage.py runserver` and visit http://localhost:8

## Code Sprint 2017 Challenge

- OWASP Code Sprint 2017
- Add your name / Github link here along with your proposal
- OWASP Code Sprint 2017.
- Add your name / Github link here along with your proposal.

16 changes: 16 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
config.vm.box = "ubuntu_14.04"
config.vm.box_url = "http://github.com/kraksoft/vagrant-box-ubuntu/releases/download/14.04/ubuntu-14.04-amd64.box"
config.vm.provider "virtualbox" do |custom_virtualbox_settings|
custom_virtualbox_settings.name = "BLT_BOX"
end

config.vm.network "private_network", ip: "192.168.1.2"
config.vm.network :forwarded_port, guest: 8000, host: 8000
config.vm.synced_folder "", "/home/vagrant/BLT"
config.vm.provision :shell, :path => "vagrant/setup.sh"

end
1 change: 1 addition & 0 deletions vagrant/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-pillow
18 changes: 18 additions & 0 deletions vagrant/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

echo "---------------------------------------------"
echo "Configuring BLT Development Environment"
echo "---------------------------------------------"

if [ "$(whoami)" != "root" ]; then
exit 1
fi

apt-get update
apt-get install -y libpq-dev python-dev

apt-get install -y git-core
apt-get install -y python-pip

sudo apt-get install $(grep -vE "^\s*#" /home/vagrant/BLT/vagrant/requirements.txt | tr "\n" " ")
sudo pip install -r "/home/vagrant/BLT/requirements.txt"

0 comments on commit efd47a2

Please sign in to comment.