Application templates¶
This document explains the Application templates feature in Fleio.
A Fleio Application template consists of a set of customizable scripts that can be used to configure an instance when it is created.
Currently, application templates are only compatible with Linux instances with cloud init support.
User flow¶
When the user creates an instance, if the Application templates features is enabled and some application templates were configured in Fleio, the user will be presented with a list of applications template to select from.
The user can the select one of the available applications, configure required and optional parameters, and proceed to launch the instance.
If the instance is launched with a configured application template, Fleio will automatically deploy the selected application within the launched instance.
Application repository¶
Fleio supports loading and using application templates from Git repositories. It can search for application templates either in the root of the repository or within a specified path.
Each directory within the designated repository path that follows the correct structure is recognized as an application template.
Application template directory structure¶
An application template directory must contain a scripts subdirectory and a fleio-metadata.yaml file. If both are present and the fleio-metadata.yaml file loads successfully, the directory is treated as a valid application template and imported into Fleio.
Scripts folder¶
Scripts folder can contain any script file. Parameters are replaced in these files based on fleio-medatata.yaml specifications.
On deploy all the files in this directory will be copied to the target instance in “/root/init-scripts” directory.
Fleio Metadata File (YAML)¶
The Fleio metadata file is a YAML file that defines metadata for an application. The following top-level tags are supported:
Example¶
version: 1
application_info:
name: "MyApp"
description: "Deploys MyApp"
requirements:
memory_mb: 1024
disk_gb: 10
distributions:
- ubuntu
initial_command: "bash ./setup.sh"
parameters:
user_name:
type: "text"
display_name: "Username"
description: "Name of the user to create"
default: "admin"
script_file: "setup.sh"
placeholder: "{user-name}"
mode:
type: "choice"
display_name: "Mode"
description: "Install mode"
default: "basic"
required: true
script_file: "setup.sh"
placeholder: "{mode}"
options:
- basic
- full
With this file, Fleio replaces {user-name} and {mode} in scripts/setup.sh with the values the user selects.
How are applications deployed¶
When deploying an application, Fleio follows these steps:
Copy the application folder from the repository.
Replace parameters in the script files as needed.
Create an archive of the
scriptsfolder contents.Generate a cloud-init script that performs the following actions:
Writes the scripts archive to the instance.
Extracts the archive into the
/root/init-scriptsfolder.Executes the
initial_command(default:bash ./setup.sh).
Demo application repository¶
Fleio provides a public application repository for demo and testing purposes located at https://github.com/fleio/demo-application-repositories. This repository contains two demo application templates, one that deploys WordPress and one that deploys Wagtail CMS.
To use this repository you must first add it to Fleio - see Staff / Cloud / Application repositories for details on how to do this.
Once the repository is added to Fleio you can use templates by navigating to instances page select a template when creating an instance.