Projects‎ > ‎

Info Files

SimpleDeployr will write a few files to your Rails app that you can use if required.

RAILS_ROOT/config/instance_info.yml

This file contains information about the EC2 instance.

instance_id: {instance_id}
public_dns: {public_host_of_app}
private_dns: {internal_ec2_host}
hostname: {hostname}
launch_date: {datetime of launch in iso8601 format}

RAILS_ROOT/config/deploy_info.yml

revision: {revision_number}
deploy_date: {datetime of last deployment in iso8601 format}

RAILS_ROOT/config/aws_config.yml

aws:
    access_key: {aws_access_key}
    secret_key: {aws_secret_key}


RAILS_ROOT/config/db_info.yml

If you enabled MySQL for your project, then the db_info.yml file will be written.

database:
    dbname: {database name}
    dbuser: {username}
    password: {password}


You can easily load these into your application by putting these lines into your production.rb file:

DEPLOY_INFO = YAML.load_file(File.join(Rails.root, "config", "deploy_info.yml"))  if File.exists?(File.join(Rails.root, "config", "deploy_info.yml"))
INSTANCE_INFO = YAML.load_file(File.join(Rails.root, "config", "instance_info.yml")) if File.exists?(File.join(Rails.root, "config", "instance_info.yml"))
AWS_CONFIG = YAML.load_file(File.join(Rails.root, "config", "aws_config.yml")) if File.exists?(File.join(Rails.root, "config", "aws_config.yml"))

Then you can use them throughout, for example if you want to show some information in the footer of your application:

<% if defined?(RELEASE_INFO) %>
   <p class="small revision"><%= INSTANCE_INFO["instance_id"] %>: Revision <%= RELEASE_INFO["revision"][0..5] %> built on <%= RELEASE_INFO["deploy_date"] %></p>
<% end %>