Codewind is an open source project that makes it easier for developers to create cloud-native applications within their favorite IDE. As of now, Codewind supports Visual Studio Code, Eclipse IDE and Eclipse Che.
Codewind enables you to create applications from templates and provide support for launching, updating, testing, and debugging in Docker containers on the desktop. Codewind also supports these features on Kubernetes. You can use Codewind to move existing applications to Docker and Kuberenetes. Codewind provides validation to ensure that applications follow best practices.
Codewind helps you in building high-quality cloud-native applications for Kubernetes, regardless of your IDE or language.
This tutorial covers quickstart guide to develop cloud native java applications using Eclipse IDE and VS Code.
- Download and install the latest Eclipse IDE for Java EE Developers or use an existing installation. Eclipse IDE versions 4.11.0 onwards support Codewind.
- Install Docker
- Open the Eclipse IDE and navigate to Help > Eclipse Marketplace.
- Search for Codewind.
- Click the Install button.
- Finish the wizard and accept licenses as needed.
- When the installation is complete, restart Eclipse.
- In Eclipse, navigate to Window -> Show View -> Other.... -> Codewind -> Codewind Explorer.
- Codewind requires the installation of additional Docker images to run. Double-click on the Codewind item in the Codewind Explorer view to complete the installation. The installation may take a few minutes to complete.
- Codewind creates a folder called codewind-workspace within your home directory (~/codewind-workspace on mac) to contain your projects.
This
codewind-workspace
can be accessed across editors. If you have created Codewind projects in Eclipse IDE, then those projects can be accessed from Visual Studio code's Codewind plugin because of the codewind-workspace folder that is compatible across editors.
Codewind provides a set of templates available from which you can create a project. The templates are of different types - Standard Codewind templates
, Kabanero Collections
, Appsody Stacks - appsodyhub
. Some of the templates available now are - Go, Lagom Java, Node.js Express, Open Liberty, Python, Sprint Boot, Swift, WebSphere Liberty Microprofile, Loopback etc..
You can create your own template and use it to create a project. More details Here.
In this tutorial, let us create a project using WebSphere Liberty Microprofile template available in Codewind.
- In the Codewind Explorer view, ensure that Codewind is running. If not, double click Codewind item to start Codewind.
- Upon start, expand
Codewind
item and right click onLocal Projects
and clickNew Project....
. - Enter a name for the project and select
WebSphere Liberty MicroProfile
under templates. ClickFinish
to create the project. - A new project is created with all the required directories and files for cloud native java application. Note that
Dockerfile
andpom.xml
are created with the necessary entries. You can edit files to suit your needs. - The project gets built, deployed and started.
- A context menu on the project enables you to open your application in a browser, view application and build logs, restart in debug mode, and much more. Refer to this link for the list of context menu items and their functionality.
- In Codewind Explorer view, right click on the project that was created in above step, and click
Open Application
. This opens the application in the default Eclipse browser. You can start using the application.
It is very easy to make changes and deploy them. Let us modify Example.java file under src/main/java/application/rest/v1
.
Now, let us modify and change the display message to Congratulations, your modified application is up and running!!!
. Save the file. Wait for a few moments for the changes be automatically to be built and deployed. Now check by invoking the rest api http://localhost:xxxx/v1/example on your browser (get port nunmber from the home page of the application link from browser).
The modified message should be displayed. It is this easy to make changes to a cloud native application and test the changes instantly.
You can then go on to modify this application to add your business logic. This way you focus on just what is needed for the business logic and not worry about other environmental issues while building a cloud native application.
Check Debugging Codewind projects.
Check troubleshooting guidelines for Codewind.
- Download and install VS Code version 1.28 or later.
- Install Docker
- Launch VS Code IDE.
- In the menu bar, under
View
clickExtenstions
. - In the search field, type
Codewind
and hit enter. - Install Codewind by clicking on
Install
button against Codewind entry. - Codewind requires the installation of additional Docker images to run. Choose Install when prompted to complete the installation. The installation may take a few minutes to complete. Codewind is now installed.
- Codewind creates a folder called codewind-workspace within your home directory (~/codewind-workspace on mac) to contain your projects.
This
codewind-workspace
can be accessed across editors. If you have created Codewind projects in Eclipse IDE, then those projects can be accessed from Visual Studio code's Codewind plugin because of the codewind-workspace folder that is compatible across editors.
Codewind provides a set of templates available from which you can create a project. Standard Codewind templates
, Kabanero Collections
, Appsody Stacks - appsodyhub
contain templates. These have the following templates, as of now, - Go, Lagom Java, Node.js Express, Open Liberty, Python, Sprint Boot, Swift, WebSphere Liberty Microprofile, Loopback etc..
You can create your own template and use it to create a project. More details Here.
- Launch VSCode IDE.
- In the
Explorer
view, expandCodewind
and thenProjects
. - Right click on
Projects
and selectCreate New Project
. - Select the template from which you want to create a project. For this tutuorial we'll select
Standard Codewind templates
. - Then select a template. Here we'll select
WebSphere Liberty Microprofile
entry. - Enter a name for the project and hit enter. A new Java microprofile project is created and can be seen in Codewind workpsace.
- After a few minutes, the project is in running status, after after build and deploy. Once it is in running status, right click on the Python project in Codewind view and click
Open App
.
You will see many more options in the context menu of the application in Codewind view. Refer this to gather more detailed information.
It is very easy to make changes and deploy them. Let us modify Example.java file under src/main/java/application/rest/v1
.
Before making modification, check the response for curl http://127.0.0.1:xxxx/v1/example
(get port nunmber from the home page of the application link from browser, after opening the app from it's context menu). In the above image you can see the output in the terminal view of VS Code editor.
Now, let us modify and change the display message to Congratulations, your modified application is up and running!!!
. Save the file. Wait for a few moments for the changes to be automatically built and deployed. Now check the response for curl http://127.0.0.1:xxxx/v1/example
. The modified message should be displayed. It is this easy to make changes to a cloud native application and test the changes instantly. Check the changes reflect in the below gif image in the tremical section of VS Code editor.
You can then go on to modify this application to add your business logic. This way you focus on just what is needed for the business logic and not worry about other environmental issues while building a cloud native application.