Put Your App Online With Engine Yard
Created by Mary Jenn, @mfjenn
Ensure You’re Using PostGres for Your Database
You’ll need to get your database to work on Engine Yard, which uses a different database than the Rails default. Please change the following in the Gemfile:
group :development do gem 'sqlite3' end group :production do gem 'pg' end
bundle install --without production to setup your dependencies.
Version Control Systems
You need to add your app to your Git repository. You can do this by running the following in the terminal:
`git add .`
`git commit -m "initial commit"`
COACH: This would be a good time to talk about version control systems and git.
Be Sure to Have a Rails Application in a Repository on Github
You will need to have a GitHub account and a repo we can pull an app from. Follow these directions on GitHub to create a repo and push your app to it. If you do not have a working Rails application, you can fork Engine Yard’s sample todo app to your own repo. A coach can walk you through this if you need help.
Sign up for a Free Trial Engine Yard Account
Go to Engine Yard’s Website and click on “GET STARTED FREE” to sign up for your Free 500 Hour Trial. The sign up will send you a confirmation email, so go check your email, click on the link and sign in to your account. Click on the link under “Your available applications” that says “Engine Yard Cloud”. This will take you to your dashboard.
Create your Engine Yard Cloud account
Choose a name for your account. We suggest picking something relevant to who you are, either as a developer, or as an organization if you will be having collaborators. Click the button “Start Trial”
Feel free to explore what is in the drop downs, but let’s go with the defaults for now, since they are in line with a basic Rails app.
In the box labeled “Git Repository URI”, paste the URI from your Github repo. Be sure to use the URI from the SSH version of your application. HINT: The format should be the same as the placeholder text on your Engine Yard application page (or like this: “email@example.com:mfjenn/blogotron.git”)
Putting Your Deploy Key in Place
You should now be on a page that says “Allow Engine Yard access to private repository”.
- Copy the block of text in the box and go to your GitHub settings page.
- Go to the SSH page
- Click on the button that says “add a key”
- Paste the block of text from your Engine Yard page here. Save it
- Go back to your Engine Yard Page and Click the button that says, “My deploy key is in place”.
COACH: Talk about the difference between private and public repos and when to use either.
Creating and Configuring Your Environment
Once you click the “My deploy key is in place” button, you will be taken to a page that says, “Create New Environment for (Your Account Name) App”. It is here where we will configure your application. Feel free to explore all the options in the drop downs, but let’s use the defaults for now. You do not need to set a domain name.
- Click the button that says, “Create Environment”.
On this page, let’s select the staging configuration.
- Click “Boot This Configuration”. You will go to a new page where you see several status bars moving. Our Platform is provisioning your instances. We need to wait till these turn to green dots. This usually takes about 10 minutes, so does anyone need to take a break? It’s a good time to go grab some water or a coffee.
COACH: Talk about Staging vs. Production, and why it’s important to have replicas. Talk about what is a master & Slave. How does Engine Yard’s Failover work? Why is that important?
Deploying Your Application
- Once all of the lights are green, click “Deploy”.
- Once you see the phrase “YOUR NAME successfully deployed HEAD” you will know it has been deployed! Congratulations!
- Click on the link that says “View your application” to visit your application online.
- If you get a red notification that your deploy failed, we just have some debugging to do. Raise your hand and a coach can come over to to help.
Stopping Your Instances to Save Your Hours
Once you’ve got your app up & running, be sure to click the “stop” button to stop the instances so that your don’t burn through all of your hours. You can always start them again.
- Handy cheatsheet for Ruby, Rails, console etc.
- Guide 1: Guide to install Rails
- Guide 2: Build Your First App
- Guide 3: Push Your App to GitHub
- Guide 4: Put your app online with…
- Guide 5: Allow Comments on Your App
- Guide 6: Add design using HTML & CSS
- Guide 7: Create thumbnails with Carrierwave
- Guide 8: Add Authentication (user accounts) with Devise
- Guide 9: Add Profile Pics with Gravatar
- Guide 10: Improve your design with HTML and CSS
- Guide 11: Continuous Deployment
- Guide 12: Build a voting app in Sinatra
- Guide 13: Build a diary app in Ruby on Rails
- Guide 14: Add a back-end to your app (admin pages)
- Guide 15: Go through additional explanations for the App