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.
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.
- Log into the CenturyLink Cloud Control Portal.
- From the Navigation Menu, click Infrastructure > Servers.
- Select a region for your new server and click create > server.
- Fill out the form for your new server. Note: From the operating system drop-down, be sure to select Ubuntu 14 | 64-bit.
- After your new server is provisioned, return to the server list. Go to the Control Portal.
- From the Navigation Menu, click Infrastructure > Servers.
- Locate your new server in the list and click on it.
- On the right-side under SERVER INFO, click add public ip.
- Check the boxes to open ports HTTP (8080) and SSH/SFTP (22).
- Click custom port > port range, open up the ports from 32768 to 65535.
- Click add public ip address.
The steps below will guide you to installing Docker on your new virtual server.
- 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.
- 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.
- 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
- 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
- Install the required packages with the following commands.
apt update apt install linux-image-extra-$(uname -r) apparmor docker-engine -y
- Install and run the Eclipse Che Docker image. Replace "YOUR.VPS.IP" in the last line with your server's public IP address.
Note: You can also deploy a new virtual server with Docker through a Runner script.
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
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
- In your web browser, go to http://YOUR.VPS.IP:8080/ Replace "YOUR.VPS.IP" with the public IP address of your virtual server.
- Click Workspaces in the left column.
- On the "Workspaces" panel, click the + button in the upper-right corner.
- Under "Select Source", choose Workspace using recipe.
- Under "Select Stack", choose Node.
- Scroll to the bottom and click CREATE WORKSPACE.
- You will now be on your new workspace's page.
- Click Run.
- After the workspace starts up, click Open.
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.
- In a new browser window, go to the Cloud Foundry CLI download page.
- Download the latest Linux 64-bit deb package.
- In Eclipse Che, click on the name of a project in the Project Explorer.
- In the top menu, click Project > Upload File.
- Upload the package you downloaded in Step 2. This step might take a little time.
- 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
- 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.
First, enable AppFog in the CenturyLink Cloud Control Portal.
- Go to the Control Portal and log in.
- From the Navigation Menu, click Services > AppFog.
- 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.
- 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
- Run the command in your Eclipse Che workspace console.
- Enter your CenturyLink Cloud password when prompted.
- 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.
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.