Update README

This commit is contained in:
Anthony Lapenna
2016-09-30 18:44:48 +13:00
parent b2c84fa20c
commit 1adafdabe3

View File

@@ -1,95 +1,12 @@
# App Templates # App Templates
This repository hosts the official templates (**'Apps'**) definitions for portainer. [![Documentation Status](https://readthedocs.org/projects/portainer/badge/?version=stable)](http://portainer.readthedocs.io/en/stable/?badge=stable)
It also describes how to host your own Apps. This repository hosts the official templates (**'Apps Templates'**) definitions for portainer.
## Template definition format Documentation is available [ReadTheDocs](http://portainer.readthedocs.io/en/stable/templates.html) for more information about the template definition format and how to deploy your own templates.
Template definitions are written in *JSON*. ## Portainer templates:
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
* `description`: 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.
*Format*:
```json
{
"name": "the name of the environment variable, as supported in the container image (mandatory)",
"label": "label for the input in the UI (mandatory)",
"set": "pre-defined value for the variable, will not generate an input in the UI (optional)"
}
```
Example:
```json
{
"name": "MYSQL_ROOT_PASSWORD",
"label": "Root password"
}
```
* `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",
"description": "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/portainer/templates.git
$ cd ui-templates
# Edit the file templates.json
$ docker build -t portainer-templates .
$ docker run -d -p "8080:80" portainer-templates
```
Now you can access your templates definitions at `http://docker-host:8080/templates.json`.
You can also mount the `templates.json` file inside the container, so you can edit the file and see live changes:
```shell
$ docker run -d -p "8080:80" -v "${PWD}/templates.json:/usr/share/nginx/html/templates.json" portainer-templates
```
## Available apps:
* Docker registry (based on `registry:latest`) * Docker registry (based on `registry:latest`)
* Nginx (based on `nginx:latest`) * Nginx (based on `nginx:latest`)