From 9e3d4b6dc5940e1ff26717eeb1d0510477725238 Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Tue, 23 Aug 2016 18:07:59 +1200 Subject: [PATCH] Add documentation --- README.md | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b3110c2..0c6d054 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,62 @@ # UI templates -WIP +This repository describes how to host your own Apps in CloudInovasi UI for Docker. + +## Template definition format + +Template definitions are written in *JSON*. + +It must consist of an array with every template definition consisting of one element. + +### Template format + +A template element must be a *JSON* object with the following mandatory fields: + +* title: Title of the template +* comment: Description of the template +* logo: URL for the template logo +* image: the Docker image associated to the template + +The following fields are optional: + +* env: An array describing the environment variables required by the template. +For each variable, an input will be created in the UI. +* volumes: An array describing the associated volumes of the template. +For each volume, a Docker volume will be created and associated when starting the template. +* ports: An array describing the ports exposed by template. +Each port will be automatically bound on the host by Docker when starting the container. + +**Example**: + +```json +{ + "title": "MySQL", + "comment": "The most popular open-source database", + "logo": "https://upload.wikimedia.org/wikipedia/en/thumb/6/62/MySQL.svg/640px-MySQL.svg.png", + "image": "mysql:latest", + "env": [ + { + "name": "MYSQL_ROOT_PASSWORD", + "label": "Root password" + } + ], + "volumes": ["/var/lib/mysql"], + "ports": ["3306/tcp"] +} +``` + +## Host your own templates + +You can build your own container that will use **nginx** to serve the templates definitions. + +Clone the repository, edit the templates file, build and run the container: + +```shell +$ git clone https://github.com/cloud-inovasi/ui-templates.git +$ cd ui-templates +# Edit the file templates.json +$ docker build -t cloudinovasi-ui-templates . +$ docker run -d -p "8080:80" cloudinovasi-ui-templates +``` + +Now you can access your templates definitions at `http://docker-host:8080/templates.json`.