Code Monkey home page Code Monkey logo

c9-dev-env's Introduction

Cloud9 Development Environment

This image contains a complete development environment utilizing Cloud9 IDE inside a Ubuntu container to provide everything needed to setup a development environment. It includes Cloud9, but also adds some common utilities in Ubuntu, Vim, and Git.

Concept

The idea behind this image is to build a development environment that is/can be web-based, accessible anywhere, as well as portable, ephemeral, and flexible.

Usage

docker run -d \ 
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v ~/dev-env-home/:/root \
  -v ~/workspace/:/workspace \
  -p 8000-8020:8000-8020 \
  -e C9USER=user -e C9PASS=welcome -e C9PORT=8888 \
  -p 8888:8888 \
  fluidbyte/c9-dev-env

The above does the following (line-by-line):

-v /var/run/docker.sock:/var/run/docker.sock

Mounts the host's docker socket into the container

This passes the socket through so docker in the container uses the host's socket. This preserves images and allows docker to run inside a container.

-v ~/dev-env-home/:/root

Mounts the host's ~/dev-env-home to the container's /root home Since the container doesn't maintain state, this allows you to setup your bash profile, aliases, git config, vim config, etc and retain them on the host when the container is stopped

-v ~/workspace/:/workspace

Mounts the host's ~/workspace to the /workspace volume in the container

Similar to the line above, this saves the files in the dev environment to the host so they are not lost when the container is stopped.

-p 8000-8020:8000-8020

Exposes 8000-8020 for use during development

This is optional, but setting a range of open ports allows you to utilize these, for example, when testing a running service in the dev environment.

-e C9USER=user -e C9PASS=welcome -e C9PORT=8888

Sets the C9USER, C9PASS and C9PORT settings on which Cloud9 will run

The C9USER and C9PASS will be used to authenticate, the C9PORT instructs what port the server should run over.

p 8888:8888

Exposes the port set by C9PORT making the IDE accessible locally

Makes C9 available locally at the port designated

Customization and Profile

It's important to be able to customize a development environment. By creating a mounted volume from your host to the /root profile directory, you are able to customize the shell (supports sh, bash, and zsh) with things like bash-it, sexy-bash-prompt, or oh-my-zsh.

Note: If you're using ZSH, C9 has issues with mouse scrolling in the terminal. To resolve, create a file ~/.tmux.conf =, add the following; setw -g mode-mouse on, then restart any open terminals.

Docker-In-Docker

While the image itself is ephemeral (except the home folder and workspace that are mounted) there are several options for maintaining state (i.e. not loosing things on restart). You can mount volumes to specific paths if needed though the better solution is to utilize Docker.

Tools such as Binci or Docker-Compose allow for running other needed binaries, configurations, databases, etc inside containers during development.

Security

The image follows the standard Docker convention of using the root user as the default user in the container. This is safe if you're following best practices for Docker security (i.e. not exposing services which could be hijacked). Additionally, shutting down the container when not in use is good practice.

Ultimately, if serving publicly, it's also advisable to use a tool like Let's Encrypt and nginx to setup an SSL via proxy service on your exposed instance.

c9-dev-env's People

Contributors

ksafranski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.