Commit Graph

2415 Commits

Author SHA1 Message Date
Jesse Hallam
f8caa6c841 Job metrics & dynamic Grafana annotations (#16650)
* 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>
2021-01-20 15:43:02 -04:00
Allan Guwatudde
a7e212566d [MM-31112] - Update license renewal email (#16747)
* [MM-31112] - Update license renewal email

* Feedback impl-1

* Update app/license.go

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>

* Feedback impl-2

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
2021-01-20 19:57:29 +03:00
Allan Guwatudde
81b06b5b72 Switch creation of users to use app method vs client method (#16673)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-20 12:25:18 +03:00
Scott Bishel
d5e966fdbe fix error message (#16581)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-15 13:32:54 -07:00
Ibrahim Serdar Acikgoz
83d31ec907 [MM-31573] update log levels for the app package (#16629)
* update log levels for the app package

* reflect review comments

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-15 09:58:34 +03:00
Eli Yukelzon
b0bddeb5e6 MM-29988 - Update exising Post APIs with collapsed threads (#16503) 2021-01-14 13:46:27 +02:00
Eli Yukelzon
110ac3b1ec MM-30338 Add feature flag for collapsedthreads (#16598)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-13 12:42:35 +02:00
Hossein
4d5ca92a04 [MM-28000] Fix system manager can download export files without right permissions (#16569)
Automatic Merge
2021-01-12 20:45:17 +01:00
Christopher Speller
866e938a12 MM-31699 Don't downgrade plugins with feature flag for on-prem (#16639)
* 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>
2021-01-12 09:30:48 -08:00
Scott Bishel
bced2b2fd2 update missing translation string (#16559)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-11 17:43:56 -07:00
Agniva De Sarker
e89b26e8f3 goimports (#16640)
* 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>
2021-01-07 22:42:43 +05:30
Agniva De Sarker
092c07a18c MM-31370: Fix racy TestClusterShutdownRace (#16562)
* 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>
2021-01-07 15:38:37 +05:30
Agniva De Sarker
09d2f698cc MM-31061: Remove pointers to slice (#16631)
* 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
2021-01-06 21:23:00 +05:30
Christopher Speller
b40a93d68b MM-28861 Marketplace feature flags (#16451)
* 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>
2021-01-04 13:21:02 -08:00
Harrison Healey
1933f7eb76 MM-30810 Remove special props from /me post (#16456)
* MM-30810 Remove special props from /me post

* Update unit test

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-04 14:13:38 -05:00
Agniva De Sarker
c1dd23a3c8 MM-31063: Change constants to use CamelCase (#16608)
* 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>
2021-01-04 11:32:29 +05:30
Ayan Banerjee
55f5932ed5 [MM-31555] Print golang version on server startup (#16610)
* 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>
2021-01-02 23:35:22 +05:30
Ibrahim Serdar Acikgoz
40e16ba07f [MM-31359] remove duplicated error logs (#16583)
* remove duplicated error logs

* reflect review comments

* add context

* add error details
2020-12-29 09:48:36 +03:00
Agniva De Sarker
c54b262351 MM-31356: Add a minimum required version check for Postgres (#16597)
* 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
2020-12-23 22:06:13 +05:30
Ibrahim Serdar Acikgoz
8036ba86e7 [MM-31398] upgrade error level to critical in case of panic or os.Exit (#16584)
* upgrade error level to critical in case of panic or os.Exit

* reflect revivew comments

* fix error capitalization
2020-12-23 13:11:35 +03:00
Agniva De Sarker
6487d0ca91 MM-31062: Rewrite empty string checks to be more idiomatic (#16587)
https://mattermost.atlassian.net/browse/MM-31062

```release-note
NONE
```
2020-12-22 19:20:59 +05:30
Agniva De Sarker
1a131b54af MM-31064: Simplify indentation (#16565)
* MM-31064: Simplify indentation

Reduce indentation where possible.

```release-note
NONE
```

Command ran to verify:
golangci-lint run --disable-all --enable golint --max-issues-per-linter=10000 --max-same-issues=100000 ./... | grep "block ends with a return state"

https://mattermost.atlassian.net/browse/MM-31064

* incorporate review comments

* enable golint for outdent rule

* fix remaining issues

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-21 18:50:47 +03:00
Jesús Espino
7419898449 Remove usages of AppError on filesstore service (#15841)
* 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
2020-12-20 12:53:07 +01:00
Mario de Frutos Dieguez
94fe01dc1d [MM-30539] New renewal link logic (#16539)
* 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
2020-12-18 16:40:46 +01:00
Nick Misasi
2447ce9bca [MM-30984] Change default footer for copyright in 2 emails (#16508)
* 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>
2020-12-16 13:51:40 -05:00
Agniva De Sarker
0cf37d0f3c MM-3124: Fix racy test TestPluginPanicLogs (#16541)
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
```
2020-12-15 19:19:53 +05:30
Jason Blais
8e221c1895 [MM-31018] Update email address for admin advisor contact requests to support-advisor@mattermost.com (#16443)
Automatic Merge
2020-12-15 05:15:17 +01:00
Agniva De Sarker
fa1f2a8504 MM-31323: Fix racy test TestHandleCommandResponsePost (#16542)
In https://github.com/mattermost/mattermost-server/pull/16089,
we added logic to modify the notification text in the presence
of fallback text.

Unfortunately, that created a race condition during publishing
the post via websockets. To fix this, we create a clone of the post
before sending it off for push notifications.

https://mattermost.atlassian.net/browse/MM-31323

```release-note
NONE
```
2020-12-14 14:24:12 +05:30
Haardik Dharma
609c8166f2 [MM-30911]: Change receiver name for (me *TestHelper) in app/slashcommands/helper_test.go to be more idiomatic. (#16387)
Automatic Merge
2020-12-12 15:45:17 +01:00
Haardik Dharma
0dee08fa31 Update command_me.go (#16522)
Automatic Merge
2020-12-12 07:15:17 +01:00
Haardik Dharma
caaa5690b6 Update command_echo.go (#16521)
Automatic Merge
2020-12-12 06:15:17 +01:00
Haardik Dharma
625185cb5b Update command_online.go (#16493)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-11 22:51:06 +05:30
Haardik Dharma
93a4c7bc7e Update command_groupmsg.go (#16487)
Automatic Merge
2020-12-11 17:45:18 +01:00
Haardik Dharma
b8e9bac921 Update command_code.go (#16486)
Automatic Merge
2020-12-11 16:45:18 +01:00
Claudio Costa
6c976c3b06 Generate preview regardless of HasPreviewImage value (#16535)
Automatic Merge
2020-12-11 00:15:17 +01:00
Haardik Dharma
7fb5476c64 Update command_channel_header.go (#16485)
Automatic Merge
2020-12-10 17:15:17 +01:00
Haardik Dharma
f2aafac0c9 Update cluster_discovery.go (#16484)
Automatic Merge
2020-12-10 16:15:18 +01:00
Agniva De Sarker
44eb3e3f97 MM-31326: Fix Striped LRU to have minimum of 1 bucket (#16531)
* MM-31326: Fix Striped LRU to have minimum of 1 bucket

https://mattermost.atlassian.net/browse/MM-31236

```release-note
NONE
```

* Using a maxInt function
2020-12-10 19:51:52 +05:30
Haardik Dharma
5f0f5a7a7f Update command_shortcuts.go (#16494)
Automatic Merge
2020-12-09 15:45:18 +01:00
Florent Peterschmitt
349b83f23a implement and use striped LRU cache to lower mutex contention (#15764)
* Implement Striped LRU cache

* ci

* fix

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-09 19:25:14 +05:30
Scott Bishel
f548ecbee1 MM-27688-OpenId Connect (#16222)
* implement openid connect

* update error strings

* handle OpenIdSetting.Secret as FAKE SETTING

* add openid to telemetry

* update config defaults, add telemetry

* fix bug with Office365

* Retrieve Office365 AuthData from IdToken

* fix linter

* add feature flag, reset defaults for config

* fix build error

* fix unit tests

* add authentication permission to Feature
Flags

* turn off feature flag

* set default button color

* set default button color only on openid

* fix for merging FeatureFlags in config

* remove feature flag

* revert config changes

* remove debug statements

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-08 19:58:37 -07:00
Hossein
d666bb8b3d Add Billing Permissions (#16364)
* add billing permissions

* update store.go

* Update permission.go

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-08 12:41:28 -05:00
Haardik Dharma
977ad99af6 Update command_shrug.go (#16481)
Automatic Merge
2020-12-08 18:15:18 +01:00
Haardik Dharma
81854aea5c Update command_mute.go (#16479)
Automatic Merge
2020-12-08 11:15:17 +01:00
Doug Lauder
46fc0c640c MM-30986 Move global logger init until after server logger fully configured (#16426)
- move the initGlobalLogger call to the end of initLogging so a copy of a fully configured logger is made for global logging.
2020-12-07 09:50:45 -05:00
Eli Yukelzon
86e228b6c6 MM-30558 - Add unreadReplies and unreadMentions to thread membership (#16304) 2020-12-06 10:02:53 +02:00
Ibrahim Serdar Acikgoz
cc5a12bad0 app/import_functions: fix a bug while improting for two teams (#16455)
Automatic Merge
2020-12-04 18:45:17 +01:00
Haardik Dharma
4e2a33386b [MM-30913]: Change receiver name for (me *CollapseProvider) in app/slashcommands/command_expand_collapse.go to be more idiomatic. (#16389)
Automatic Merge
2020-12-04 07:15:17 +01:00
Nick Misasi
fa5a033f66 [MM-30984] Missing payment email on billing day if no CC is present (#16442)
* 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>
2020-12-03 16:02:43 -05:00
Claudio Costa
df906cad9d [MM-28422] Enable processing of import files through API (#16062)
* 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
2020-12-03 11:38:00 +01:00