Ember CLI Deploy Rack
A Rack package to launch your Ember.js application into the Cloud.
Summary
Ember CLI Deploy Rack can be used to serve an Ember CLI application deployed with the help of Ember CLI Deploy and ember-deploy-redis.
Basically, it is a Sinatra application, which connects to Redis and returns the uploaded index.html.
You can deploy your application to production, test it out by passing an revision
parameter with the revision you want
to test and activate when you feel confident that everything is working as expected.
For further information see Ember CLI Deploy.
Prerequisites
Installation
Create a Gemfile
#!/usr/bin/env bundle source 'https://rubygems.org' gem 'ember-cli-deploy-rack', require: false
Run
bundle
to install all dependencies with Bundler
Usage
Create a Rack configuration
#!/usr/bin/env rackup # This file is used by Rack-based servers to start the application. require 'bundler/setup' require 'ember/cli/deploy/rack' run Ember::CLI::Deploy::Rack::Engine
Run the engine with
rackup
or your favorite Ruby Webserver
Configuration
Ember CLI Deploy Rack can be configured in various ways:
Via settings
engine = Ember::CLI::Deploy::Rack::Engine.new # === Settings ==== # engine.settings.set :root, Dir.pwd # engine.settings.set :key_prefix, 'ember-cli-deploy-rack:index' # engine.settings.set :active_content_suffix, 'current-content' # engine.settings.set :revision, { regexp: '^[0-9a-f]{32}$' } # engine.settings.set :redis, { host: '127.0.0.1', ... } # engine.settings.set :redis_client, proc { Redis.new settings.redis } # engine.settings.set :debug, false # ... # === Logging ==== # log_dir = File.expand_path 'log' # # if File.directory? log_dir # log_file = File.expand_path "#{engine.settings.environment}.log", log_dir # # logger = Logger.new log_file, File::WRONLY | File::APPEND | File::CREAT # logger.level = Logger::ERROR # # engine.settings.set :logger, logger # end run engine
Via YAML configuration file
Just create a configuration file
config/settings.yml
and adjust properly, for an example see resources/config/settings.yml.
Options
Key Prefix
The prefix to be used for the Redis key under which file will be uploaded to Redis. The Redis key will be a combination
of the key_prefix
and the revision_key
. Typically this is the project.name
property from the deployment context
and :index
at the end. By default this option will be ember-cli-deploy-rack:index
.
For more details, see https://github.com/ember-cli-deploy/ember-cli-deploy-redis#keyprefix.
Active Content Suffix
The suffix to be used for the Redis key under which the activated revision content will be stored in Redis. By default
this option will be current-content
. This makes the default activated revision in Redis looks like: The project.name
property from the deployment and :index:current-content
at the end.
For more details, see https://github.com/ember-cli-deploy/ember-cli-deploy-redis#activecontentsuffix.
Revision
Regexp
The regular expression to check the revision. By default this option will be ^[0-9a-f]{32}$
.
Redis
The options for the Redis client. For available options see Redis::Client::DEFAULTS.
Debug
If enabled, debug information can be viewed under /debug
. By default this option will be false
.
Development
Run specs with RSpec
Run rspec
.
or via Guard:
$ guard -g spec
See Test Coverage
Run COVERAGE=true rspec
.
Run RuboCop
Run rubocop
.
To run all specs and RuboCop altogether, run rake
.
Rack
$ rackup
Thin
$ thin -R config.ru -d start
$ thin stop
Bug Reports
GitHub Issues are used for managing bug reports and feature requests. If you run into issues, please search the issues and submit new problems here.
Versioning
This library aims to adhere to Semantic Versioning 2.0.0. Violations of this scheme should be reported as bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, that version should be immediately yanked and / or a new version should be immediately released that restores compatibility.
License
Ember CLI Deploy Rack is released under the MIT License (MIT), see LICENSE.