Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* add docker configs

* remove vagrant

* remove more vagrant

* update docs

* attempt to use travis...

* use compose

* add docs for forking project

* update contributing docs

* add db:create and db:migrate as entrypoint

* update docs
  • Loading branch information
mi-wood authored and DeeDeeG committed Oct 15, 2018
1 parent 8f98cd4 commit 50964a9
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 305 deletions.
14 changes: 0 additions & 14 deletions .rake/vagrant.rb

This file was deleted.

11 changes: 4 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
language: ruby
cache: bundler
services: docker
before_install:
- docker-compose build
script:
- bundle exec rake db:setup RAILS_ENV=test
- bundle exec rake db:test:prepare
- bundle exec rake spec
- bundle exec rake cucumber
rvm:
- 2.3.1
- docker-compose run -e "RAILS_ENV=test" web rake db:test:prepare spec cucumber
48 changes: 26 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,39 @@
## Setting Up Development Environment

### 1 Fork and clone the repository.
https://help.github.com/articles/fork-a-repo/

### 2 Install Vagrant.
https://www.vagrantup.com/downloads.html
### 2 Install Docker.
https://docs.docker.com/install/

### 3 Install VirtualBox
https://www.virtualbox.org/wiki/Downloads
### 3 Build the Docker Container
Build the container
```
docker-compose build
```

### 4 Capture the powers of vagrant
* In the repo dir: <code>vagrant up</code> (Safely ignore: 'dpkg-preconfigure: unable to re-open stdin: No such file or directory')
* If changes have been made since running vagrant up: <code>vagrant provision</code>

* Start the rails server. There are two ways to do this, depending on your familiarity running from within the vagrant shell:
### 4 Run the Docker Container

1. A local `rake` wrapper that allows direct execution on the machine.
* Run `rake vagrant:shell[command]`<sup>1</sup>
* To start the rails server using the rake wrapper use: `rake vagrant:shell['rails s -b 0.0.0.0']`.
* Navigate to `localhost:3000`
2. Using `vagrant ssh` to gain access directly to the machine.
* To login to the machine: <code>vagrant ssh</code>
* `cd /vagrant/` to navigate to the refuge repo.
* To start the rails server use: `rails s -b 0.0.0.0`.
* Navigate to `localhost:3000`
You can now run and shutdown the app with:
```
docker-compose up
docker-compose down
```

[1] You can run any command locally using `rake vagrant:shell[]` and it will be executed in the repo root of the vagrant machine. You can try `rake vagrant:shell['pwd']` and see it will print the directory that the repo is in on the vagrant machine!
It will be available at localhost:3000

### 5 Optional tasks:
run <code>rake db:fix_accents</code> to clean up encoding problems in the safe2pee data. (Use <code>rake db:fix_accents[dry_run]</code> to preview the changes.)
### 5 Run the Tests
```
docker-compose run -e "RAILS_ENV=test" web rake db:test:prepare spec cucumber
```

### 6 Assets
### 6 Optional tasks:
To clean up encoding problems in the safe2pee data, run (Use `rake db:fix_accents[dry_run]` to preview the changes.):
```
docker-compose run rake db:fixaccents
```

### 7 Assets
* [Assets Repo](https://github.com/RefugeRestrooms/refuge_assets)

## Testing
Expand Down
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM ruby:2.3.1
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
ENV PHANTOM_JS=2.1.1
RUN apt-get update && \
apt-get install build-essential chrpath libssl-dev libxft-dev -y && \
apt-get install libfreetype6 libfreetype6-dev -y && \
apt-get install libfontconfig1 libfontconfig1-dev -y && \
cd ~ && \
export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64" && \
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2 && \
tar xvjf $PHANTOM_JS.tar.bz2 && \
mv $PHANTOM_JS /usr/local/share && \
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
RUN mkdir /refugerestrooms
WORKDIR /refugerestrooms
COPY Gemfile /refugerestrooms/Gemfile
COPY Gemfile.lock /refugerestrooms/Gemfile.lock
RUN bundle install
COPY . /refugerestrooms
3 changes: 0 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,3 @@ require File.expand_path('../config/application', __FILE__)

SaferstallsRails::Application.load_tasks

Dir.glob('.rake/*.rb').each do |f|
import f
end
54 changes: 0 additions & 54 deletions Vagrantfile

This file was deleted.

18 changes: 11 additions & 7 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
development:
default: &default
adapter: postgresql
encoding: unicode
database: bathrooms_development
host: db
username: postgres
password:
pool: 5
host: localhost

development:
<<: *default
database: bathrooms_development


test:
adapter: postgresql
encoding: unicode
<<: *default
database: bathrooms_test
pool: 5
host: localhost

14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3'
services:
db:
image: postgres
web:
build: .
entrypoint: [setup/entry]
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- .:/refugerestrooms
ports:
- "3000:3000"
depends_on:
- db
7 changes: 7 additions & 0 deletions setup/entry
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -e

rake db:create
rake db:migrate

exec "$@"
99 changes: 0 additions & 99 deletions setup/pg_hba.conf

This file was deleted.

Loading

0 comments on commit 50964a9

Please sign in to comment.