Sample Rails App with MySQL for App42 PaaS Platform
- Setup infrastructure for required environment
- Create service
- Deploy a Ruby on Rails application
$ app42 setupInfra
Gemfile(app_root_dir/Gemfile)
If you are use a different database in development. Create or change the production group to include mysql, Ensure the MYSQL gem is defined in your Gemfile
group :production do
gem 'mysql2'
end
config
In config/environments/production.rb change
config.assets.compile = false => config.assets.compile = true
and
config.serve_static_assets = false => config.serve_static_assets = true
and uncomment below configuration.
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
$ app42 createService
DB Configure for Production environment (application_root_dir/config/database.yml)
adapter: mysql2
host: <host>
port: <port>
database: <database name>
username: <user_name>
password: '<password>'
$ app42 deploy
$ app42 appInfo --app AppName
Visit your application: