cmd: remove platform binary (#17712)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d1eeafb29f
Коммит
0e42613aef
1
Makefile
1
Makefile
@@ -576,7 +576,6 @@ clean: stop-docker ## Clean up everything except persistant server data.
|
|||||||
rm -f *.out
|
rm -f *.out
|
||||||
rm -f *.test
|
rm -f *.test
|
||||||
rm -f imports/imports.go
|
rm -f imports/imports.go
|
||||||
rm -f cmd/platform/cprofile*.out
|
|
||||||
rm -f cmd/mattermost/cprofile*.out
|
rm -f cmd/mattermost/cprofile*.out
|
||||||
|
|
||||||
nuke: clean clean-docker ## Clean plus removes persistent server data.
|
nuke: clean clean-docker ## Clean plus removes persistent server data.
|
||||||
|
|||||||
@@ -132,10 +132,8 @@ endif
|
|||||||
@# Copy binary
|
@# Copy binary
|
||||||
ifeq ($(BUILDER_GOOS_GOARCH),"darwin_amd64")
|
ifeq ($(BUILDER_GOOS_GOARCH),"darwin_amd64")
|
||||||
cp $(GOBIN)/mattermost $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
cp $(GOBIN)/mattermost $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
||||||
cp $(GOBIN)/platform $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
|
||||||
else
|
else
|
||||||
cp $(GOBIN)/darwin_amd64/mattermost $(DIST_PATH)/bin # from cross-compiled bin dir
|
cp $(GOBIN)/darwin_amd64/mattermost $(DIST_PATH)/bin # from cross-compiled bin dir
|
||||||
cp $(GOBIN)/darwin_amd64/platform $(DIST_PATH)/bin # from cross-compiled bin dir
|
|
||||||
endif
|
endif
|
||||||
#Download MMCTL for OSX
|
#Download MMCTL for OSX
|
||||||
scripts/download_mmctl_release.sh "Darwin" $(DIST_PATH)/bin
|
scripts/download_mmctl_release.sh "Darwin" $(DIST_PATH)/bin
|
||||||
@@ -167,10 +165,8 @@ endif
|
|||||||
@# Copy binary
|
@# Copy binary
|
||||||
ifeq ($(BUILDER_GOOS_GOARCH),"windows_amd64")
|
ifeq ($(BUILDER_GOOS_GOARCH),"windows_amd64")
|
||||||
cp $(GOBIN)/mattermost.exe $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
cp $(GOBIN)/mattermost.exe $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
||||||
cp $(GOBIN)/platform.exe $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
|
||||||
else
|
else
|
||||||
cp $(GOBIN)/windows_amd64/mattermost.exe $(DIST_PATH)/bin # from cross-compiled bin dir
|
cp $(GOBIN)/windows_amd64/mattermost.exe $(DIST_PATH)/bin # from cross-compiled bin dir
|
||||||
cp $(GOBIN)/windows_amd64/platform.exe $(DIST_PATH)/bin # from cross-compiled bin dir
|
|
||||||
endif
|
endif
|
||||||
#Download MMCTL for Windows
|
#Download MMCTL for Windows
|
||||||
scripts/download_mmctl_release.sh "Windows" $(DIST_PATH)/bin
|
scripts/download_mmctl_release.sh "Windows" $(DIST_PATH)/bin
|
||||||
@@ -202,10 +198,8 @@ endif
|
|||||||
@# Copy binary
|
@# Copy binary
|
||||||
ifeq ($(BUILDER_GOOS_GOARCH),"linux_amd64")
|
ifeq ($(BUILDER_GOOS_GOARCH),"linux_amd64")
|
||||||
cp $(GOBIN)/mattermost $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
cp $(GOBIN)/mattermost $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
||||||
cp $(GOBIN)/platform $(DIST_PATH)/bin # from native bin dir, not cross-compiled
|
|
||||||
else
|
else
|
||||||
cp $(GOBIN)/linux_amd64/mattermost $(DIST_PATH)/bin # from cross-compiled bin dir
|
cp $(GOBIN)/linux_amd64/mattermost $(DIST_PATH)/bin # from cross-compiled bin dir
|
||||||
cp $(GOBIN)/linux_amd64/platform $(DIST_PATH)/bin # from cross-compiled bin dir
|
|
||||||
endif
|
endif
|
||||||
#Download MMCTL for Linux
|
#Download MMCTL for Linux
|
||||||
scripts/download_mmctl_release.sh "Linux" $(DIST_PATH)/bin
|
scripts/download_mmctl_release.sh "Linux" $(DIST_PATH)/bin
|
||||||
|
|||||||
@@ -23,6 +23,4 @@ var RootCmd = &cobra.Command{
|
|||||||
func init() {
|
func init() {
|
||||||
RootCmd.PersistentFlags().StringP("config", "c", "", "Configuration file to use.")
|
RootCmd.PersistentFlags().StringP("config", "c", "", "Configuration file to use.")
|
||||||
RootCmd.PersistentFlags().Bool("disableconfigwatch", false, "When set config.json will not be loaded from disk when the file is changed.")
|
RootCmd.PersistentFlags().Bool("disableconfigwatch", false, "When set config.json will not be loaded from disk when the file is changed.")
|
||||||
RootCmd.PersistentFlags().Bool("platform", false, "This flag signifies that the user tried to start the command from the platform binary, so we can log a mssage")
|
|
||||||
RootCmd.PersistentFlags().MarkHidden("platform")
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,8 +39,6 @@ func init() {
|
|||||||
|
|
||||||
func serverCmdF(command *cobra.Command, args []string) error {
|
func serverCmdF(command *cobra.Command, args []string) error {
|
||||||
disableConfigWatch, _ := command.Flags().GetBool("disableconfigwatch")
|
disableConfigWatch, _ := command.Flags().GetBool("disableconfigwatch")
|
||||||
usedPlatform, _ := command.Flags().GetBool("platform")
|
|
||||||
|
|
||||||
interruptChan := make(chan os.Signal, 1)
|
interruptChan := make(chan os.Signal, 1)
|
||||||
|
|
||||||
if err := utils.TranslationsPreInit(); err != nil {
|
if err := utils.TranslationsPreInit(); err != nil {
|
||||||
@@ -58,10 +56,10 @@ func serverCmdF(command *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
defer configStore.Close()
|
defer configStore.Close()
|
||||||
|
|
||||||
return runServer(configStore, usedPlatform, interruptChan)
|
return runServer(configStore, interruptChan)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runServer(configStore *config.Store, usedPlatform bool, interruptChan chan os.Signal) error {
|
func runServer(configStore *config.Store, interruptChan chan os.Signal) error {
|
||||||
// Setting the highest traceback level from the code.
|
// Setting the highest traceback level from the code.
|
||||||
// This is done to print goroutines from all threads (see golang.org/issue/13161)
|
// This is done to print goroutines from all threads (see golang.org/issue/13161)
|
||||||
// and also preserve a crash dump for later investigation.
|
// and also preserve a crash dump for later investigation.
|
||||||
@@ -96,10 +94,6 @@ func runServer(configStore *config.Store, usedPlatform bool, interruptChan chan
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if usedPlatform {
|
|
||||||
mlog.Warn("The platform binary has been deprecated, please switch to using the mattermost binary.")
|
|
||||||
}
|
|
||||||
|
|
||||||
a := app.New(app.ServerConnector(server))
|
a := app.New(app.ServerConnector(server))
|
||||||
api := api4.Init(a, server.Router)
|
api := api4.Init(a, server.Router)
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ func TestRunServerSuccess(t *testing.T) {
|
|||||||
// Use non-default listening port in case another server instance is already running.
|
// Use non-default listening port in case another server instance is already running.
|
||||||
*configStore.Get().ServiceSettings.ListenAddress = UnitTestListeningPort
|
*configStore.Get().ServiceSettings.ListenAddress = UnitTestListeningPort
|
||||||
|
|
||||||
err := runServer(configStore, false, th.interruptChan)
|
err := runServer(configStore, th.interruptChan)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ func TestRunServerSystemdNotification(t *testing.T) {
|
|||||||
*configStore.Get().ServiceSettings.ListenAddress = UnitTestListeningPort
|
*configStore.Get().ServiceSettings.ListenAddress = UnitTestListeningPort
|
||||||
|
|
||||||
// Start and stop the server
|
// Start and stop the server
|
||||||
err = runServer(configStore, false, th.interruptChan)
|
err = runServer(configStore, th.interruptChan)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Ensure the notification has been sent on the socket and is correct
|
// Ensure the notification has been sent on the socket and is correct
|
||||||
@@ -139,6 +139,6 @@ func TestRunServerNoSystemd(t *testing.T) {
|
|||||||
// Use non-default listening port in case another server instance is already running.
|
// Use non-default listening port in case another server instance is already running.
|
||||||
*configStore.Get().ServiceSettings.ListenAddress = UnitTestListeningPort
|
*configStore.Get().ServiceSettings.ListenAddress = UnitTestListeningPort
|
||||||
|
|
||||||
err := runServer(configStore, false, th.interruptChan)
|
err := runServer(configStore, th.interruptChan)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
||||||
// See LICENSE.txt for license information.
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/mattermost/mattermost-server/v5/utils/fileutils"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
// Print angry message to use mattermost command directly
|
|
||||||
fmt.Println(`
|
|
||||||
------------------------------------ ERROR ------------------------------------------------
|
|
||||||
The platform binary has been deprecated, please switch to using the new mattermost binary.
|
|
||||||
The platform binary will be removed in a future version.
|
|
||||||
-------------------------------------------------------------------------------------------
|
|
||||||
`)
|
|
||||||
|
|
||||||
// Execve the real MM binary
|
|
||||||
args := os.Args
|
|
||||||
args[0] = "mattermost"
|
|
||||||
args = append(args, "--platform")
|
|
||||||
|
|
||||||
realMattermost := fileutils.FindFile("mattermost")
|
|
||||||
if realMattermost == "" {
|
|
||||||
realMattermost = fileutils.FindFile("bin/mattermost")
|
|
||||||
}
|
|
||||||
|
|
||||||
if realMattermost == "" {
|
|
||||||
fmt.Println("Could not start Mattermost, use the mattermost command directly: failed to find mattermost")
|
|
||||||
} else if err := syscall.Exec(realMattermost, args, nil); err != nil {
|
|
||||||
fmt.Printf("Could not start Mattermost, use the mattermost command directly: %s\n", err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ссылка в новой задаче
Block a user