Skip to content

Commit

Permalink
Let's start with a generated application instead of quickstarts
Browse files Browse the repository at this point in the history
It's a lot more natural to create a simple application using our tooling
rather than doing all sorts of manipulation to extract the code from the
quickstarts repo.
  • Loading branch information
gsmet committed Dec 16, 2024
1 parent 6a204e3 commit 9da5a09
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions docs/src/main/asciidoc/deploying-to-heroku.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,20 @@ Luckily, there's a dynamic configuration property for it.

== Common project setup

This guide will take as input an application developed in the xref:getting-started.adoc[Getting Started guide].
This guide will take as input a simple application created with the Quarkus tooling:

We need to create a new repository for the application, so follow these steps:
:create-app-artifact-id: getting-started-with-heroku
:create-app-code:
include::{includes}/devtools/create-app.adoc[]

1. Make a clone of the Git repository: `git clone {quickstarts-clone-url}`,
or download an {quickstarts-archive-url}[archive].
2. Copy the contents of the `quarkus-quickstarts/getting-started` directory to a new directory.
3. Change to the new directory and initialize a new Git repository: `git init -b main`.
4. Add all files to the repository: `git add .`.
5. Commit the files `git commit -a -m 'Initial copy of getting-started'`.
This command will create a new REST application in the `getting-started-with-heroku` directory.

Let's make this application a Git repository:

1. Change to the application directory: `cd getting-started-with-heroku`.
2. Initialize a new Git repository: `git init -b main`.
3. Add all files to the repository: `git add .`.
4. Commit the files: `git commit -a -m 'Initial copy of getting-started'`.

Heroku can react on changes in your repository, run CI and redeploy your application when your code changes.
Therefore, we start with a valid repository already.
Expand Down Expand Up @@ -165,11 +169,15 @@ First, login to Heroku's container registry:
heroku container:login
-----

We need to add an extension to our project to build container images via the Quarkus Maven plugin:
We need to add an extension to our project to add the capability to build container images:

:add-extension-extensions: container-image-docker
include::{includes}/devtools/extension-add.adoc[]

Then, let's commit this change:

[source,bash]
----
mvn quarkus:add-extension -Dextensions="container-image-docker"
git add pom.xml
git commit -am "Add container-image-docker extension."
----
Expand All @@ -180,7 +188,7 @@ We get the generated name via `heroku info` and pass it on to the (local) build:
[source,bash]
----
APP_NAME=`heroku info | grep "=== .*" |sed "s/=== //"`
mvn clean package\
./mvnw clean package\
-Dquarkus.container-image.build=true\
-Dquarkus.container-image.group=registry.heroku.com/$APP_NAME\
-Dquarkus.container-image.name=web\
Expand Down Expand Up @@ -260,12 +268,12 @@ We opt in to compiling a native image inside a local container, so that we don't
[source,bash]
----
APP_NAME=`heroku info | grep "=== .*" |sed "s/=== //"`
mvn clean package\
-Dquarkus.container-image.build=true\
-Dquarkus.container-image.group=registry.heroku.com/$APP_NAME\
-Dquarkus.container-image.name=web\
-Dquarkus.container-image.tag=latest\
-Dnative\
./mvnw clean package \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.group=registry.heroku.com/$APP_NAME \
-Dquarkus.container-image.name=web \
-Dquarkus.container-image.tag=latest \
-Dnative \
-Dquarkus.native.container-build=true
----

Expand Down

0 comments on commit 9da5a09

Please sign in to comment.