1

I have two (same) rails applications with nginx configs (to use with passenger):

> cat ./sites-available/app-production

server {
  listen 80;
  server_name app-development.mydomain.com;
  root /path/to/my/production/app/public;
  passenger_enabled on;
  rails_env production;
}

> cat ./sites-available/app-development

server {
  listen 80;
  server_name app-development.mydomain.com;
  root /path/to/my/development/app/public;
  passenger_enabled on;
  rails_env development;
}

And both have a ./config/mongoid.yml:

development:
  sessions:
    default:
      database: app-development
      hosts:
        - localhost:27017
      options:
        consistency: :strong
  options:

production:
  sessions:
    default:
      database: app-production
      hosts:
        - localhost:27017
      options:
        consistency: :strong
  options:

But if I start both of them I see they use the same db: I change some data in development and I see the changes in the production as well.

What are the other configurations if these are not enough. Or do I something wrong?

Update:

actually I don't see if the applications running in different environments. The debug (error) view is rendered by both, if I stop the mongodb. Looks like they both running development. How to force the passenger to run them different environments? I thought this job is done by setting the rails_env parameter

Update 2:

So if I look into mongo:

> show dbs

  app-development    0.203125GB
  local (empty)

So, the production db is not created.

Update 3:

I also executed:

rake db:create RAILS_ENV=production

in my production rails app, but still no effect.

Update 4:

as proposed here Can't force Rails into production environment via Passenger/Nginx I removed config.ru, but then I get an error from Phusion Passenger:

This application is a Rails 4 application, but it was wrongly detected as a Rails 1 or Rails 2 application. This is probably a bug in Phusion Passenger, so please report it.

Update 5:

now (after I returned the config.ru back) it became even worse - error from Phusion Passenger:

https://github.com/mongoid/mongoid.git (at master) is not checked out. Please run `bundle install` (Bundler::GitError)

I do bundle install and no effect.

Update 6:

from here is not checked out... bundle install does NOT fix help!

bundle install --deployment

now install all the gems. No Phusion Passenger errors anymore, but I get now an error from rails:

Permission denied - /path/to/my_rails_app/tmp/cache/assets/development/sprockets/37b5a12047376b10a57191a10d3af30a rails error

And I have no such file/folders behind the ./tmp/

Update 7:

Sounds like the similar problem here Permission denied in tmp . But I don't know which chown user:group I should apply? I have Phusion Passenger and nginx.

If I execute:

> sudo chown -R http:http ~/project/my_app/

I get:

chown: invalid user: `http:http'
Community
  • 1
  • 1
static
  • 8,126
  • 15
  • 63
  • 89

0 Answers0