Skip to content

Commit 19e281f

Browse files
committed
Add basic plugins documentations
Closes #195
1 parent f6fd921 commit 19e281f

File tree

3 files changed

+71
-2
lines changed

3 files changed

+71
-2
lines changed

docs/Advanced.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,9 @@ Current caveats:
7272

7373
- Currently secrets only work for environment variables
7474
- Currently secrets work only for normal deployments (any template or recipe that uses `startFromParams` won't have secrets expanded)
75+
76+
## Plugins
77+
78+
Exoframe-Server supports extension of core features using plugins.
79+
Plugins are installed and loaded automatically once corresponding config is added to [server configuration](ServerConfiguration.md).
80+
Refer to specific plugins docs to see how to configure them.

docs/PluginsGuide.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Plugins guide
2+
3+
Exoframe allows extending the core functionality of Exoframe-Server using third party plugins.
4+
This guide aims to explain basics you need to know to create your own plugins.
5+
If you are looking for plugins usage - please see [Advanced](Advanced.md) part of the docs.
6+
7+
## Basics
8+
9+
Exoframe uses [yarn](https://yarnpkg.com/) to install and remove third-party plugins.
10+
The plugins then are added to Exoframe-Server using Node.js `require()` method.
11+
So, make sure that your plugin's `package.json` has correct `main` attribute.
12+
13+
Your plugins main script needs to export the following variables and methods:
14+
15+
```js
16+
module.exports = {
17+
// plugin default config
18+
config: {
19+
// plugin name
20+
name: 'exoframe-plugin-swarm',
21+
// whether plugin requires exclusive hooks to exoframe methods
22+
// exclusive hooks are the only ones being executed
23+
// make sure you only run ONE exclusive plugin at a time
24+
exclusive: true,
25+
},
26+
27+
/* plugin functions that hook into Exoframe-Server methods */
28+
// server init function hook
29+
// should initialize traefik, setup networks, etc
30+
init,
31+
// exoframe start function hook
32+
// should start a deployment from files
33+
start,
34+
// exoframe startFromParams function hook
35+
// should start a deployment from given set of params
36+
startFromParams,
37+
// exoframe list function hook
38+
// should list currently active deployments
39+
list,
40+
// exoframe logs function hook
41+
// should get logs for a given deployment
42+
logs,
43+
// exoframe remove function hook
44+
// should remove a given deployment
45+
remove,
46+
// exoframe compose template extension
47+
// can affect how docker-compose template is executed
48+
compose,
49+
};
50+
```
51+
52+
## Examples
53+
54+
- [Swarm plugin](https://github.com/exoframejs/exoframe-plugin-swarm)

docs/ServerConfiguration.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
## Server Configuration
32

43
Exoframe stores its config in `~/.exoframe/server.config.yml`.
@@ -45,6 +44,16 @@ publicKeysPath: '/path/to/your/public/keys'
4544

4645
# whether Exoframe server whould be running in swarm mode, default "false"
4746
swarm: false
47+
48+
# plugins config
49+
plugins:
50+
# list of plugins that has to be installed and loaded by exoframe-server on startup
51+
install: ['exoframe-plugin-swarm']
52+
# specific plugin config (see plugins docs to know what property they use)
53+
swarm:
54+
enabled: true
4855
```
4956
50-
_Warning:_ Most changes to config are applied immediately. With exception of Letsencrypt config. If you are enabling letsencrypt after Traefik instance has been started, you'll need to remove Traefik and then restart Exoframe server for changes to take effect.
57+
_Warning:_ Most changes to config are applied immediately. With exception of Letsencrypt config and Plugins config.
58+
If you are enabling letsencrypt after Traefik instance has been started, you'll need to remove Traefik and then restart Exoframe server for changes to take effect.
59+
If you are adding plugins after server has been started, you'll need to restart the server so that it can install and load newly added plugins.

0 commit comments

Comments
 (0)