Skip to content

Commit 4864388

Browse files
committed
post: Introducing Quarkus Backstage
1 parent b69d882 commit 4864388

4 files changed

+332
-0
lines changed
Lines changed: 332 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,332 @@
1+
---
2+
layout: post
3+
title: 'Introducing Quarkus Backstage'
4+
date: 2025-05-02
5+
tags: backstage, platform engineering
6+
synopsis: An introduction to the Quarkus extension for Backstage
7+
author: iocanel
8+
---
9+
:imagesdir: /assets/images/posts/quarkus-backstage/
10+
11+
ifdef::env-github,env-browser,env-vscode[:imagesdir: ../assets/images/posts/similarity-search-using-vector-dbs]
12+
13+
== Introduction ==
14+
DevOps, for many, has been more of a linguistic rebranding than a true cultural shift. All too often, organizations stop at renaming their Ops team to DevOps and call it a day.
15+
But without real collaboration, without mutual understanding between developers and operators there is no actual DevOps.
16+
Today, we witness the rise of Platform Engineering which is supposed to improve developer experience and productivity and act as an enabler for DevOps.
17+
18+
The question is can this gap be bridged without tools that facilitate this collaboration?
19+
Since, its early days Quarkus provided tools for developers that help them get closer to the Ops side of the house, but also communicate to the Ops what the
20+
dev actually needs. In this category we could classify the Quarkus Kubernetes and Helm extension. The latest addtion to this family of exntesion is now
21+
the https://docs.quarkiverse.io/quarkus-backstage/dev/index.html[Quarkus Backstage] extension that simplifies the integration of Quarkus and https://backstage.io[Backstage], one of the most prominent projects in the Platform Engineering space.
22+
23+
24+
=== What is Backstage ? ===
25+
https://backstage.io[Backstage] is an open framework for building developer portals. It was originally created by Spotify to help their engineers manage the complexity of Microservices and cloud-native architectures.
26+
It builds developer portals that act as software component registries, allowing teams to easily
27+
28+
* Track component ownership
29+
* Discover, explore and document services
30+
* Communicate API changes
31+
* Create and instantiate Software Templates (materializing DevOps practices)
32+
* Aggregate all developer consoles in one place
33+
and more
34+
35+
36+
=== Backstage Challenges ===
37+
The idea is not new. I've seen similar tools come and go throughout my whole professional life. What makes https://backstage.io[Backstage] more relevant is the adoption of Microservice Architecture, which increases the
38+
amplifies the need for a developer portal. What's also not new is the challenge of using such a tool and making in it an integral part of the developer workflow.
39+
40+
As always the challenge is the maintenance cost.
41+
Maintenance, in terms of keeping the information served by https://backstage.io[Backstage] up to date.
42+
43+
What happens when a Service adds / removes an API ?
44+
What happens when an API is migrated to new transport protocol ?
45+
What happens when we need to use a new framework version in our templates ?
46+
47+
A development practice is as good as the tools that make it stick.
48+
49+
50+
=== Quarkus Backstage Features ===
51+
How does https://docs.quarkiverse.io/quarkus-backstage/dev/index.html[Quarkus Backstage] help with the challenges above ?
52+
53+
Short answer: By making Quarkus the Platform Engineers favorite application framework.
54+
Long answer: While it's out of scope to solve all the challenges of https://backstage.io[Backstage], Quarkus aids the Platform Engineer in the following ways:
55+
56+
* Generates Component and API entities for Quarkus applications
57+
* Reverse engineers Templates from existing Quarkus applications
58+
* Provides CLI for managing https://backstage.io[Backstage] entities
59+
* Provides Dev Services for https://backstage.io[Backstage]
60+
* Acts as a coordinator for all Quarkus DevOps extensions
61+
62+
63+
=== Using Quarkus Backstage ===
64+
https://docs.quarkiverse.io/quarkus-backstage/dev/index.html[Quarkus Backstage] comes in two shapes that can be used independently:
65+
66+
* Quarkus CLI plugin
67+
* Quarkus extension
68+
69+
70+
==== As a CLI plugin ====
71+
Let's see how to use the https://docs.quarkiverse.io/quarkus-backstage/dev/index.html[Quarkus Backstage] CLI plugin in order to generate https://backstage.io[Backstage] entities for your Quarkus application.
72+
73+
First, let's create a new Quarkus project:
74+
[source,shell]
75+
----
76+
quarkus create app hello-backstage -x rest
77+
----
78+
79+
....
80+
Looking for the newly published extensions in registry.quarkus.io
81+
-----------
82+
selected extensions:
83+
- io.quarkus:quarkus-rest
84+
85+
86+
applying codestarts...
87+
📚 java
88+
🔨 maven
89+
📦 quarkus
90+
📝 config-properties
91+
🔧 tooling-dockerfiles
92+
🔧 tooling-maven-wrapper
93+
🚀 rest-codestart
94+
95+
-----------
96+
[SUCCESS] ✅ quarkus project has been successfully generated in:
97+
--> /home/iocanel/blog/hello-backstage
98+
-----------
99+
Navigate into this directory and get started: quarkus dev
100+
....
101+
102+
103+
104+
Then, navigate to the project directory:
105+
106+
From within your Quarkus project, run the following command:
107+
108+
[source,shell]
109+
----
110+
quarkus plugin add io.quarkiverse.backstage:quarkus-backstage-cli:0.7.0
111+
----
112+
113+
....
114+
Looking for the newly published extensions in registry.quarkus.io
115+
Added plugin:
116+
Name Type Scope Location Description
117+
* backstage maven project io.quarkiverse.backstage:quarkus-backstage-cli:0.7.0
118+
....
119+
120+
121+
If you want to install it globally and make it available for all your Quarkus projects, run the following command:
122+
123+
[source,shell]
124+
----
125+
quarkus plugin add io.quarkiverse.backstage:quarkus-backstage-cli:0.7.0 --user
126+
----
127+
128+
....
129+
Added plugin:
130+
Name Type Scope Location Description
131+
* backstage maven user io.quarkiverse.backstage:quarkus-backstage-cli:0.7.0
132+
....
133+
134+
135+
To get an idea of the available commands, run:
136+
[source,shell]
137+
----
138+
quarkus backstage --help
139+
----
140+
141+
....
142+
Backstage CLI
143+
Usage: backstage [-h] [COMMAND]
144+
-h, --help Display this help message.
145+
Commands:
146+
entities Backstage Entities
147+
location Backstage Location
148+
template Backstage Template
149+
mcp Start backstage MCP server.
150+
....
151+
152+
153+
To generate a https://backstage.io[Backstage] entities for your Quarkus application, run the following command:
154+
155+
[source,shell]
156+
----
157+
quarkus backstage entities generate
158+
----
159+
160+
....
161+
Backstage entities generated:
162+
API Version Kind Name UUID
163+
backstage.io/v1alpha1 Component hello-backstage
164+
165+
....
166+
167+
168+
169+
[source,shell]
170+
----
171+
cat catalog-info.yaml
172+
----
173+
174+
....
175+
176+
apiVersion: backstage.io/v1alpha1
177+
kind: Component
178+
spec:
179+
type: application
180+
lifecycle: production
181+
owner: user:guest
182+
metadata:
183+
name: hello-backstage
184+
labels:
185+
app.kubernetes.io/name: hello-backstage
186+
app.kubernetes.io/version: 1.0.0-SNAPSHOT
187+
app.quarkus.io/version: 3.18.3
188+
tags:
189+
- java
190+
- quarkus
191+
....
192+
193+
The generated component is available under the `catalog-info.yaml`. The file can
194+
be added to git, pushed to a git repository and then registered in Backstage.
195+
196+
Pretty much any Backstage installation should be able to read the component from github.
197+
To do the registration, starting from the Home screen:
198+
199+
* Click on the "Create" button
200+
* Click on "Register existing component"
201+
* Paste the link to the `catalog-info.yaml` file in the git repository
202+
* Click on "Analyze"
203+
* Click on "Register"
204+
205+
The registered component should look like:
206+
207+
image::hello-backstage-component-view.png[scaledwidth=100%]
208+
209+
This is not very impressive given that the file could be generated by Backstage itself.
210+
However, that would be the last thing that Backstage would do for you.
211+
What would happen next time your application changes and changes need to be reflected in Backstage ?
212+
213+
Let's expose an API for our application. We'll add the openapi extension and we'll configure it so
214+
that it generates the openapi schema in the same directory as the `catalog-info.yaml` file.
215+
216+
[source,shell]
217+
----
218+
quarkus ext add smallrye-openapi
219+
quarkus config set quarkus.smallrye-openapi.store-schema-directory .
220+
----
221+
222+
....
223+
Looking for the newly published extensions in registry.quarkus.io
224+
[SUCCESS] ✅ Extension io.quarkus:quarkus-smallrye-openapi has been installed
225+
....
226+
227+
228+
Let's rebuild the application and see how our `catalog-info.yaml` file looks like:
229+
230+
[source,shell]
231+
----
232+
cat catalog-info.yaml
233+
----
234+
235+
....
236+
237+
apiVersion: backstage.io/v1alpha1
238+
kind: API
239+
spec:
240+
type: openapi
241+
lifecycle: production
242+
owner: user:guest
243+
definition:
244+
$text: ./openapi.yaml
245+
metadata:
246+
name: hello-backstage-api
247+
---
248+
apiVersion: backstage.io/v1alpha1
249+
kind: Component
250+
spec:
251+
type: application
252+
lifecycle: production
253+
owner: user:guest
254+
providesApis:
255+
- hello-backstage-api
256+
metadata:
257+
name: hello-backstage
258+
labels:
259+
app.kubernetes.io/name: hello-backstage
260+
app.kubernetes.io/version: 1.0.0-SNAPSHOT
261+
app.quarkus.io/version: 3.18.3
262+
tags:
263+
- java
264+
- quarkus
265+
....
266+
267+
The refreshed component now looks like:
268+
269+
image::hello-backstage-component-with-api-view.png[scaledwidth=100%]
270+
271+
272+
==== As an extension ====
273+
An alternative to using the https://docs.quarkiverse.io/quarkus-backstage/dev/index.html[Quarkus Backstage] CLI plugin is to use the https://docs.quarkiverse.io/quarkus-backstage/dev/index.html[Quarkus Backstage] extension.
274+
Usually, an extension is needed when the application itself requires a library, a framework, or a code
275+
generator. In this case, the extension adds the Backstage entity generation to the application build process.
276+
277+
To add the extension to the project:
278+
279+
[source,shell]
280+
----
281+
quarkus ext add io.quarkiverse.backstage:quarkus-backstage:0.7.0
282+
----
283+
284+
....
285+
[SUCCESS] ✅ Extension io.quarkiverse.backstage:quarkus-backstage:0.7.0 has been installed
286+
....
287+
288+
289+
At the time of writing the extension is not part of the Extension catalog, and thus it needs to be added using
290+
its full maven coordinates.
291+
292+
Now, let's remove the existing `catalog-info.yaml` file and let's generate a new one using the extension:
293+
294+
[source,shell]
295+
----
296+
rm catalog-info.yaml
297+
ls -al
298+
----
299+
300+
....
301+
total 76
302+
drwxr-xr-x 7 iocanel users 4096 Apr 3 19:29 .
303+
drwxr-xr-x 3 iocanel users 4096 Apr 3 16:38 ..
304+
-rw-r--r-- 1 iocanel users 75 Apr 3 16:38 .dockerignore
305+
drwxr-xr-x 8 iocanel users 4096 Apr 3 19:21 .git
306+
-rw-r--r-- 1 iocanel users 423 Apr 3 16:38 .gitignore
307+
drwxr-xr-x 3 iocanel users 4096 Apr 3 16:38 .mvn
308+
-rwxr-xr-x 1 iocanel users 11172 Apr 3 16:38 mvnw
309+
-rw-r--r-- 1 iocanel users 7697 Apr 3 16:38 mvnw.cmd
310+
-rw-r--r-- 1 iocanel users 710 Apr 3 19:19 openapi.json
311+
-rw-r--r-- 1 iocanel users 454 Apr 3 19:19 openapi.yaml
312+
-rw-r--r-- 1 iocanel users 5332 Apr 3 19:31 pom.xml
313+
drwxr-xr-x 3 iocanel users 4096 Apr 3 16:39 .quarkus
314+
-rw-r--r-- 1 iocanel users 2053 Apr 3 16:38 README.md
315+
drwxr-xr-x 4 iocanel users 4096 Apr 3 16:38 src
316+
drwxr-xr-x 4 iocanel users 4096 Apr 3 19:21 target
317+
....
318+
319+
320+
Finally, let's rebuild:
321+
322+
And check that the file is properly generated. The generated resources should the same as the ones generated by the CLI plugin.
323+
There is still value in using the extension, but that's a subject for another blog post.
324+
325+
326+
=== Conclusion ===
327+
https://backstage.io[Backstage] is a great tool for organizations to survive the Microservice Architecture chaos.
328+
A tool, can't help if it's not used nor if it's feed with stale data.
329+
The https://docs.quarkiverse.io/quarkus-backstage/dev/index.html[Quarkus Backstage] project was created to leverage the power of the Quarkus build system in order to keep
330+
the catalog entities of Quarkus components up to date. In Quarkus lingo, to bring "Platform Engineer joy".
331+
332+
A video walk-through on the basics of the extension is available at https://www.youtube.com/watch?v=XAiF-opDtpw[here].
Loading
Loading
Loading

0 commit comments

Comments
 (0)