Service Guides are created using GDS Tech Docs Templates. The generated HTML files are then served by a simple Scala Play application so that they can be deployed as an MDTP microservice.
Examples of Service Guides can be seen in API Documentation in Developer Hub.
Read Tech Docs Templates and Documentation on using Tech Docs Templates.
The serviceName is generally the same name as the git repository.
- Edit
./build.sbt
changeval appName = "service-guide-skeleton"
to your serviceName. - Edit
./conf/application.conf
changeappName=service-guide-skeleton
to your serviceName. - Edit
./conf/prod.routes
change/guides/example-service-guide
to the route that will be used to access the service guide.
- Edit
config/tech-docs.yml
- Change
service_name
to a human-readable name of your service guide - Change
service_link
, to the route that will be used to access the service guide. (same as what was added to./conf/prod.routes
)
- Change
Template files are located in ./source/documentation
. All pages are written in Markdown.
To add new pages simply copy and paste one of the existing pages, it will automatically appear in the menu.
example-page.html.md.erb
provides examples and best practices styles.
Requirements:
To live preview:
./batect preview
The local URL and port where the files can be previewed will be output, this is normally http://localhost:4567.
NB The first time this is run it builds the Docker image and installs dependencies so may take 5 mins. Subsequent runs will be much quicker.
Requirements:
To live preview:
bundle install
bundle exec middleman serve
The local URL and port where the files can be previewed will be output, this is normally http://localhost:4567.
Requirements:
- Scala/sbt
./batect build
sbt run
The local URL and port where the files can be previewed will be output, this is normally http://localhost:9000.
Create a build job like:
new SbtMicroserviceJobBuilder(TEAM, 'service-guide-skeleton')
.withTests("test")
.withNodeJs(version = '16.11.0')
.build(this as DslFactory)
NB the version of Ruby is automatically picked up from .ruby-version
. But the Node version isn't! Make sure that the
version you specify on the build job is the same as what is in .node-version
.
The easiest and safest option would be:
- Clone this git repository into a new directory.
- Follow the Getting started section above, copying the settings from your original project.
- Copy the
./source
directory from your original project. - Copy all files from the new directory to overwrite your original project. (except the
.git
directory) - Check the build job has the correct Node version specified.
- Commit and push changes from your original project.
To update the Ruby Gems to the latest versions, run
./batect update
This will update the Gemfile.lock
Edit .ruby-version
with the required version of Ruby.
Edit .node-version
with the required version of Node.
This code is open source software licensed under the Apache 2.0 License.