* docker: prometheus and grafana for development
Add prometheus and grafana docker configuration when developing with access to the enterprise repository. This simplifies the setup for developers adding new metrics or even examining events from their development server. The services are disabled by default when no enterprise source is detected.
Grafana is provisioned automatically with the Prometheus datasource, as well as the canonical dashboards used with Mattermost. Furthermore, no authentication is required to access Grafana to simplify access from a development environment. The default home dashboard is customized to automatically show links to the provisioned dashboards. Dashboards can be saved, and login remains available via the default `admin/admin` credentials (which initiates a password reset), but no dashboard or system configuration is (currently) persisted if the container is destroyed.
Linux requires slightly special handling (well, really it's Docker for MacOS/Windows), in that `host.docker.internal` is the canonical way to resolve the host on MacOS/Windows, but on Linux it's usually sufficient to just use `localhost`. Until https://github.com/docker/for-linux/issues/264 is resolved, this PR includes code to customize the Prometheus configuration to point at the required address for the running platform.
* metrics: track active jobs by type
* metrics: active jobs chart
* metrics: server start and job annotations
* Update build/docker-compose.common.yml
Co-authored-by: Claudio Costa <cstcld91@gmail.com>
* prometheus: resolve docker host via 172.17.0.1 instead
* skip enabling prometheus and grafana by default
* handle JOB_STATUS_ERROR and JOB_STATUS_CANCELED end states
* handle nil srv.metrics
* lookup job to determine type for metrics
* mocked unit tests for jobs
* goimports lint fixes
* missing license
* add instance to server start tag
* filter annotations by selected instance
Co-authored-by: Claudio Costa <cstcld91@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Don't downgrade plugins with feature flag for on-prem
* Update app/plugin.go
Co-authored-by: Christopher Poile <cpoile@gmail.com>
* Short circut for plugin doesn't exist.
Co-authored-by: Christopher Poile <cpoile@gmail.com>
* format using `goimports -local github.com/mattermost/mattermost-server/v5 -w`
* added goimports lint check to .golangci.yml
* format using `goimports -local github.com/mattermost/mattermost-server/v5 -w` for a corner case
* make app-layers, *-mocks and store-layers for ci check
Co-authored-by: Mahmudul Haque <mahmudulhaque@protonmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* MM-31370: Fix racy TestClusterShutdownRace
This race wasn't specific to this test, but somehow got triggered by it.
This was a critical race because the PluginsLock is widely used
throughout the codebase to gate access to the PluginsEnvironment.
However, a config listener can often run in its own goroutine leading to
a wide variety of races.
https://mattermost.atlassian.net/browse/MM-31370
```release-note
NONE
```
* incorporate review comments
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* MM-31061: Remove pointers to slice
This PR removes instances of pointers
to slices in the codebase. There are some other instances in app/import_functions.go
but that's necessary to prevent empty arrays from appearing in the JSON output.
```release-note
NONE
```
https://mattermost.atlassian.net/browse/MM-31061
* fix tests
* Installing plugins specified by feature flags using the marketplace.
* Switch back to using getplugins client.
* Respect disabling automatic installation of pluings.
* pluginid -> plugin_id
* Debug logs for enable plugin error
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* MM-31063: Change constants to use CamelCase
* store package
* change allcaps to camel case (#16615)
* New tools.mod
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
* Added log to print golang version before running Server
* Minor fix
* Review Fixes
* Review Fixes - 2
* Update app/server.go
Co-authored-by: Claudio Costa <cstcld91@gmail.com>
Co-authored-by: Claudio Costa <cstcld91@gmail.com>
* MM-31356: Add a minimum required version check for Postgres
To keep conformance with our failing fast and obvious philosophy,
we add a check to prevent Mattermost server from starting
if the postgres version is below 10.0.
This gives customers a chance to upgrade their database before upgrading
their Mattermost version, than to run into weird compatibility issues
after they have finished the upgrade.
https://mattermost.atlassian.net/browse/MM-31356
```release-note
NONE
```
* fix lint errors
* Use a function to pretty-print version string
* rectify comment
* Remove usages of AppError on filesstore service
* Fixing a golint error
* Fixing shadowed variable
* Adding err.Error() to the NewAppError calls
* Fixing tests
* Adding missed translations
* Fix error handling and updating the translation that affects it
* Fixing two typos
* New renewal link logic
Endpoint and logic that returns the renewal link to be used to start the
license renewal process.
* Limit access for restricted sysadmins
* Include active users in the renewal token
* Change default footer for copyright in 2 emails
* Change copyright date to 2020
* Add something back
* Put back to 2020
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
We shutdown all plugins prior to checking the log buffer
so that there are no active plugins writing to the buffer
when we read the contents.
https://mattermost.atlassian.net/browse/MM-31324
```release-note
NONE
```
* Adding email and scaffolding for payment failure in case where customer has not added payment method
* Adding email template
* Remove unused boolean
* Fix error
* Add Email Us verbiage
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Implement unzip function
* Implement FileSize method
* Implement path rewriting for bulk import
* Small improvements
* Add ImportSettings to config
* Implement ListImports API endpoint
* Enable uploading import files
* Implement import process job
* Add missing license headers
* Address reviews
* Make path sanitization a bit smarter
* Clean path before calculating Dir
* [MM-30008] Add mmctl support for file imports (#16301)
* Add mmctl support for import files
* Improve test
* Remove unnecessary handlers
* Use th.TestForSystemAdminAndLocal
* Make nouser id a constant