Skip to content
This repository has been archived by the owner on Sep 28, 2020. It is now read-only.

Commit

Permalink
Setup dev environment (#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
jisantuc authored Oct 6, 2017
1 parent 1e9571b commit 8e8f38b
Show file tree
Hide file tree
Showing 91 changed files with 13,062 additions and 1,117 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git/
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
*.pyc
*.mo
*.swp

deployment/ansible/roles/azavea.*
.vagrant*
14 changes: 13 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,19 @@ DistrictBuilder
Installation
------------

Installation instructions are available at docs/INSTALL.
### Requirements

Vagrant 1.8.1
VirtualBox 4.3
Ansible 2.2

### tl;dr

```bash
$ ./scripts/setup
$ vagrant ssh
$ ./scripts/update
```


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

Vagrant.require_version ">= 1.8"

Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"

config.vm.synced_folder "~/.aws", "/home/vagrant/.aws"

# Need to use rsync in order to prevent a vboxfs/docker/gunicorn-related
# file corruption issue.
config.vm.synced_folder ".", "/vagrant",
type: "rsync",
rsync__exclude: ".git/",
rsync__args: ["--verbose", "--archive", "--delete", "-z", "--links"]

config.vm.provider :virtualbox do |vb|
vb.memory = 2048
vb.cpus = 2
end

# Gunicorn
config.vm.network :forwarded_port, guest: 8080, host: 8080

# Django debug server
config.vm.network :forwarded_port, guest: 8081, host: 8081

# Change working directory to /vagrant upon session start.
config.vm.provision "shell", inline: <<SCRIPT
if ! grep -q "cd /vagrant" "/home/vagrant/.bashrc"; then
echo "cd /vagrant" >> "/home/vagrant/.bashrc"
fi
SCRIPT

config.vm.provision "ansible" do |ansible|
ansible.playbook = "deployment/ansible/district-builder.yml"
ansible.galaxy_role_file = "deployment/ansible/roles.yml"
end
end
13 changes: 13 additions & 0 deletions deployment/ansible/district-builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- hosts: all
become: True

pre_tasks:
- name: Update APT cache
apt: update_cache=yes cache_valid_time=3600

roles:
- { role: "azavea.ntp" }
- { role: "district-builder.environment" }
- { role: "azavea.python-security" }
- { role: "district-builder.docker" }
- { role: "district-builder.shellcheck" }
4 changes: 4 additions & 0 deletions deployment/ansible/group_vars/all
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---

shellcheck_version: "0.3.*"
docker_compose_version: "1.16.*"
14 changes: 14 additions & 0 deletions deployment/ansible/roles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- src: azavea.pip
version: 1.0.0

- src: azavea.docker
version: 4.0.0

- src: azavea.unzip
version: 0.1.2

- src: azavea.ntp
version: 0.1.1

- src: azavea.python-security
version: 0.1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
dependencies:
- { role: azavea.pip }
- { role: azavea.docker }
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: Install docker-compose
pip: name=docker-compose version={{ docker_compose_version }}

- name: Add Ansible user to Docker group
user: name="{{ ansible_user }}"
groups=docker
append=yes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- name: Install ShellCheck
apt: pkg="shellcheck={{ shellcheck_version }}"
state=present
44 changes: 0 additions & 44 deletions django/publicmapping.wsgi

This file was deleted.

4 changes: 4 additions & 0 deletions django/publicmapping/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
settings.py
static-media

static/admin/
static/jqGrid/
static/openlayers/
17 changes: 17 additions & 0 deletions django/publicmapping/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM quay.io/azavea/django:1.11-python2.7-slim

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

COPY requirements.txt /usr/src/app/
RUN apt-get update && apt-get install -y git gcc
RUN pip install --no-cache-dir -r requirements.txt

COPY . /usr/src/app

WORKDIR /usr/src/app

RUN cp config/config.dist.xml config/config.xml \
&& python setup.py ./config/config.xsd ./config/config.xml -v2 -d

ENTRYPOINT ["/usr/local/bin/gunicorn"]
27 changes: 0 additions & 27 deletions django/publicmapping/__init__.py

This file was deleted.

Loading

0 comments on commit 8e8f38b

Please sign in to comment.