Configuring cloned workspace software



I have a project which requires a number of tools to be installed:

  • PHP 7.0
  • NodeJS
  • Gulp
  • Composer
  • etc

Plus there’s a custom server config required to redirect all requests to the index.php

Currently in Cloud9 if I go to “repositories” and click “clone to edit” to make a copy of this code base, I then have to spend 15-20 minutes configuring everything – upgrading PHP to version 7.0, installing NodeJS, installing Composer, modifying the Apache config, etc.

Is there a way to have Cloud9 auto-configure this stuff? Perhaps a file I can put in my repository that Cloud9 will see when it’s cloned and go “oh, I should run these steps”?

Alternatively, I’m not opposed to a single command to get everything up and running. For this reason while I wait on responses I’m actively looking into Docker to see if I can just do a quick “docker init” or something and have all my software properly configured.


Looking into Docker, while it might work for running the code (set up a Docker image with PHP 7.0 installed and any necessary modules), I don’t believe it’s ideal for editing the code. I don’t want gulp to run inside a container, I want to run gulp on the actual files that are under source control in my workspace.

So I looked into creating a script that I could run when a workspace is first created, but I ran into a small issue. In order to run “npm install”, I need about 2 gigabytes of memory (after running “npm install” I can lower it back down to 512 MB safely). Rather than wait through 20 minutes of loading bars and text just to have it crash and need to diagnose the issue, I’d like to have the script simply exit early and say “Please resize your workspace before running this”. However all utilities I’ve tried to read the amount of RAM available to me seem to return the total RAM available to the server, not the RAM available to my little workspace. I’m getting something like 53 gigabytes of RAM when I run “free” or check “/proc/meminfo”

Is there anywhere (maybe in the .c9 folder) where I can check (and maybe even manipulate) the values for the workspace config?


For development purposes it seems C9 has me mostly set up. Upon creating a workspace it came with NodeJS, NPM, and Composer installed – and after running “npm install” I was able to use Gulp, as well.

For running the code to see if it works, I wanted to run it within a Docker container (since this is how it will run in production, so the source code will include a Dockerfile). This meant I needed to install Docker.

I went through Docker’s documentation and performed the following steps:

curl -fsSL | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"
sudo apt-get update

That all worked with no issue. Then I tried:

sudo apt-get install docker-ce

This gave an error. Namely:

Setting up aapparmor (2.10.95-0ubuntu2.6~14.04.1) ...
 * Starting AppArmor profiles
 * Mounting securityfs on /sys/kernel/security...
mount: permissions denied!!

Is there a way to get Docker working as a runner for a C9 workspace?


Unfortunately, Docker cannot be run inside another Docker container. Since each Cloud9 workspace is its own Docker container, you would not be able to run Docker inside of it without elevated permissions which Cloud9 will not provide as they would allow dangerous levels of access to the host. So, Docker isn’t really a possibility on hosted workspaces. With that said, it sounds like you’d benefit from just getting a cheap VPS and using SSH workspaces. The VPS would enable you to install the software you want globally, then set up an SSH workspace to connect to it. When you create a new SSH workspace and point it at that server, it would be preconfigured with everything already. You’d also be able to work with Docker, since VPS’ aren’t Docker containers.