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

Feature/js/setup dev environment #461

Merged
merged 18 commits into from
Oct 6, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
14 changes: 14 additions & 0 deletions deployment/ansible/district-builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- 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.aws-cli" }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My assumption is that we're going to include AWS integration in the repo, but if that's not the case and we're just going to have containers and handle deployment of those containers separately, this can be removed. Currently the aws cli isn't being used for anything so it's a no-cost deletion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can keep it out for now.

- { role: "district-builder.shellcheck" }
7 changes: 7 additions & 0 deletions deployment/ansible/group_vars/all
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

aws_cli_version: "1.11.*"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with the removal of these two.

aws_region: "us-east-1"
aws_profile: "district-builder"
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,3 @@
---
dependencies:
- { role: azavea.pip }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- name: Install AWS Command Line Interface
pip: name=awscli version="{{ aws_cli_version }}"
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,10 @@
---
- name: Set AWS_DEFAULT_REGION globally
lineinfile: dest=/etc/environment
regexp=^AWS_DEFAULT_REGION
line="AWS_DEFAULT_REGION={{ aws_region }}"

- name: Set AWS_PROFILE globally
lineinfile: dest=/etc/environment
regexp=^AWS_PROFILE
line="AWS_PROFILE={{ aws_profile }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- name: Install ShellCheck
apt: pkg="shellcheck={{ shellcheck_version }}"
state=present
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/
4 changes: 2 additions & 2 deletions scripts/setup
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ then
# Ensure that a directory exists to house AWS profiles.
mkdir -p "${HOME}/.aws"

docker-compose -f docker-compose.yml build
vagrant up --provision
fi
fi
fi
43 changes: 43 additions & 0 deletions scripts/update
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
set -e

if [[ -n "${RF_DEBUG}" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale variable name here.

set -x
fi

DIR="$(dirname "$0")"


function usage() {

echo -n \
"Usage: $(basename "$0")
Setup external project dependencies.
"
}


function build_containers() {
docker-compose build
}


function do_migrations() {
./scripts/console django "./manage.py migrate"
}


if [ "${BASH_SOURCE[0]}" = "${0}" ]
then
if [ "${1:-}" = "--help" ]
then
usage
else
echo "Building containers"
build_containers

echo "Running migrations"
do_migrations
fi
exit
fi