How to Deploy Quarkus on Platform.sh

Quarkus is, in its own words, a cloud-native, (Linux) container-first framework for writing Java applications.

Going through the steps below you will have two options:

  1. You already have a Quarkus site your are trying to deploy. In this case, you will able to go through each step to make the recommended changes to your repository to prepare it for Platform.sh.
  2. You have no code at this point. In this case, Platform.sh maintains a ready-made Quarkus template that you will be able to deploy very quickly. The steps below will then hopefully help to clarify why the modifications have been made to a base Quarkus project.

Tools 

Next, you need a couple tools to interact with your Platform.sh project, one of which you likely already have.

  • Git. Git is the primary tool you use to manage everything your app needs to run. Every commit pushed results in a new deployment, and all of your configuration is driven almost entirely by a small number of YAML files in your Git repository (which we will get to in the steps below). Your infrastructure, described in these files, becomes part of your application itself - completely transparent and version-controlled. If you do not already have Git on your computer, you should install it now.

  • The Platform.sh CLI. This lets you interact with your Platform.sh project from the command line. You can also use your browser, but the CLI is the tool you use the most in this guide. Install it for your operating system:

    # Linux/macOS
    curl -sS https://platform.sh/cli/installer | php
    
    # Windows
    curl https://platform.sh/cli/installer -o cli-installer.php
    php cli-installer.php
    

    Once it’s installed, run the CLI in your terminal:

    # Verify the installation
    platform
    

    On the first run, you need to log in using a browser.

    Take a moment to view some of the available commands, by running:

    # View the list of CLI commands
    platform list
    

Sign up for Platform.sh and initialize your project 

Depending on whether or not you have an existing project you want to migrate to Platform.sh, there are three ways to get started.

With a template 

Deploy a Quarkus template itself straight to Platform.sh. Use the button below to launch a Quarkus template project and create a Platform.sh account along the way. If you don’t want to sign up with an email address, you can sign up using an existing GitHub, Bitbucket, or Google account. If you choose one of these options, you can set a password for your Platform.sh account later.

Deploy on Platform.sh

Once the template is deployed, you can follow the rest of this guide so you can better understand the extra files and tweaks in the repository.

With a brand new code base 

You can start with a vanilla code base or push a pre-existing project to Platform.sh.

  1. Register for a trial Platform.sh account.

    If you don’t want to sign up with an email address, you can sign up using an existing GitHub, Bitbucket, or Google account If you choose one of these options, you can set a password for your Platform.sh account later.

  2. Create your first project.

    Since you’re providing your own code, use the Blank project option. Give the project a title and choose the region closest to your site visitors. You can also select more resources for your project, although a development plan should be enough for you to get started.

  3. Add a Git remote for the Platform.sh project you just created.

    The easiest way to get the ID of the project is to run plaform on its own, which lists all of your projects. As you have only one project, you can copy its ID. Then in your Git repository run:

    platform project:set-remote <PROJECT_ID>
    

    That creates an upstream called platform for your Git repository. Don’t push to it yet.

Once the project is fully configured, you can push to the remote you’ve created and have the project build automatically.

From a third party Git provider 

Platform.sh also supports third party Git hosting services, such as GitHub, GitLab, or BitBucket. In that case, the Platform.sh Git repository becomes a read-only mirror of the third party repository, which you can continue to use as normal.

  1. Register for a trial Platform.sh account.

    If you don’t want to sign up with an email address, you can sign up using an existing GitHub, Bitbucket, or Google account If you choose one of these options, you can set a password for your Platform.sh account later.

  2. Create your first project.

    Since you’re providing your own code, use the Blank project option. Give the project a title and choose the region closest to your site visitors. You can also select more resources for your project, although a development plan should be enough for you to get started.

  3. Add an integration to your existing third party repository.

    The process varies a bit for each supported service, so check the specific pages for each one.

    Accept the default options or modify to fit your needs.

All existing branches you have are automatically synchronized to Platform.sh. The deploy on Platform.sh reports a failure at this point. That’s expected because you haven’t provided configuration files yet. You add them in the next step. Remember to have a local clone of your project.

Now that you have a local Git repository, a Platform.sh project, and a way to push code to that project, you’re all set to continue.