Get Set for Basejumps
Follow Quincy on Quora:
Follow us on Twitch: twitch.tv/freecodecamp
Follow us on twitter:
Like us on Facebook:
Star us on GitHub:
Objective: Get the MEAN stack running on Cloud 9, push your code to GitHub, and deploy it to Heroku.
We’ll build our Basejumps on Cloud 9, a powerful online code editor with a full Ubuntu Linux workspace, all running in the cloud.
If you don’t already have Cloud 9 account, create one now at
Now let’s get your development environment ready for a new Angular-Fullstack application provided by Yeoman.
Open up and sign in to your account.
Give your workspace a name.
Choose Node.js in the selection area below the name field.
Click the Create button.
Click the “Start Editing” button.
In the lower right hand corner you should see a terminal window. In this window use the following commands. You don’t need to know what these mean at this point.
Never run this command on your local machine. But in your Cloud 9 terminal window, run: rm -rf * && echo “export NODE_PATH=$NODE_PATH:/home/ubuntu/.nvm/v0.10.35/lib/node_modules” (less than symbol)(less than symbol) ~/.bashrc && source ~/.bashrc && npm install -g yo grunt grunt-cli generator-angular-fullstack && yo angular-fullstack
To finish the installation run the commands: bower install && npm install
To start MongoDB, run the following commands in your terminal: mkdir data && echo ‘mongod –bind_ip=$IP –dbpath=data –nojournal –rest “$@”‘ (less than symbol) mongod && chmod a+x mongod && ./mongod
You will want to open up a new terminal to work from by clicking on the + icon and select New Terminal
Start the application by running the following command in your new terminal window: grunt serve
Wait for the following message to appear: xdg-open: no method available for opening ‘ . Now you can open the internal Cloud9 browser. To launch the browser select Preview in the toolbar then select the dropdown option Preview Running Application.
Turn the folder in which your application is running into a Git repository by running the following commands: git init && git add . && git commit -am ‘initial commit’.
Now we need to add your GitHub SSH key to c9.io. Click the “Add-on Services” button in the lower left of your C9 dashboard. Click “activate” next to the GitHub icon.
A pop up will appear. Allow access to your account.
While still on the dashboard, under “Account Settings”, click the link for “Show your SSH key”. Copy the key to you clipboard.
Sign in to and navigate to the GitHub SSH settings page. Click the “Add SSH Key”. Give your key the title “cloud 9”. Paste your SSH Key into the “Key” box, then click “Add Key”.
Create a new GitHub repository by and clicking on the + button next to your username in the upper-right hand side of your screen, then selecting “New Repository”.
Enter a project name, then click the “Create Repository” button.
Find the “…or push an existing repository from the command line” section and click the Copy to Clipboard button beside it.
Paste the commands from your clipboard into the Cloud9 terminal prompt. This will push your changes to your repository on Cloud 9 up to GitHub.
Check back on your GitHub profile to verify the changes were successfully pushed up to GitHub.
Now let’s push your code to Heroku. If you don’t already have a Heroku account, create one at You shouldn’t be charged for anything, but you will need to add your credit card information to your Heroku before you will be able to use Heroku’s free MongoLab add on.
Before you publish to Heroku, you should free up as much memory as possible on Cloud9. In each of the Cloud9 terminal prompt tabs where MongoDB and Grunt are running, press the control + c hotkey to shut down these processes.
Run the following command in a Cloud9 terminal prompt tab: npm install grunt-contrib-imagemin –save-dev && npm install –save-dev && heroku login. At this point, the terminal will prompt you to log in to Heroku from the command line.
Now run yo angular-fullstack:heroku. You can choose a name for your Heroku project, or Heroku will create a random one for you. You can choose whether you want to deploy to servers the US or the EU.
Set the config flag for your Heroku environment and add MongoLab for your MongoDB instance by running the following command: cd ~/workspace/dist && heroku config:set NODE_ENV=production && heroku addons:add mongolab.
Xem thêm bài viết khác: https://ftlinuxcourse.com/cong-nghe