Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

This tutorial provides a quickstart guide to create a cloud native java application using Codewind

License

Notifications You must be signed in to change notification settings

IBM/develop-a-cloud-native-java-application-using-codewind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Quickstart guide to develop a Cloud Native Java Application using Codewind

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.

Working with Codewind on Eclipse IDE

Prerequisites

Install Codewind

  1. Open the Eclipse IDE and navigate to Help > Eclipse Marketplace.
  2. Search for Codewind.
  3. Click the Install button.
  4. Finish the wizard and accept licenses as needed. Codewind Install for Eclipse
  5. When the installation is complete, restart Eclipse.
  6. In Eclipse, navigate to Window -> Show View -> Other.... -> Codewind -> Codewind Explorer. Codewind Explorer View
  7. 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 Start
  8. 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.

Project templates

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.

Create and run a microprofile project

In this tutorial, let us create a project using WebSphere Liberty Microprofile template available in Codewind.

  1. In the Codewind Explorer view, ensure that Codewind is running. If not, double click Codewind item to start Codewind.
  2. Upon start, expand Codewind item and right click on Local Projects and click New Project.....
  3. Enter a name for the project and select WebSphere Liberty MicroProfile under templates. Click Finish to create the project. Create Project
  4. A new project is created with all the required directories and files for cloud native java application. Note that Dockerfile and pom.xml are created with the necessary entries. You can edit files to suit your needs. Project Structure
  5. The project gets built, deployed and started.
  6. 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.
  7. 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. Before modification

Modify application

It is very easy to make changes and deploy them. Let us modify Example.java file under src/main/java/application/rest/v1.

Modify File

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.

After modification

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.

Troubleshooting

Check Debugging Codewind projects.

Check troubleshooting guidelines for Codewind.

Working with Codewind on Visual Studio Code

Prerequisites

Install Codewind

  1. Launch VS Code IDE.
  2. In the menu bar, under View click Extenstions.
  3. In the search field, type Codewind and hit enter.
  4. Install Codewind by clicking on Install button against Codewind entry.
  5. 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. VSCode Install Codewind Codewind is now installed.
  6. 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.

Project templates

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.

Create and run a Java project

  1. Launch VSCode IDE.
  2. In the Explorer view, expand Codewind and then Projects.
  3. Right click on Projects and select Create New Project.
  4. Select the template from which you want to create a project. For this tutuorial we'll select Standard Codewind templates.
  5. Then select a template. Here we'll select WebSphere Liberty Microprofile entry.
  6. Enter a name for the project and hit enter. A new Java microprofile project is created and can be seen in Codewind workpsace.
  7. 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. VSCode Create Project

You will see many more options in the context menu of the application in Codewind view. Refer this to gather more detailed information.

Modify application

It is very easy to make changes and deploy them. Let us modify Example.java file under src/main/java/application/rest/v1. Modify File

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. After modification

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.

Troubleshooting

Check troubleshooting guidelines for Codewind.

About

This tutorial provides a quickstart guide to create a cloud native java application using Codewind

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published