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!

On 27 February 2012 15:49, Paul Na [email protected] wrote:

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.

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 modified the Gemfile and did the bundle install did work but 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 L. wrote in post #1049063:

On 27 February 2012 15:49, Paul Na [email protected] wrote:

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.

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

On 27 February 2012 16:22, Paul Na [email protected] wrote:

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

Sorry,

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

Thanks

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 L. wrote in post #1049071:

On 27 February 2012 16:22, Paul Na [email protected] wrote:

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

On Mon, Feb 27, 2012 at 5:49 PM, Paul Na [email protected] wrote:

Oh ok thanks. I am using mysql server 5 and trying db:create runs but
don’t create the db’s

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

On Mon, Feb 27, 2012 at 6:25 PM, Paul Na [email protected] wrote:

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 Y., 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 `’

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

Peter V. wrote in post #1049083:

On Mon, Feb 27, 2012 at 6:25 PM, Paul Na [email protected] wrote:

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 Y., 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 `’

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 be viewable to general users, but i completely
understand your point. I do know my way around linux anyway i have a
security mind as well but it’s just getting the thing setup and then 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 0.9 broken rails,
but this was not the case as i had a higher version than that.

Many thanks for all the help

Paul

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 :


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:migrate 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

Many Thanks

Paul

Peter V. wrote in post #1049079:

On Mon, Feb 27, 2012 at 5:49 PM, Paul Na [email protected] wrote:

Oh ok thanks. I am using mysql server 5 and trying db:create runs but
don’t create the db’s

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