Bit of a issue with creating a new app and running it

HI all,

I have just setup the ROR environment on a vps, but once i created the
app and run rails s or db:create after modifying the database.yml it
keeps on appearing with the "Could not find gem sqlite3" etc message
which i know this as it's not install as i am using mysql. What else
have i got to do other than modifying the database.yml as to me it's
still looking for the sqlite3 to use.

Any help will be great.

Thanks!

Did you remember to change it to mysql2 in Gemfile, and to run bundle install.

If you did then post database.yml, Gemfile and the full error and trace.

Colin

Hi colin,

Thanks the modified the Gemfile and did the bundle install and now its
saying that it can not find the javascript runtime?

p.s does it have to be mysql2 or 3, as i have just put mysql?

Thanks

Colin Law wrote in post #1049063:

Sorry,

I just used and installed execjs and therubyracer and its working now.

Thanks

Hi colin,

Thanks the modified the Gemfile and did the bundle install and now its
saying that it can not find the javascript runtime?

Add to Gemfile
gem 'execjs'
gem 'therubyracer'

p.s does it have to be mysql2 or 3, as i have just put mysql?

mysql2 works for me.

Colin

Oh ok thanks. I am using mysql server 5 and trying db:create runs but
don't create the db's plus when opening up port 3000 on the browser it
says

"ActiveRecord::ConnectionNotEstablished"

Paul

Colin Law wrote in post #1049071:

In which environment are you doing this (development or production) ?

Is this VPS intended for production or development?

What is the output you get from

$ rake db:create

$ rake db:migrate

HTH,

Peter

Hi Peter,

Its going to be both but once it's working when i have made the app in
will go from development to production.

the output of db:create is :

Hi Peter,

Its going to be both but once it’s working when i have made the app in

will go from development to production.

I would not advise to do the learning phase in development mode on a VPS
if it is exposed to the Internet. Also, setting up all aspects of the VPS
(including security) yourself, while learning Rails is not trivial. Maybe you are

better helped by a hosting company with good service or running production
on PaaS providers (like Heroku, Engine Yard, etc.).

the output of db:create is :


rake aborted!

uninitialized constant Rake::DSL

/usr/lib/ruby/1.9.1/rake.rb:2482:in `const_missing’

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:8:in

`class:TaskLib

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:6:in

`module:Rake

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:3:in

`<top (required)>’

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb:4:in

`require’

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb:4:in

`<top (required)>’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/test_unit/testing.rake:2:in

`require’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/test_unit/testing.rake:2:in

`<top (required)>’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/test_unit/railtie.rb:12:in

`load’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/test_unit/railtie.rb:12:in

`block in class:TestUnitRailtie

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/railtie.rb:184:in

`instance_exec’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/railtie.rb:184:in

`block in load_tasks’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/railtie.rb:184:in

`each’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/railtie.rb:184:in

`load_tasks’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:423:in

`block in load_tasks’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/application/railties.rb:8:in

`each’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/application/railties.rb:8:in

`all’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:423:in

`load_tasks’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/application.rb:145:in

`load_tasks’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in

`method_missing’

/home/thecssninja.net/rails_app/ninja/Rakefile:7:in `<top (required)>’

/usr/lib/ruby/1.9.1/rake.rb:2373:in `load’

/usr/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile’

/usr/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile’

/usr/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling’

/usr/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile’

/usr/lib/ruby/1.9.1/rake.rb:1991:in `run’

/usr/bin/rake:31:in `’


and the output for db:mirgrate is :


rake aborted!

uninitialized constant Rake::DSL

/usr/lib/ruby/1.9.1/rake.rb:2482:in `const_missing’

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:8:in

`class:TaskLib

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:6:in

`module:Rake

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:3:in

`<top (required)>’

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb:4:in

`require’

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb:4:in

`<top (required)>’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/test_unit/testing.rake:2:in

`require’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/test_unit/testing.rake:2:in

`<top (required)>’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/test_unit/railtie.rb:12:in

`load’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/test_unit/railtie.rb:12:in

`block in class:TestUnitRailtie

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/railtie.rb:184:in

`instance_exec’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/railtie.rb:184:in

`block in load_tasks’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/railtie.rb:184:in

`each’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/railtie.rb:184:in

`load_tasks’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:423:in

`block in load_tasks’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/application/railties.rb:8:in

`each’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/application/railties.rb:8:in

`all’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:423:in

`load_tasks’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/application.rb:145:in

`load_tasks’

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in

`method_missing’

/home/thecssninja.net/rails_app/ninja/Rakefile:7:in `<top (required)>’

/usr/lib/ruby/1.9.1/rake.rb:2373:in `load’

/usr/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile’

/usr/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile’

/usr/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling’

/usr/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile’

/usr/lib/ruby/1.9.1/rake.rb:1991:in `run’

/usr/bin/rake:31:in `’


Now i can see a issue but i don’t know why its happening, plus i have

tried mysql, mysql2 still don’t work

Here is the database.yml file as well.


SQLite version 3.x

gem install sqlite3

Ensure the SQLite 3 gem is defined in your Gemfile

gem ‘sqlite3’

development:

  host: localhost

adapter: mysql2

encoding: utf8

database: development

username: root

password:

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.

test:

  host: localhost

adapter: mysql2

encoding: utf8

database: testing

usrename: root

password:

pool: 5

timeout: 5000

production:

  host: localhost

adapter: mysql2

encoding: utf8

database: production

username: root

password:

pool: 5

timeout: 5000

Are these number of spaces exact? The .yml format
needs an exact number of 2 spaces (no tabs) before
the keys like ‘host’, ‘adapter’ etc. It looks like the

number of space before the keys is not exactly 2 ?

HTH,

Peter

Peter Vandenabeele wrote in post #1049083:

Hi Peter,

Its going to be both but once it's working when i have made the app in
will go from development to production.

I would not advise to do the learning phase in development mode on a VPS
if it is exposed to the Internet. Also, setting up all aspects of the
VPS
(including security) yourself, while learning Rails is not trivial.
Maybe
you are
better helped by a hosting company with good service or running
production
on PaaS providers (like Heroku, Engine Yard, etc.).

the output of db:create is :

`<top (required)>'

`each'
/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:423:in
/usr/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
uninitialized constant Rake::DSL
`<top (required)>'

/usr/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/test_unit/railtie.rb:12:in

`block in load_tasks'
`load_tasks'
/usr/bin/rake:31:in `<main>'
#
timeout: 5000
password:
pool: 5
timeout: 5000

Are these number of spaces exact? The .yml format
needs an exact number of 2 spaces (no tabs) before
the keys like 'host', 'adapter' etc. It looks like the
number of space before the keys is not exactly 2 ?

HTH,

Peter

Hi Peter,

No the development won't to viewable to general users, but i completely
understand your point. I do know my way around linux anyway i have
security mind as well but it just getting to setup and i can fine tune
everything after.

I have got it working after getting the above messages i added the
"require 'rake/dsl_definition'" before the require 'rake' in the rake
file and after a few other error i got it working and as you suggested
the space issue i sorted them and when i db:create it works great.

p.s i did found something before finding to put the require
'rake/dsl_definition ' that it was because the rake 9.0 broken rails,
but this was not the case as i had a higher version than that.

Many thanks for all the help

Paul