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:
gem 'sqlite3'
to
group :development do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
Run 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 init`
`git add .`
`git commit -m "initial commit"`
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: “git@github.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”.
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”.
Environment Setup
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.
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.
Additional Resources
If you’re ever stuck during a guide, please ask your coach for help and also consult this handy cheatsheet for Ruby, Rails, the console, the Text Editor etc.
Guides
- Guide 1: Start of the guide
- Guide 2: Get to know the tools
- Guide 3: Guide to install Rails
- Guide 4: Build Your First App
- Guide 5: Style your app using HTML and CSS
- Guide 6: Add a new page to your app
- Guide 7: Add a new homepage to your app
- Guide 8: Add picture uploads
- Guide 9: Push Your App to GitHub
- Guide 10: Put your app online with one of these services:
- Fly.io
- Heroku
- DigitalOcean
- OpenShift
- Anynines
- Engine Yard (Current page!)
- Guide 11: Style the idea pages using HTML and CSS
- Guide 12: Add comments to your app
- Guide 13: Create picture thumbnails
- Guide 14: Test your app with RSpec