[MM-26997] Use socket API to deploy plugins, if available (#108)
* Use socket API if available * Make socket path configurable by env var * Add local mode docs to README * Change README wordings * Add log when using local mode. Change error handling for local mode deploy. * address requests in pluginctl and update mattermost-server * check if MM_LOCALSOCKETPATH is present before logging * update go.sum
This commit is contained in:
parent
2d65fe1e26
commit
4523a0a25e
4 changed files with 510 additions and 103 deletions
45
README.md
45
README.md
|
@ -36,7 +36,43 @@ dist/com.example.my-plugin.tar.gz
|
|||
|
||||
## Development
|
||||
|
||||
To avoid having to manually install your plugin, build and deploy your plugin with login credentials:
|
||||
To avoid having to manually install your plugin, build and deploy your plugin using one of the following options.
|
||||
|
||||
### Deploying with Local Mode
|
||||
|
||||
If your Mattermost server is running locally, you can enable [local mode](https://docs.mattermost.com/administration/mmctl-cli-tool.html#local-mode) to streamline deploying your plugin. Edit your server configuration as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"ServiceSettings": {
|
||||
...
|
||||
"EnableLocalMode": true,
|
||||
"LocalModeSocketLocation": "/var/tmp/mattermost_local.socket"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
and then deploy your plugin:
|
||||
```
|
||||
make deploy
|
||||
```
|
||||
|
||||
You may also customize the Unix socket path:
|
||||
```
|
||||
export MM_LOCALSOCKETPATH=/var/tmp/alternate_local.socket
|
||||
make deploy
|
||||
```
|
||||
|
||||
If developing a plugin with a webapp, watch for changes and deploy those automatically:
|
||||
```
|
||||
export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
|
||||
export MM_ADMIN_TOKEN=j44acwd8obn78cdcx7koid4jkr
|
||||
make watch
|
||||
```
|
||||
|
||||
### Deploying with credentials
|
||||
|
||||
Alternatively, you can authenticate with the server's API with credentials:
|
||||
```
|
||||
export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
|
||||
export MM_ADMIN_USERNAME=admin
|
||||
|
@ -51,13 +87,6 @@ export MM_ADMIN_TOKEN=j44acwd8obn78cdcx7koid4jkr
|
|||
make deploy
|
||||
```
|
||||
|
||||
If developing a plugin with a webapp, watch for changes and deploy those automatically:
|
||||
```
|
||||
export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
|
||||
export MM_ADMIN_TOKEN=j44acwd8obn78cdcx7koid4jkr
|
||||
make watch
|
||||
```
|
||||
|
||||
## Q&A
|
||||
|
||||
### How do I make a server-only or web app-only plugin?
|
||||
|
|
Reference in a new issue