[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:
Michael Kochell 2020-07-29 05:21:46 -04:00 committed by GitHub
parent 2d65fe1e26
commit 4523a0a25e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 510 additions and 103 deletions

View file

@ -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?