Eclipse Che Logo

Most developers use an integrated development environment (IDE) to build and manage their products. Eclipse Che is a developer workspace server and cloud IDE that allows a team to share development space over the network in a system entirely encapsulated in Docker images. In this tutorial, we deploy Eclipse Che to a CenturyLink Cloud virtual server and prepare a Che workspace to deploy applications to CenturyLink AppFog.

Tools Used

CenturyLink Cloud Compute servers are high-performance cloud servers. These enterprise-grade virtual machines are easy to deploy and manage from the CenturyLink Cloud Control Portal and via our powerful API.

CenturyLink AppFog is our Platform-as-a-Service (PaaS) offering based on Cloud Foundry. It allows you to easily host cloud-native applications without worrying about provisioning and maintaining servers or separate services. AppFog applications deploy quickly and scale automatically while having access to the full range of CenturyLink Cloud products.

Eclipse Che is an Open Source developer workspace server and cloud-hosted IDE with RESTful workspaces. It provides a fully-featured, remote, multi-user platform that encapsulates projects and workspaces in Docker containers.

Before We Start

If you don’t have a CenturyLink Cloud account yet, head over to our website and sign up for a free trial. You’ll need it to access CenturyLink Cloud products, such as virtual servers and AppFog.

Deploy a Virtual Server with Docker

Our first step is to deploy a new CenturyLink Cloud virtual server. Follow the steps below.

  1. Log into the CenturyLink Cloud Control Portal.
  2. From the Navigation Menu, click Infrastructure > Servers. Navigation Meny
  3. Select a region for your new server and click create > server.
  4. Fill out the form for your new server. Note: From the operating system drop-down, be sure to select Ubuntu 14 | 64-bit.
  5. After your new server is provisioned, return to the server list. Go to the Control Portal.
  6. From the Navigation Menu, click Infrastructure > Servers.
  7. Locate your new server in the list and click on it.
  8. On the right-side under SERVER INFO, click add public ip.
  9. Check the boxes to open ports HTTP (8080) and SSH/SFTP (22).
  10. Click custom port > port range, open up the ports from 32768 to 65535. Port Range
  11. Click add public ip address.

Install Docker

The steps below will guide you to installing Docker on your new virtual server.

  1. Navigate to your server in the Control Portal as in the previous section. Your server's public IP address will be noted on the screen.
  2. From a shell on your local machine, connect to your new server with the following command. Replace "YOUR.VPS.IP" with your server's public IP address.
    ssh [email protected]
    
  3. Once you are logged into your virtual server, install Docker using the following commands.
    apt update
    apt upgrade -y
    apt install apt-transport-https ca-certificates -y
    apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
    
  4. From a command-line text editor, create /etc/apt/sources.list.d/docker.list and edit it to look like the following.
    deb https://apt.dockerproject.org/repo ubuntu-precise main
    
  5. Install the required packages with the following commands.
    apt update
    apt install linux-image-extra-$(uname -r) apparmor docker-engine -y
    
  6. Install and run the Eclipse Che Docker image. Replace "YOUR.VPS.IP" in the last line with your server's public IP address.
       chmod 666 /var/run/docker.sock
       docker run --net=host \
                  --name che \
                  -v /var/run/docker.sock:/var/run/docker.sock \
                  -v /home/user/che/lib:/home/user/che/lib-copy \
                  -v /home/user/che/workspaces:/home/user/che/workspaces \
                  -v /home/user/che/storage:/home/user/che/storage \
                  codenvy/che --remote:YOUR.VPS.IP
    
    Note: You can also deploy a new virtual server with Docker through a Runner script.

Connect a Workspace to Cloud Foundry

Eclipse Che creates each workspace as a self-contained Docker image. Each workspace image can contain multiple projects. In this section, we will create a new Che workspace and install the Cloud Foundry CLI tools.

Create the Workspace

  1. In your web browser, go to http://YOUR.VPS.IP:8080/ Replace "YOUR.VPS.IP" with the public IP address of your virtual server.
  2. Click Workspaces in the left column.
  3. On the "Workspaces" panel, click the + button in the upper-right corner.
  4. Under "Select Source", choose Workspace using recipe.
  5. Under "Select Stack", choose Node.
  6. Scroll to the bottom and click CREATE WORKSPACE.
  7. You will now be on your new workspace's page.
  8. Click Run.
  9. After the workspace starts up, click Open. Eclipse Che

Install the Cloud Foundry CLI

Behind the scenes, your new Che workspace is a Docker container. You can run commands in this container from the shell prompt in the container console. The console is useful for installing additional packages in the Docker container, manual file maintenance, or running shell commands not otherwise handled by the Che menus. Follow the directions below to install the Cloud Foundry CLI using the Che workspace console.

  1. In a new browser window, go to the Cloud Foundry CLI download page.
  2. Download the latest Linux 64-bit deb package.
  3. In Eclipse Che, click on the name of a project in the Project Explorer.
  4. In the top menu, click Project > Upload File.
  5. Upload the package you downloaded in Step 2. This step might take a little time.
  6. In the project console, run the following command. Replace "pathto/cf-cli-installer.deb" with the path to the downloaded package.
    sudo dpkg -i path_to/cf-cli-installer.deb
    
    Project Console
  7. You can now remove the uploaded package from your workspace.

Connect to AppFog From Eclipse Che

Before you can deploy any of your Eclipse Che projects to AppFog, you need to enable AppFog in your CenturyLink Cloud account and log into AppFog from your Che workspace. To get a good understanding of AppFog, read the Getting Started Guide. The following steps to get up and running quickly.

Enable AppFog

First, enable AppFog in the CenturyLink Cloud Control Portal.

  1. Go to the Control Portal and log in.
  2. From the Navigation Menu, click Services > AppFog.
  3. Select a region to host your application.

Log in to AppFog using the Cloud Foundry Tools

Once AppFog is set up in your CenturyLink Cloud account, you need to login to AppFog using the Cloud Foundry CLI. The Control Portal gives you an exact command from the Overview tab. Follow the directions below every time you want to configure an Eclipse Che workspace to deploy projects to AppFog.

  1. Find the cf login command on your AppFog control panel. It will look similar to this:
    cf login -a https://api.useast.appfog.ctl.io -o C007 -u your.username
    
  2. Run the command in your Eclipse Che workspace console.
  3. Enter your CenturyLink Cloud password when prompted.
  4. Select the Dev application space.

Note: To learn more about logging into AppFog using the Cloud Foundry command-line tools read this article in our, Knowledge Base.

Next Steps

If this is your first time using Eclipse Che, there are a wide variety of powerful commands and features for you to explore. Your next step is to create and deploy a Node.js project from your Eclipse Che workspace to AppFog. Check out our four-part tutorial on creating a Node.js application with AppFog to get an idea of where to start.

Sign-up for our Developer-focused newsletter CODE. Designed hands-on by developers, for developers. Keep up to date on topics of interest: tutorials, tips and tricks, and community building events.

We’re a different kind of cloud provider – let us show you why.