Run Cloud9 workspaces locally

A very quick setup guide

Assuming that you followed the steps in this guide and downloaded the workspaces from Cloud9 dashboard to your local machine. Unzip .tar into some ~/c9/downloaded-files folder.

Run the command below in your terminal to start the container:

In the preceding command:

➜  ~ docker psCONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                                                            NAMES8a6f8e8490b4        cloud9/ws-nodejs    "/bin/sh -c '/bin/ba…"   23 seconds ago      Up 22 seconds       0.0.0.0:5050->5050/tcp, 0.0.0.0:9090->8080/tcp, 0.0.0.0:9091->8081/tcp, 0.0.0.0:9092->8082/tcp   myc9ws2➜  ~ docker exec -it myc9ws /bin/bash

In the preceding command:

STEP 1: DOWNLOAD, INSTALL, AND RUN CLOUD9 CORE

In the interactive terminal, run the following commands, one at a time, to download, install, and then run Cloud9 Core inside of the container.

rm -rf /home/ubuntu/workspace/*
chown -R ubuntu:ubuntu /home/ubuntu
curl -sL https://deb.nodesource.com/setup_10.x | bash - && apt-get install nodejs -y
export USER=ubuntu
export C9_PROJECT=c9-offline
export C9_USER=ubuntu
export C9_HOSTNAME=$IP
export C9_PORT=$PORT
export IDE_OFFLINE=1
alias c9=/var/c9sdk/bin/c9 > /etc/profile.d/offline.sh
su ubuntu
cd /var
sudo mkdir c9sdk
sudo chown ubuntu:ubuntu c9sdk
git clone https://github.com/c9/core.git c9sdk
cd c9sdk
scripts/install-sdk.sh
sudo chown -R ubuntu:ubuntu /home/ubuntu/workspace/
sudo chown -R ubuntu:ubuntu /home/ubuntu/.c9/
sudo apt-get install -y ufw
sudo ufw allow 5050
sudo ufw allow 8080
sudo ufw allow 8081
sudo ufw allow 8082
node server.js -w /home/ubuntu/workspace/ -a : -l 0.0.0.0 -p 5050

stop the server (ctrl+C), and install mongodb:

:/var/c9sdk (master) $ sudo apt-get install -y mongodb-org

run the server:

:/var/c9sdk (master) $ node server.js -w /home/ubuntu/workspace/ -a : -l 0.0.0.0 -p 5050

this will run the Cloud9 IDE, which is accessible in the browser through localhost: 5050.

STEP 2: ACCESS YOUR APP IN THE BROWSER

Now in the IDE in the terminal you can access your workspace contents:

:~/workspace/home/workspace/myApp $ node app.js

This will run your app and it will be accessible in the browser through localhost: 9090.

Some Useful commands for reviving the connection to mongodb

mongod — bind_ip=$IP — nojournal
mongod — repair

Resources used for this post:

Everything is unknown until it’s known. Self-learner.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store