Skip to main content
Redhat Developers  Logo
  • Products

    Platforms

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat AI
      Red Hat AI
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • View All Red Hat Products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat Developer Hub
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat OpenShift Local
    • Red Hat Developer Sandbox

      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Secure Development & Architectures

      • Security
      • Secure coding
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • Product Documentation
    • API Catalog
    • Legacy Documentation
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Enhancing the development loop with Quarkus remote development

February 11, 2021
Daniel Oh
Related topics:
ContainersJavaKubernetesQuarkus
Related products:
Red Hat OpenShift

Share:

    Kubernetes is an established foundation layer for cloud-native microservices and serverless architectures. By automating application deployment, scaling, and management, Kubernetes changes the developer's daily workflow in terms of inner loop development (local coding, building, running, and testing the application) and outer loop development (integration testing, continuous deployment, and security). Developers using Kubernetes also must plan for containerization, debugging code inside pods, and automating test cases.

    In this article, you'll see how using Quarkus remote development enhances the development loop on Kubernetes. We will set up a new Quarkus project then configure it for live coding on a remote Red Hat OpenShift cluster, just like you would in your local development environment.

    Step 1: Create a new Quarkus project

    We’ll use a Maven plug-in to scaffold a new project with the following command:

    $ mvn io.quarkus:quarkus-maven-plugin:2.1.0.Final:create \
        -DprojectGroupId=org.acme \
        -DprojectArtifactId=quarkus-remote \
        -DprojectVersion=1.0.0-SNAPSHOT \
        -DclassName="org.acme.GreeterResource" \
        -Dextensions="openshift"

    This command generates a quarkus-remote directory that includes a new Quarkus project. When you open the GreeterResource.java class file in src/main/java/org/acme, you will see a simple RESTful API:

    @Path("/hello")
    public class GreeterResource {
    
       @GET
       @Produces(MediaType.TEXT_PLAIN)
       public String hello() {
           return "Hello RESTEasy";
       }
    }

    Step 2: Live coding in your local environment

    Quarkus comes with a built-in development mode for hot deployment with background compilation. After changing the code, resources, or configuration in a running application, you only need to refresh your web browser or invoke the project's RESTful API for the changes to take effect automatically. To run your application locally, execute the following command in the project's home directory:

    $ mvn quarkus:dev

    You will see that live coding has been activated:

    INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.

    Invoke the application's RESTful API endpoint with acurl command:

    $ curl http:/localhost:8080/hello

    The output should be:

    Hello RESTEasy

    Return to the GreeterResource.java class file in src/main/java/org/acme. Change the code in the hello() method:

    return "Hello RESTEasy from Local";

    Save the file, then use the same curl command to re-invoke the endpoint. The new output should be:

    Hello RESTEasy from Local

    Invoking the RESTful API triggers a scan of the workspace. If any changes are detected, the Java files are compiled, and the application is redeployed, and the redeployed application services your request. If you check the logs in your running Quarkus runtime, you should see the detected source files:

    INFO  [io.qua.dep.dev.RuntimeUpdatesProcessor] (vert.x-worker-thread-4) Changed source files detected, recompiling [/Users/danieloh/Downloads/quarkus-remote/src/main/java/me/daniel/GreeterResource.java]
    

    Hit CTRL+C when you are ready to stop the application.

    Step 3: Build and deploy a mutable application

    What if you want to expand the inner loop development cycle to a remote container environment such as Kubernetes or OpenShift? You can configure your application in remote development mode to make changes to your local files immediately visible in your remote container environment.

    To develop remotely, you need to build a mutable application using the mutable-jar format. You can then use the OpenShift extension and Maven plug-in to deploy the application to your remote OpenShift cluster. Append the following configurations to your Quarkus project's application.properties file:

    # Mutable Jar configurations
    quarkus.package.type=mutable-jar
    quarkus.live-reload.password=changeit
    
    # OpenShift Extension Configurations
    quarkus.container-image.build=true
    quarkus.kubernetes-client.trust-certs=true
    quarkus.kubernetes.deployment-target=openshift
    quarkus.openshift.route.expose=true
    quarkus.openshift.env.vars.quarkus-launch-devmode=true

    Note that you can change the password to whatever you want. It is used to secure communication between the remote side and the local side.

    Open the mutable application in your OpenShift cluster

    To log in to the OpenShift cluster, you have to install the oc command-line interface and use the oc login. Installation options for the CLI will vary depending on your operating system.

    Assuming you have oc installed, execute the following command in your Quarkus project home directory:

    $ oc new-project quarkus-remote
    $ mvn clean package -DskipTests -Dquarkus.kubernetes.deploy=true

    This command creates a new project in the remote OpenShift cluster. The mutable JAR will be packaged and deployed to OpenShift. The output should end with BUILD SUCCESS.

    Check the application in the OpenShift console

    So far, so good. Now, let’s go to the Developer console in the OpenShift cluster and then navigate the Topology view. You will see that your Quarkus application has been deployed. Click on View logs to see how the mutable application is deployed, as shown in Figure 1.

    Figure 1. Topology View
    Figure 1. Topology View
    Figure 1: The new, mutable application in the Topology view.

    You should see the output "Profile dev activated. Live Coding activated" in the pod logs, as shown in Figure 2.

    Figure 2. Pod Logs
    Figure 2. Pod Logs
    Figure 2: The pod logs show that live coding has been activated.

    Check the application's RESTful API

    Go back to the Topology view to access the application's RESTful API. Click the Open URL icon highlighted in Figure 3.

    Figure 3. Open URL
    Figure 3. Open URL
    Figure 3: Open the RESTful API URL

    Append /hello at the application’s route URL. When you check it, you should see the same output in your local environment :

    Figure 4. Access the REST API
    Figure 4. Access the REST API
    Figure 4. Access the REST API

    Step 4: Run the application in remote development mode

    The last step is to connect your local agent to the remote host on OpenShift. To start, append the quarkus.live-reload.url configuration to your application.properties file. Note that you will need to remove or comment the OpenShift extension configurations so that they will not trigger the source-to-image build when you change the code:

    # Mutable Jar configurations
    quarkus.package.type=mutable-jar
    quarkus.live-reload.password=changeit
    quarkus.live-reload.url=http://YOUR_APP_ROUTE_URL
    
    # OpenShift Extension Configurations
    # quarkus.container-image.build=true
    # quarkus.kubernetes-client.trust-certs=true
    # quarkus.kubernetes.deployment-target=openshift
    # quarkus.openshift.expose=true
    # quarkus.openshift.env-vars.quarkus-launch-devmode.value=true

    Use the remote-dev command to execute the remote development mode:

    $ mvn quarkus:remote-dev

    The output should end with Connected to remote server. Now you can develop in the same environment where you will run your app, with access to the same services.

    Next, return to the GreeterResource.java class file in src/main/java/org/acme, then change the code in the hello() method:

    return "Hello RESTEasy from OpenShift";

    Save the file, then refresh the browser. The output should be what you see in Figure 5.

    Figure 5. Reinvoke the RESTful API
    Figure 5. Reinvoke the RESTful API
    Figure 5. Reinvoke the RESTful API

    Every time you refresh the browser, you should see that local changes are immediately visible in the remote application. An HTTP-based long polling transport synchronizes your local workspace and the remote application via HTTP calls. Here's an example of log output in the local Quarkus runtime:

    INFO  [io.qua.dep.dev.RuntimeUpdatesProcessor] (Remote dev client thread) Changed source files detected, recompiling [/Users/danieloh/Downloads/quarkus-remote/src/main/java/me/daniel/GreeterResource.java]
    ...
    
    INFO  [io.qua.ver.htt.dep.dev.HttpRemoteDevClient] (Remote dev client thread) Sending dev/app/me/daniel/GreeterResource.class
    INFO  [io.qua.ver.htt.dep.dev.HttpRemoteDevClient] (Remote dev client thread) Sending quarkus-run.jar
    ...

    Awesome! You should be all set to enjoy your inner loop development experience while implementing your application's new business requirements.

    Note: Using Quarkus's remote development mode in production could cause unexpected functional changes to the running application. Remote development should only be used when the application is in development.

    Conclusion

    You can use Quarkus to enhance the development loop by connecting the live coding features from your local machine to a remote container environment such as OpenShift. Being able to do remote development in a cloud-native Java runtime simplifies the development workflow—from writing code to building, running, debugging, and deploying microservices at speed. See the Quarkus Guides for more about how Quarkus optimizes development productivity through unified configuration, zero-config with live coding, and easy injection of extensions for implementing cloud-native applications.

    Last updated: October 7, 2022

    Recent Posts

    • A deep dive into Apache Kafka's KRaft protocol

    • Staying ahead of artificial intelligence threats

    • Strengthen privacy and security with encrypted DNS in RHEL

    • How to enable Ansible Lightspeed intelligent assistant

    • Why some agentic AI developers are moving code from Python to Rust

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2025 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue