rubyenvironmentproductionpadrino

How to run Padrino project in production mode?


I am making a backend api using Padrino ruby framework. And I would like to know how to run project on production mode. Now I run the server with this command.

padrino s

It is running on development mode. I tried this one.

padrino s RACK_ENV='production'

but it make erros. Thanks.


Solution

  • The flag to specify environment in padrino is -e. So the command would be:

    padrino start -e production

    or

    RACK_ENV=production padrino s

    Notice how in your case RACK_ENV='production' has quotes around 'production'. You should remove them and try.

    From the padrino documentation, other possible combinations are:

    # starts the app server (non-daemonized)
    $ padrino start
    # starts the app server (daemonized) with given port, environment and adapter
    $ padrino start -d -p 3000 -e development -a thin
    
    # Stops a daemonized app server
    $ padrino stop
    
    # Bootup the Padrino console (irb)
    $ padrino console
    
    # Run/List tasks
    $ padrino rake
    
    # Run piece of code in the context of Padrino (with given environment)
    $ padrino runner 'puts Padrino.env' -e development
    
    # Run Ruby file in the context of Padrino
    $ padrino r script/my_script.rb