Skip to content

Alternative configure docker #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 27 commits into
base: configure_docker
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d7b32e9
Bump apipie-rails from 0.5.9 to 0.5.10 (#2494)
dependabot[bot] Jul 27, 2018
28b69fa
Add Slack channel link to the projects show page (#2498)
NickSchimek Jul 30, 2018
068ecdd
Use AgileVentures forked Gem (#2502)
NickSchimek Jul 30, 2018
c131615
Bump ice_cube from 0.16.2 to 0.16.3 (#2490)
dependabot[bot] Jul 24, 2018
999d22c
Bump public_activity from 1.5.0 to 1.6.0 (#2487)
dependabot[bot] Jul 24, 2018
8ec953b
Bump selenium-webdriver from 3.13.0 to 3.13.1 (#2486)
dependabot[bot] Jul 24, 2018
6e5dfb3
Bump public_activity from 1.6.0 to 1.6.1 (#2492)
dependabot[bot] Jul 24, 2018
1e400a7
Add dockeriziation (#2493)
mattwr18 Jul 24, 2018
4cfabdd
Ignore development in airbrake initializer
mattwr18 Jul 25, 2018
8ce2071
Add npm install globally, install dependencies
mattwr18 Jul 25, 2018
4bd3f97
Add Dockerfile for node, update corejs-typehead
mattwr18 Jul 26, 2018
38b0684
Install node from deb.nodesource.com
mattwr18 Jul 26, 2018
68cc651
Copy javascript dependencies to assets
mattwr18 Jul 26, 2018
80e7adc
Run scripts inside Dockerfile, remove node Dockerfile
mattwr18 Jul 26, 2018
ed5b81f
Copy package*.json files to the container before npm install
fnmunhoz Jul 26, 2018
beba65a
Remove the pid file before run the rails server
fnmunhoz Jul 26, 2018
4b91d2c
Add npm install bower
mattwr18 Jul 26, 2018
b2fba78
Trying to improve docker workflow
fnmunhoz Jul 28, 2018
1d78186
Configure docker database
mattwr18 Jul 30, 2018
b928a41
Clean up Dockerfile
mattwr18 Jul 30, 2018
95fe28a
Add docker installation notes
faithngetich Jul 30, 2018
66ffe05
Link docker file to the project setup document
faithngetich Jul 30, 2018
1ad446e
Bump apipie-rails from 0.5.9 to 0.5.10 (#2494)
dependabot[bot] Jul 27, 2018
7095615
Add Slack channel link to the projects show page (#2498)
NickSchimek Jul 30, 2018
b2c6ba7
Use AgileVentures forked Gem (#2502)
NickSchimek Jul 30, 2018
87aabe4
Merge branch 'configure_docker' into alternative_configure_docker
mattwr18 Jul 31, 2018
45738af
Merge branch 'develop' into alternative_configure_docker
mattwr18 Jul 31, 2018
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
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ FROM ruby:2.5

RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get update -qq && apt-get install -y build-essential \
libpq-dev nodejs qt5-default libqt5webkit5-dev \
gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x
libpq-dev nodejs qt5-default libqt5webkit5-dev \
gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x


RUN mkdir /WebsiteOne
WORKDIR /WebsiteOne
Expand All @@ -14,9 +15,7 @@ RUN bundle install

COPY package.json /WebsiteOne/package.json
COPY package-lock.json /WebsiteOne/package-lock.json
RUN npm install bower && npm install

COPY . /WebsiteOne
RUN npm install

RUN /WebsiteOne/scripts/copy_javascript_dependencies.js
RUN ls -al /WebsiteOne/vendor/assets/javascripts
COPY . /WebsiteOne
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ruby '2.5.1'

gem 'rails', '~> 5.1'
gem 'acts-as-taggable-on'
gem 'acts_as_follower', git: 'https://github.com/tcocca/acts_as_follower.git'
gem 'acts_as_follower', git: 'https://github.com/AgileVentures/acts_as_follower.git'
gem 'acts_as_tree'
gem 'acts_as_votable', '~> 0.11.1'
gem 'airbrake'
Expand Down
16 changes: 8 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
GIT
remote: https://github.com/AgileVentures/acts_as_follower.git
revision: 894b44451c609a9facfdb8a15bca4fc17ea1eb76
specs:
acts_as_follower (0.2.1)
activerecord (>= 4.0)

GIT
remote: https://github.com/AgileVentures/codeclimate_badges
revision: 88f15dfae8679a7895e8fa3cf6a9cb39f665745e
Expand All @@ -13,13 +20,6 @@ GIT
coffee-rails (>= 3.2.2)
railties (>= 3.0)

GIT
remote: https://github.com/tcocca/acts_as_follower.git
revision: c5ac7b9601c4af01eb4d9112330b27be4d694ecc
specs:
acts_as_follower (0.2.1)
activerecord (>= 4.0)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -71,7 +71,7 @@ GEM
airbrake-ruby (~> 2.10)
airbrake-ruby (2.10.0)
andand (1.3.3)
apipie-rails (0.5.9)
apipie-rails (0.5.10)
rails (>= 4.1)
arel (8.0.0)
autoprefixer-rails (8.1.0)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ def get_current_stories
end

def project_params
params.require(:project).permit(:title, :description, :pitch, :created, :status, :user_id, :github_url, :pivotaltracker_url, :pivotaltracker_id, :image_url, source_repositories_attributes: [:id, :url, :_destroy])
params.require(:project).permit(:title, :description, :pitch, :created, :status, :user_id, :github_url, :pivotaltracker_url, :pivotaltracker_id, :slack_channel_name, :image_url, source_repositories_attributes: [:id, :url, :_destroy])
end
end
10 changes: 10 additions & 0 deletions app/views/projects/_connections.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,14 @@
<% else %>
<p><i class="fa fa-gear fa-lg"></i> <span class="small">not linked to IssueTracker</span></p>
<% end %>

<% if @project.slack_channel_name.present? %>
<p><i class="fa fa-slack" aria-hidden="true"></i>
<span class="small">
<%= link_to "#{@project.title} ", "https://agileventures.slack.com/app_redirect?channel=#{@project.slack_channel_name}" %>on Slack
</span>
</p>
<% else %>
<p><i class="fa fa-gear fa-lg"></i> <span class="small">not linked to Slack</span></p>
<% end %>
</aside>
4 changes: 3 additions & 1 deletion app/views/projects/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

<%= awesome_text_field f, :pivotaltracker_url, label_text: 'Issue Tracker link', placeholder: 'https://www.pivotaltracker.com/s/projects/id' %>

<%= awesome_text_field f, :slack_channel_name, label_text: 'Slack channel name', placeholder: 'project_slack_channel_name' %>

<% if @project.new_record? %>
<div class="form-group">
<h3>New project checklist</h3>
Expand All @@ -40,4 +42,4 @@
</div>
<% end %>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddSlackChannelNameToProjects < ActiveRecord::Migration[5.1]
def change
add_column :projects, :slack_channel_name, :string
end
end
4 changes: 3 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20180721104321) do

ActiveRecord::Schema.define(version: 20180729040001) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -184,6 +185,7 @@
t.integer "commit_count", default: 0
t.string "image_url"
t.datetime "last_github_update"
t.string "slack_channel_name"
t.index ["slug"], name: "index_projects_on_slug", unique: true
t.index ["user_id"], name: "index_projects_on_user_id"
end
Expand Down
10 changes: 7 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ services:
db:
image: postgres
volumes:
- ./tmp/db:/var/lib/postgresql/data:rw
- dbVolume:/var/lib/postgresql/data
web:
build: .
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
volumes:
- .:/WebsiteOne
- webVolume:/WebsiteOne
- ./docker/config/database.yml:/WebsiteOne/config/database.yml
ports:
- "3000:3000"
depends_on:
- db
volumes:
dbVolume:
webVolume:

67 changes: 67 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# How to use docker to spin up WebSiteOne

## Prerequisites

In order to run this container you'll need docker installation
* [Windows](https://docs.docker.com/docker-for-windows/)
* [OS X](https://docs.docker.com/docker-for-mac/)
* [Linux](https://docs.docker.com/linux/started/)

## Setup your environment variables

Create a .env file at the root of your directory.

```
touch .env
```

* You'll have to get the `.env` file content from one of the admins: @tansaku or @diraulo. The project won't work without it. You can send them a direct message (DM) on Slack. The `.env` file should go in the root of the WSO project.
* Add the following to that file:

```
RECAPTCHA_SITE_KEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
RECAPTCHA_SECRET_KEY=6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe
AIRBRAKE_API_KEY=blahblahblah
AIRBRAKE_PROJECT_ID=123
SECRET_KEY_BASE=blabla
RACK_TIMEOUT_SERVICE_TIMEOUT=200000000
```

the above are test keys from https://developers.google.com/recaptcha/docs/faq

## Setup docker

Execute this setup just for the first time, or when you want to recreate everything from scratch.

**BE AWARE IT WILL DELETE ALL YOUR DATA, including the Postgres Database.**




```
$ ./docker/setup.sh
```

## Start docker

Start the application

```
$ ./docker/start.sh
```

## Stop docker

Stop the application

```
$ ./docker/stop.sh
```

ps: those docker commands were tested under the following environment:

- MacOS 10.13.6
- Docker version 18.06.0-ce, build 0ffa825
- docker-compose version 1.22.0, build f46880f

If it doesn't work for you, try to check your docker version and consider upgrading it if you have an older version.
18 changes: 18 additions & 0 deletions docker/config/database.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
development: &dev
adapter: postgresql
encoding: unicode
database: websiteone_development
host: db
pool: 20
username: postgres
password:
test: &test
<<: *dev
database: websiteone_test

production:
<<: *dev
database: websiteone_production

cucumber:
<<: *test
7 changes: 7 additions & 0 deletions docker/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

docker-compose down --rmi all --volumes --remove-orphans
docker-compose build --force-rm --no-cache
docker-compose run --rm web rake db:create
docker-compose run --rm web rake db:migrate RAILS_ENV=development
docker-compose run --rm web rake db:seed
4 changes: 4 additions & 0 deletions docker/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

docker-compose down
docker-compose up
3 changes: 3 additions & 0 deletions docker/stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

docker-compose down
19 changes: 13 additions & 6 deletions docs/project_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ git fetch upstream
git pull upstream develop
```

### Step 3: Install the gems with `bundle install`
### Step 3: There are two options of setting up, choose one.

## Option 1 - Installation and Usage with Docker
See the [Docker Project Setup](../docker/README.md) documentation

## Option 2 - Local Installation

### Step 1: Install the gems with `bundle install`

bundle install

Expand Down Expand Up @@ -80,7 +87,7 @@ If you need to update rails, you can run `bundle update rails`. If you run into
gem install libv8 -v '3.16.14.3' -- --with-system-v8
```

### Step 4: Install javascript dependencies using `npm`
### Step 2: Install javascript dependencies using `npm`
* Use [npm](https://www.npmjs.com/) to install all of the javascript dependencies for WSO:

`npm install`
Expand All @@ -92,7 +99,7 @@ If you need to update rails, you can run `bundle update rails`. If you run into
#### Phantomjs
[Phantomjs](http://phantomjs.org/) is used to run tests. [Here are detailed instructions for installing it.](development_environment_set_up.md#phantomjs)

### Step 5: Request the .env file and confirm your locale
### Step 3: Request the .env file and confirm your locale

* You'll have to get the `.env` file from one of the admins: @tansaku or @diraulo. The project won't work without it. You can send them a direct message (DM) on Slack. The `.env` file should go in the root of the WSO project.
* Add the following to that file:
Expand All @@ -110,13 +117,13 @@ the above are test keys from https://developers.google.com/recaptcha/docs/faq



### Step 6: Set up the database
### Step 4: Set up the database

* Run the rake command to set up the database. Be sure to use `bundle exec` so that the gems specific to this project (listed in the Gemfile) are used:

`bundle exec rake db:setup`

### Step 7: Run the tests
### Step 5: Run the tests

Now you're ready to run the tests:

Expand All @@ -126,7 +133,7 @@ Now you're ready to run the tests:

Discuss any errors with the team on Slack, in a scrum, or in mob or pair programming.

### Step 8. Start the server
### Step 6. Start the server

bundle exec rails s

Expand Down
44 changes: 44 additions & 0 deletions features/projects/connections.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Feature: Projects should show links to the connected APIs
As a User
So that I can easily navigate to Project apps
I want to see all connected app links on the show page

Background:
Given the following users exist
| first_name | last_name | email | receive_mailings |
| Bill | Bob | [email protected] | true |

Given the following projects exist:
| title | description | status | author | pivotaltracker_url | github_url | slack_channel_name |
| hello | earthlings | active | Bill | https://www.pivotaltracker.com/n/projects/742821 | https://github.com/hello | hello_earthlings |
| Bat Man | All bat | active | Bill | | | |

Scenario: I can see a link to the GitHub project page
When I go to the "hello" project "show" page
Then I should see "hello on GitHub"
And I should see a link to "hello" on github

Scenario: I can see when a project is not connected to GitHub
When I go to the "Bat Man" project "show" page
Then I should not see "Bat Man on GitHub"
And I should see "not linked to GitHub"

Scenario: I can see a link to the projects issue tracker
When I go to the "hello" project "show" page
Then I should see "hello on IssueTracker"
And I should see a link to "hello" on Pivotal Tracker

Scenario: I can see when a project is not connected to issue tracker
When I go to the "Bat Man" project "show" page
Then I should not see "Bat Man on IssueTracker"
And I should see "not linked to IssueTracker"

Scenario: I can see a link to the projects slack channel
When I go to the "hello" project "show" page
Then I should see "hello on Slack"
And I should see a link to the slack channel for "hello"

Scenario: I can see when a project is not connected to slack
When I go to the "Bat Man" project "show" page
Then I should not see "Bat Man on Slack"
And I should see "not linked to Slack"
4 changes: 3 additions & 1 deletion features/projects/create_projects.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Feature: Create projects
| Status |
| GitHub url (primary) |
| Issue Tracker link |
| Slack channel name |

Scenario Outline: Saving a new project: success
Given I have logged in
Expand All @@ -35,6 +36,7 @@ Feature: Create projects
And I fill in "Description" with "<description>"
And I fill in "GitHub url (primary)" with "<gh_link>"
And I fill in "Issue Tracker link" with "<pt_link>"
And I fill in "Slack channel name" with "slackin"
And I select "Status" to "Active"
And I click the "Submit" button
Then I should be on the "Show" page for project "<title>"
Expand All @@ -46,6 +48,7 @@ Feature: Create projects
| ACTIVE |
And I should see a link to "<title>" on github
And I should see a link to "<title>" on Pivotal Tracker
And I should see a link to the slack channel for "<title>"

Examples:
| title | description | gh_link | pt_link |
Expand Down Expand Up @@ -83,4 +86,3 @@ Feature: Create projects
| ACTIVE |
And I should see a link to "multiple repo project" on github
And I should see a link to "multiple repo project" on Pivotal Tracker

Loading