The docs are generated with Slate.
Api-docs for api version 2 is placed at directory source
.
All documented resources located in directories source_v{API_VER}/include
. You can edit existing files there or create new files (resources).
For example, you want to create docs for new api of version 15.
- In
api-docs
root, create directory calledsource_15
and add thereSlate
initial files (or copy/paste from some anothersource_{API_VER}
directory) - In
./.nginx/.conf
add newlocation
directive insideserver
directive:
location /api-v15 {
alias /usr/src/app/build_v15;
}
- Add these commands at the end of
RUN
command at image ofdependencies
at./Dockerfile
:
cp -a ./source_v15 ./source && \
bundle exec middleman build && \
rm -rf ./source && \
rm -rf ./build_v15 && \
mv ./build ./build_v15
- Add this command to the list of
COPY
commands at image ofrelease
at./Dockerfile
:
COPY --from=dependencies /usr/src/app/build_v15 ./build_v15
(replace v15 with your api version)
In case the api-docs have to be "re-branded" for a special customer, there are a few build-arguments which point by default to elastic.io original values:
- toc_footer: The text or HTML-Fragment displayed at the bottom of the Table of Contents (default: Link to sign-up for a developer key)
- api_base_url: Url of the customers API (default: https://api.elastic.io)
- product_name: Name of this API product (default: elastic.io)
- logo_url: URL to refer the customers logo (default: https://app.elastic.io/img/logo.svg)
- repo_name: Name of github repository name (default: elasticio)
- docs_url: Link to the main documentation (default: http://docs.elastic.io/docs)
- favicon_url: Link to the favicon (default: https://app.elastic.io/favicon.ico)
So a complete build for a customer overwriting everything may be e.g.:
docker build -t apidocs:telekom \
--build-arg "toc_footer=Some Footer Text" \
--build-arg "api_base_url=http://api.customer.org" \
--build-arg "product_name=Customer API Name" \
--build-arg "logo_url=https://customer.logo.url/svg-image.svg" \
--build-arg "repo_name=customer-repo" \
--build-arg "favicon_url=https://favicon.url/favicon.ico"
.
- Run the
api-docs
:
docker run --rm -p 8000:8000 -d elasticio/api-docs:master
-
Open in your browser: http://localhost:8000/
-
Ensure that everything is ok.
-
Stop the
api-docs
:
docker stop api-doc-master
All docker builds could be checked here.
- Build docker image:
docker build -t api-docs .
- Run container of newly built docker image (for example, at port
8081
)
docker run --rm -p 8081:8000 -d api-docs
- Access docs for api version at
localhost:8081
- Install required tools
apt-get update && \ apt-get install -y ruby rubygems ruby-dev build-essential && \ gem install bundler && \ bundle install
- Create directory
source
and paste there files fromsource_{SOME_API_VER}
- Run
bundle exec middleman build
This command will create directory build
with static website files.
- Open
build/index.html
in browser