doc/pages/06.contribute/10.packaging_apps/10.multi_instance/packaging_apps_multiinstance.md

27 lines
1.1 KiB
Markdown
Raw Normal View History

2020-11-11 11:47:10 +01:00
---
title: Multi-instances
template: docs
taxonomy:
category: docs
routes:
default: '/packaging_apps_multiinstance'
2020-11-11 11:47:10 +01:00
---
2016-02-24 23:30:16 +01:00
2016-02-25 13:13:38 +01:00
Multi-instance is application capacity to be installed several times.
2016-02-24 23:30:16 +01:00
#### Scripts
2020-09-30 18:19:44 +02:00
When YunoHost installs the application, it passes `$YNH_APP_INSTANCE_NAME` var to the script, set to value `id__n` with the application `id` coming from the manifest and `n` being an integer incremented each time a new instance of the application is installed.
2016-02-24 23:30:16 +01:00
2020-09-15 13:57:31 +02:00
**E.g.** in the Roundcube script, database is called `roundcube`, the install directory `roundcube` and the [NGINX configuration](/packaging_apps_nginx_conf) `roundcube`. This way, the second instance of Roundcube will not conflict with the first one, and will be installed in the `roundcube__2` database, in the `roundcube__2`directory, and with the `roundcube__2` NGINX configuration.
2016-02-24 23:30:16 +01:00
Retrieve app identifier (including the multi-instance id):
2016-02-24 23:30:16 +01:00
```bash
app=$YNH_APP_INSTANCE_NAME
2016-02-24 23:30:16 +01:00
```
#### Manifest
2020-03-28 06:54:10 +01:00
Set `multi_instance` variable to `true` in the [manifest](/packaging_apps_manifest):
2016-02-24 23:30:16 +01:00
```json
"multi_instance": true,
```