Starting your 2nd app on Cloud9

For all you beginners out there, I hope this helps. Often, we use a tutorial to do our first app, and then we want to create a second app and aren’t sure how to go about it. Here is a step-by-step to create your second app on Cloud9.

  1. Make sure you aren’t in your first app folder. In your terminal, run:

$ sudo service postgresql start

For me, it looked like this:

tristen3:~/workspace $ sudo service postgresql start

2. Create your new app by running the following, with “nameofyournewapp” being the name of your new app, different from the first:

$ rails new nameofyournewapp -d postgresql

3. Get into your new app directory by running:

$ cd nameofyournewapp

4. Open the file config/database.yml

(My new app’s name is ralph, because it is about my cat, Ralph.)

add lines 23, 24, and 25 like I have here:

Hash out line 87 and 88 like I have done here:

Save it.

5. Make your database by running:

$ rake db:create

6. Start your server by running:

$ rails s -b $IP -p $PORT

7. This will not stop and return the dollar sign if your terminal starts running correctly, so you must open a second terminal and get into your newapp directory by running:

$ cd nameofyournewapp

8. Make sure you are up and running! Click on “preview” and then “preview running application” like so:

And you should see this and let out a good sigh, because you are almost there:

9. Go back into your new terminal and let’s make the first git commit:

$ git init

$ git add — all ***The long dash here is really two dashes, but medium keeps trying to combine them into one long dash, but really it is “- -” with no space between the dashes.

$ git commit -am “Initial commit”

10. Set up GIT: This is less intensive than the first go around. Go to your github, log in and click the green “new repository” button.

  • Name it with the name of your new app, and leave “public” checked.
  • Leave the “initialize this repository with a README” UNCHECKED
  • click “create repository”
  • Click on the button at the top “SSH”. Scroll down to instructions for “Push an existing repository from the command line”. Copy and paste both of the lines in the box one at a time into the terminal. Something like $ git remote add… and enter, $ is returned and $ git push…. and enter
  • Refresh the github page and notice the folders appear for your initial commit.

11. Deploy to heroku: run in the terminal, with your app name and your name

$ heroku create appname-firstname-lastname

$ git push heroku master

Okay, there ya go. Hopefully I didn’t miss anything and this saves you time. I find myself sweating and piecing together different tutorials to set up a new app with Cloud9. Coming down after finishing an app and trying to start a new one, I am looking at Cloud9 like “How the heck did I do that, it feels like years ago and I am drawing a blank”. It is so easy, but if you forget something, you gotta delete everything and try again. Hope this saves someone some stress and time!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.