Browse Source

update ar-jdbc and use a single database.yml for MRI/JRuby + explicitly declare drivers

very necessary esp. since 1.2 was not 100% rails 3.2 compatible 
and AR-JDBC 1.3.x is compatible with latest rails (4.x) as well
kares 11 years ago
parent
commit
1a44e9cc57

+ 2 - 1
rails/Gemfile-jruby

@@ -1,7 +1,8 @@
 source 'https://rubygems.org'
 source 'https://rubygems.org'
 
 
 gem 'rails', '3.2.18'
 gem 'rails', '3.2.18'
-gem 'activerecord-jdbcmysql-adapter', '1.2.6'
+gem 'activerecord-jdbc-adapter', '~> 1.3.7'
+gem 'jdbc-mysql', '5.1.30'
 
 
 group :server do
 group :server do
   gem 'torqbox', '0.1.7', :require => false
   gem 'torqbox', '0.1.7', :require => false

+ 1 - 1
rails/Gemfile-ruby

@@ -1,7 +1,7 @@
 source 'https://rubygems.org'
 source 'https://rubygems.org'
 
 
 gem 'rails', '3.2.18'
 gem 'rails', '3.2.18'
-gem 'mysql2', '0.3.11'
+gem 'mysql2', '0.3.16'
 
 
 group :server do
 group :server do
   gem 'passenger', '4.0.44', :require => false
   gem 'passenger', '4.0.44', :require => false

+ 0 - 31
rails/config/database-jruby.yml

@@ -1,31 +0,0 @@
-# SQLite version 3.x
-#   gem install sqlite3
-#
-#   Ensure the SQLite 3 gem is defined in your Gemfile
-#   gem 'sqlite3'
-development:
-  adapter: jdbcmysql 
-  database: hello_world
-  username: benchmarkdbuser
-  password: benchmarkdbpass
-  host: localhost
-  pool: 5
-  timeout: 5000
-
-# Warning: The database defined as "test" will be erased and
-# re-generated from your development database when you run "rake".
-# Do not set this db to the same as development or production.
-
-#production:
-#  adapter: jdbc
-#  jndi: java:comp/env/jdbc/hello_world
-#  pool: 256
-
-production:
-  adapter: jdbcmysql 
-  database: hello_world
-  username: benchmarkdbuser
-  password: benchmarkdbpass
-  host: localhost
-  pool: 256
-  timeout: 5000

+ 0 - 22
rails/config/database-ruby.yml

@@ -1,22 +0,0 @@
-# SQLite version 3.x
-#   gem install sqlite3
-#
-#   Ensure the SQLite 3 gem is defined in your Gemfile
-#   gem 'sqlite3'
-development:
-  adapter: mysql2
-  database: hello_world
-  username: benchmarkdbuser
-  password: benchmarkdbpass
-  host: localhost
-  pool: 5
-  timeout: 5000
-
-production:
-  adapter: mysql2
-  database: hello_world
-  username: benchmarkdbuser
-  password: benchmarkdbpass
-  host: localhost
-  pool: 256
-  timeout: 5000

+ 5 - 18
rails/config/database.yml

@@ -1,31 +1,18 @@
-# SQLite version 3.x
-#   gem install sqlite3
-#
-#   Ensure the SQLite 3 gem is defined in your Gemfile
-#   gem 'sqlite3'
+
 development:
 development:
-  adapter: jdbcmysql 
+  adapter: mysql2
   database: hello_world
   database: hello_world
   username: benchmarkdbuser
   username: benchmarkdbuser
   password: benchmarkdbpass
   password: benchmarkdbpass
-  host: tfbdata
+  host: localhost
   pool: 5
   pool: 5
   timeout: 5000
   timeout: 5000
 
 
-# Warning: The database defined as "test" will be erased and
-# re-generated from your development database when you run "rake".
-# Do not set this db to the same as development or production.
-
-#production:
-#  adapter: jdbc
-#  jndi: java:comp/env/jdbc/hello_world
-#  pool: 256
-
 production:
 production:
-  adapter: jdbcmysql 
+  adapter: mysql2
   database: hello_world
   database: hello_world
   username: benchmarkdbuser
   username: benchmarkdbuser
   password: benchmarkdbpass
   password: benchmarkdbpass
-  host: tfbdata
+  host: localhost
   pool: 256
   pool: 256
   timeout: 5000
   timeout: 5000

+ 1 - 2
rails/setup_jruby.py

@@ -5,13 +5,12 @@ import os
 import setup_util
 import setup_util
 
 
 def start(args, logfile, errfile):
 def start(args, logfile, errfile):
-  setup_util.replace_text("rails/config/database-jruby.yml", "host: .*", "host: " + args.database_host)
+  setup_util.replace_text("rails/config/database.yml", "host: .*", "host: " + args.database_host)
 
 
   try:
   try:
     subprocess.check_call("rvm jruby-1.7.8 do bundle install --gemfile=Gemfile-jruby", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
     subprocess.check_call("rvm jruby-1.7.8 do bundle install --gemfile=Gemfile-jruby", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
     subprocess.check_call("cp Gemfile-jruby Gemfile", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
     subprocess.check_call("cp Gemfile-jruby Gemfile", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
     subprocess.check_call("cp Gemfile-jruby.lock Gemfile.lock", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
     subprocess.check_call("cp Gemfile-jruby.lock Gemfile.lock", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
-    subprocess.check_call("cp config/database-jruby.yml config/database.yml", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
     subprocess.Popen("rvm jruby-1.7.8 do bundle exec torqbox -b 0.0.0.0 -E production", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
     subprocess.Popen("rvm jruby-1.7.8 do bundle exec torqbox -b 0.0.0.0 -E production", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
     return 0
     return 0
   except subprocess.CalledProcessError:
   except subprocess.CalledProcessError:

+ 1 - 2
rails/setup_ruby.py

@@ -9,12 +9,11 @@ from os.path import expanduser
 home = expanduser("~")
 home = expanduser("~")
 
 
 def start(args, logfile, errfile):
 def start(args, logfile, errfile):
-  setup_util.replace_text("rails/config/database-ruby.yml", "host: .*", "host: " + args.database_host)
+  setup_util.replace_text("rails/config/database.yml", "host: .*", "host: " + args.database_host)
   try:
   try:
     subprocess.check_call("rvm ruby-2.0.0-p0 do bundle install --gemfile=Gemfile-ruby", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
     subprocess.check_call("rvm ruby-2.0.0-p0 do bundle install --gemfile=Gemfile-ruby", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
     subprocess.check_call("cp Gemfile-ruby Gemfile", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
     subprocess.check_call("cp Gemfile-ruby Gemfile", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
     subprocess.check_call("cp Gemfile-ruby.lock Gemfile.lock", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
     subprocess.check_call("cp Gemfile-ruby.lock Gemfile.lock", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
-    subprocess.check_call("cp config/database-ruby.yml config/database.yml", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/rails/config/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c " + home + "/FrameworkBenchmarks/rails/config/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
     subprocess.Popen("rvm ruby-2.0.0-p0 do bundle exec unicorn_rails -E production -c config/unicorn.rb", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
     subprocess.Popen("rvm ruby-2.0.0-p0 do bundle exec unicorn_rails -E production -c config/unicorn.rb", shell=True, cwd="rails", stderr=errfile, stdout=logfile)
     return 0
     return 0