Skip to content

Commit

Permalink
Merge pull request openshift#17 from bparees/master
Browse files Browse the repository at this point in the history
fix up db configuration settings and permissions
  • Loading branch information
bparees committed Oct 31, 2014
2 parents a40181c + 502b55c commit 84fc19f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ FROM openshift/ruby-20-centos
RUN gem install sinatra sinatra-activerecord mysql2 --no-ri --no-rdoc

ADD sinatra_app /tmp/

USER root

RUN chown -R ruby:ruby /tmp/*

USER ruby

WORKDIR /tmp/

EXPOSE 8080
Expand Down
2 changes: 1 addition & 1 deletion sinatra_app/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require_relative 'models'

set :bind, '0.0.0.0'
set :port, ENV["FRONTEND_SERVICE_PORT"]
set :port, 8080

get '/' do
Timestamp.create(date: Time.now, text: "This is a message from a database query. The last insertion in the database was at")
Expand Down
2 changes: 1 addition & 1 deletion sinatra_app/config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ development:
database: <%= ENV["MYSQL_DATABASE"] %>
username: root
password: <%= ENV['MYSQL_ROOT_PASSWORD'] %>
host: <%= ENV["DATABASE_SERVICE_IP_ADDR"] %>
host: <%= ENV["DATABASE_SERVICE_HOST"] %>
port: <%= ENV["DATABASE_SERVICE_PORT"] %>
2 changes: 1 addition & 1 deletion sinatra_app/config/environments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def self.connect_to_database
begin
ActiveRecord::Base.establish_connection(
:adapter => "mysql2",
:host => "#{ENV["DATABASE_SERVICE_IP_ADDR"]}",
:host => "#{ENV["DATABASE_SERVICE_HOST"]}",
:port => "#{ENV["DATABASE_SERVICE_PORT"]}",
:database => "#{ENV["MYSQL_DATABASE"]}",
:password => "#{ENV["MYSQL_ROOT_PASSWORD"]}"
Expand Down
2 changes: 1 addition & 1 deletion sinatra_app/start.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
puts "Run migrations..."
%x"rake db:migrate"
puts "Run app..."
%x"ruby app.rb &>/dev/null &"
%x"ruby app.rb &"

0 comments on commit 84fc19f

Please sign in to comment.