Skip to content

Commit 6038166

Browse files
authored
Merge pull request #167 from RoadieHQ/roadie
Roadie
2 parents e8eddb1 + 07cad17 commit 6038166

21 files changed

Lines changed: 217 additions & 0 deletions

_data/authors.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,10 @@ gary_niemen:
6969
github: //github.com/garyniemen
7070
twitter:
7171
bio: "Product Manager for TechDocs, a docs-like-code solution at Spotify"
72+
73+
padraig_o_brien:
74+
name: Padraig O'Brien
75+
picture: http://docslikecode.com/images/padraig_o_brien.jpg
76+
github: //github.com/padraigobrien
77+
twitter: padraigobrien
78+
bio: "Director of engineering"
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
---
2+
layout: post
3+
title: Setting up Techdocs on Backstage
4+
excerpt: "Techdocs is Spotify's homegrown docs like code solution. it allows the user to store documentation to near code thus allowing it to be easily discovered."
5+
last_modified_at: Sun Feb 12 14:39:05 CST 2021
6+
categories: articles
7+
author: padraig_o_brien
8+
tags: [backstage, techdocs, roadie, spotify, mkdocs, service catalog]
9+
image:
10+
path: /images/backstage.jpg
11+
caption: "[Flickr](https://flic.kr/p/o6Sdy6)"
12+
comments: false
13+
share: true
14+
---
15+
TechDocs is Spotify’s homegrown docs-like-code solution built directly into Backstage. This means engineers write their documentation in Markdown files which live together with their code. In this post we will walk you through how to setup Backstage and Techdocs.
16+
17+
**Table of contents**
18+
19+
- Introduction.
20+
- Basic concepts and structure of backstage and techdocs.
21+
- Install Backstage.
22+
- Setup tech docs.
23+
- Creating and publishing documentation.
24+
- Publish to cloud storage
25+
- Recap
26+
27+
## **Introduction**
28+
29+
Backstage is a platform for building developer portals.
30+
31+
Its main benefit is allowing you to ship high quality code fast.
32+
33+
The main features you get out of the box are
34+
35+
- Service catalog.
36+
- Software templates.
37+
- Plugins which allow you to extend backstage functionality.
38+
- Techdocs, which is the focus of this post.
39+
40+
These features allow you to create standards and best practices across teams. It increases the speed of development. It creates a good developer experience for everyone who uses it. You centralise all your tools and info in one place.
41+
42+
In this post I will take you through the following
43+
44+
- Learn basic concepts and structure of backstage and techdocs
45+
- Install Backstage
46+
- Setup tech docs
47+
- Creating and publishing documentation.
48+
- All on local machine
49+
50+
## **Basics concepts and structures of backstage and techdocs**
51+
52+
The focus of this article is techdocs so i will go through the other main features at a high level.
53+
54+
- Service catalog. It keeps track of ownership and metadata for all the software in your ecosystem. it does this by putting metadata in YAML files stored together with your code. You process these files and then you can visualise the catalog in backstage. This will enable your teams to manage and maintain the software they own. it also makes the software discoverable.
55+
- Software templates - This feature allows you to create templates or skeletons of code. These templates are published to github.
56+
- Plugins - Allow you to integrate third part tools or any kind of infrastructure into backstage. They are open source and you can view a list [here](https://backstage.io/plugins)
57+
- Techdocs- yay, finally, why we are here. Techdocs is Spotify's homegrown docs like code solution. it allows the user to store documentation to near code thus allowing it to be easily discovered.
58+
59+
When you deploy backstage with Techdocs enabled you get a basic out of the box experience.
60+
61+
At its core it is MKDocs plugin and other MkDocs plugins and Python Markdown extensions which allows it to standardize the configuration of MkDocs used for TechDocs.
62+
63+
You can see the code [here](https://github.com/backstage/mkdocs-techdocs-core)
64+
65+
The other moving parts are
66+
67+
- The techdocs container which can be found on Docker-hub, It builds static content through MKDocs
68+
- The Techdocs backend plugin This is the backend part of the techdocs plugin.
69+
- The Techdocs CLI, Command line tool for managing techdocs sites in backstage
70+
- The Techdocs reader, it fetch's remotes pages , run transformers against them and renders them in a shadow DOM
71+
- Transformers API is a function that takes in parameters from the reader component and returns a function which gets passed the dom of the fetched page.
72+
73+
Architecture
74+
75+
![Architecture diagram](https://backstage.io/docs/assets/techdocs/architecture-basic.drawio.svg)
76+
77+
When you open a techdocs sites a request is made the techdocs reader calls the techdocs-backend with the entity id and the path of the current page, the response contains the static content
78+
79+
The static content contains HTML and CSS, javascript is removed for security reasons
80+
81+
Transforms are then applied which modiy the generated static HTML files for a number of reasons like removing certain headers etc
82+
83+
For the following instructions we will use the local file storage but it is better to use cloud storage like S3.
84+
85+
## **Install Backstage**
86+
87+
### Perquisites
88+
Mac running MacOS
89+
90+
Node version 14.x
91+
92+
cookiecutter
93+
94+
If you already have backstage installed then skip this.
95+
96+
```jsx
97+
npx @backstage/create-app
98+
```
99+
100+
You are asked some questions on setup, The recommendation for this tutorial is to go with SQLLite.
101+
102+
![npx install](/images/techdocs/Untitled.png)
103+
104+
If successful you will see this message
105+
106+
![successful](/images/techdocs/01.png)
107+
108+
cd into your directory and run
109+
110+
```jsx
111+
yarn workspace backend start
112+
```
113+
114+
![yarn workspace](/images/techdocs/02.png)
115+
116+
Open a new terminal window and
117+
118+
```jsx
119+
run yarn start
120+
```
121+
122+
![yarn start](/images/techdocs/03.png)
123+
124+
If successful a browser window will open up and you should be presented with a window
125+
126+
![successfull register](/images/techdocs/04.png)
127+
128+
Well done, you have successfully installed backstage on your machine.
129+
130+
## Setup TechDocs
131+
132+
Historically you had to manually add Techdocs , the latest version of create-app bundles tech docs.
133+
134+
to verify this you should be able to see entries for the following plugin
135+
136+
```jsx
137+
'@backstage/plugin-techdocs';
138+
139+
```
140+
141+
in the following files
142+
143+
```jsx
144+
packages/app/src/plugins.ts
145+
packages/app/src/App.tsx
146+
```
147+
148+
## Creating and publishing techdocs
149+
150+
To create docs manually from scratch click on create component
151+
152+
![manuall](/images/techdocs/05.png)
153+
154+
From here choose the Documentation template
155+
156+
![template](/images/techdocs/06.png)
157+
158+
Fill out Name and Description
159+
160+
![Name Desc](/images/techdocs/07.png)
161+
162+
Type in the owner, the Github repo you want to call it , ensure their is no Github repo that exists with the same name or the Templater will fail
163+
164+
![owner](/images/techdocs/08.png)
165+
166+
Once you click on create you will be presented with a Create component status popup.
167+
168+
![create component](/images/techdocs/09.png)
169+
170+
Once the repository has been published to github the create component status popup will go green like below.
171+
172+
![popup](/images/techdocs/10.png)
173+
174+
You will be able to navigate to the docs.
175+
176+
![navigate](/images/techdocs/11.png)
177+
178+
If it is the first time you are loading them you could receive this message while it converts from MD to html
179+
180+
![loading](/images/techdocs/12.png)
181+
182+
Here is what you will be presented with.
183+
184+
![results](/images/techdocs/13.png)
185+
186+
You now have techdocs up and running on your machine, if you want to view the files manually they are located at the following location on you machine
187+
188+
```jsx
189+
backstage/node_modules/@backstage/plugin-techdocs-backend/static/docs/default/Component/
190+
```
191+
192+
The recommended setup is to place the output on to cloud storage and not on the local machine
193+
194+
## Publish to cloud storage
195+
196+
![cloud](/images/techdocs/14.png)
197+
198+
When you startup backstage you should see this message in the logs to confirm you are using cloud storage
199+
200+
![registered](/images/techdocs/15.png)
201+
202+
You will also see the content in the S3 bucket.
203+
204+
![s3](/images/techdocs/16.png)
205+
206+
## Recap
207+
208+
In summary, we went through an introduction on backs stage, techdocs and how to publish techdocs locally and to cloud storage via s3. if you want to learn more about backstage i would recommend visiting [https://backstage.io](https://backstage.io) or if you want to learn more about techdocs then [https://backstage.io/docs/features/techdocs/techdocs-overview](https://backstage.io/docs/features/techdocs/techdocs-overview)
209+
210+
If you like the idea of backstage but don't want the inconvenience of managing backstage yourself then i would check out [https://roadie.io](https://roadie.io).

images/backstage.jpg

272 KB
Loading

images/padraig_o_brien.jpg

13 KB
Loading

images/techdocs/01.png

73.7 KB
Loading

images/techdocs/02.png

1.15 MB
Loading

images/techdocs/03.png

444 KB
Loading

images/techdocs/04.png

343 KB
Loading

images/techdocs/05.png

187 KB
Loading

images/techdocs/06.png

81.8 KB
Loading

0 commit comments

Comments
 (0)