We recommend AWS OpsWorks without hesitation because we based our own services on it. However, for quick results, we'll show you how to deploy to Heroku. Scrivito heavily relies on a large file system for caching which Heroku doesn't offer, but you can easily provide a second-level data cache later on. This document describes how to deploy the new Rails app you previously set up while Preparing Your Project.
First, Heroku no longer needs
rails_12factor with Rails 5 but does need an environment configuration, as noted in the Heroku instructions. Also, specify the Ruby version Heroku should use. Rails 5 requires Ruby >= 2.2.0, so you might use 2.3.1, for example:
# config/environments/production.rb config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? if ENV["RAILS_LOG_TO_STDOUT"].present? logger = ActiveSupport::Logger.new(STDOUT) logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) end
In the production environment, Scrivito won't let anyone edit content in place until permissions have been configured accordingly. If you would like to test your Heroku application as soon as possible even if no such configuration exists, you can add the following section to
config/initializers/scrivito.rb. This code makes every user a system user, granting them access to in-place editing:
Scrivito.configure do |config| … config.editing_auth do |env| Scrivito::User.system_user end config.find_user do |user_id| Scrivito::User.system_user end … end
Be aware that this allows anyone to use the in-place editing interface. Use this code only temporarily for quick testing. For more information about permissions, please refer to the Introduction to Permissions.
git init git add -A git commit -m 'Initial commit'
If your project needs an additional relational database for ActiveRecord, then please add a configuration section for the production environment to the config/database.yml file. You can find the corresponding credentials in your Heroku account. Note that Heroku does not allow deployments with SQLite, but provides a free PostgreSQL database as a service instead.
Create a Rails application at Heroku and connect it to your local project:
heroku apps:create my-scrivito-app
Your Rails application requires credentials and a secret key base to be available at runtime. Since it is bad practice to commit sensitive data to a repository, Heroku's approach is to use environment variables. Scrivito itself uses this kind of configuration, too.
heroku config:set SCRIVITO_TENANT=cms_id SCRIVITO_API_KEY=your_secret_key
Now, push the master branch to Heroku to start the deployment:
git push heroku master
When the deployment ist done, please open the app in the browser, using the URL that was output by the deploy command, e.g.
Use a second-level data cache to compensate for Heroku's volatile file system.
If you're new to Scrivito, you might walk the Scrivito Landscape.