0

By referring "Production deployment" section in https://gist.github.com/arjendk/6080388

I am trying to setup CartoDB in production environment using Apache with Passenger module. I setup proper startup scripts for CartoDB Windshaft, CartoDB SQL API apps and Redis. I have created a production database with rake.

Installed passenger using below commands:

yum install passenger
passenger-install-apache2-module

Then followed other steps from above document, and in ssl virtual host have the following content.

<VirtualHost *:443>

    ##This for central domain
    ServerName cartodb.mydomain.com  
    ##This for all subdomains(users)
    ServerAlias *.cartodb.mydomain.com 
    # !!! Be sure to point DocumentRoot to 'public'!
    DocumentRoot %SOME_LOCATION%/cartodb20/public
    RailsEnv production
    PassengerSpawnMethod direct

    #TODO later: SSL options

    SSLEngine on

    SSLCertificateFile %SOME_LOCATION%/localhost.crt
    SSLCertificateKeyFile %SOME_LOCATION%/localhost.key


 <Directory %SOME_LOCATION%/cartodb20/public>
        # This relaxes Apache security settings.
        AllowOverride all
        # MultiViews must be turned off.
        Options -MultiViews
    </Directory>
</VirtualHost>

In CartoDB Windshaft/config/environment/production.js changed following

host: '',
,user_from_host: '^(.*)\\.cartodb\\.mydomain\\.com$'
,sqlapi: {
        protocol: 'https',
        domain: 'cartodb.mydomain.com',

In CartoDB SQL API/config/environment/production.js changed following

module.exports.user_from_host = '^(.*)\\.cartodb\\.mydomain\\.com$';
module.exports.node_host    = '';

Started CartoDB Windshaft, CartoDB SQL API apps, Redis using above setup scripts and resque manually.

When I tried accessing through cartodb.mydomain.com or prod.cartodb.mydomain.com,

I got passenger error message saying I have to bundle install --deployment, I run this inside *%SOME_LOCATION%/cartodb20*

Now when I hit cartodb.mydomain.com or prod.cartodb.mydomain.com, I get Error 500 page, that too non of the scripts in the page loaded.

Below the error I noticed in cartodb20/log/production.log

Processing by SessionsController#new as HTML
  Rendered sessions/new.html.erb within layouts/front_layout (101.4ms)
Completed 500 Internal Server Error in 279ms
[Rollbar] Reporting exception: cdb.js isn't precompiled
[Rollbar] Scheduling payload
[Rollbar] Sending payload
[Rollbar] Got unexpected status code from Rollbar api: 401
[Rollbar] Response: {
  "err": 1,
  "message": "unauthorized"
}
[Rollbar] Details: https://rollbar.com/instance/uuid?uuid=e3df1f34-deda-4f20-9c7f-0e9f90ef1e62 (only available if report was successful)
ActionView::Template::Error (cdb.js isn't precompiled):
    1: <%= content_for(:js) do %>
    2:   <%= javascript_include_tag :cdb, :application, :login %>
    3: <% end %>
    4:
    5: <section class="sessions shadow">
  app/helpers/application_helper.rb:97:in `javascript_include_tag'
  app/views/sessions/new.html.erb:2:in `block in _app_views_sessions_new_html_erb__1047976219462445650_23950283400360'
  app/views/sessions/new.html.erb:1:in `_app_views_sessions_new_html_erb__1047976219462445650_23950283400360'

I couldn't understand this issue, could someone help me on this? Thanks in advance.

3

This is due to assets not being precompiled, which is needed on the Production environment. You can try to precompile them by executing:

RAILS_ENV=production bundle exec rake assets:precompile

on the Rails root.

  • Thanks for the response. I run the above command inside %SOME_PATH%cartodb20/ got following error AssetSync: using /opt/cartodb2.0/cartodb20/config/initializers/asset_sync.rb rake aborted! Fog provider can't be blank, Fog directory can't be blank Full log is here – Prabu Jan 9 '14 at 3:25
  • Even though it showed error, asserts folder has been created with lots of file in it. After that changed a line in config/environments/production.rb, server_static_assets to true now I could login. Still I have problem with uploading for which I will start a fresh question. – Prabu Jan 9 '14 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.