* MM-31094: Adds tooling to develop and test using a MySQL instance with replication lag. Adds some lazy lookups to fallback to master if results are not found. * MM-31094: Removes mysql-read-replica from default docker services. * MM-31094: Switches (store..SessionStore).Get and (store.TeamStore).GetMember to using context.Context. * MM-31094: Updates (store.UsersStore).Get to use context. * MM-31094: Updates (store.PostStore).Get to use context. * MM-31094: Removes feature flag and config setting. * MM-31094: Rolls back some master reads. * MM-31094: Rolls a non-cache read. * MM-31094: Removes feature flag from the store. * MM-31094: Removes unused constant and struct field. * MM-31094: Removes some old feature flag references. * MM-31094: Fixes some tests. * MM-31094: App layers fix. * MM-31094: Fixes mocks. * MM-31094: Don't reparse flag. * MM-31094: No reparse. * MM-31094: Removed unused FeatureFlags field. * MM-31094: Removes unnecessary feature flags variable declarations. * MM-31094: Fixes copy-paste error. * MM-31094: Fixes logical error. * MM-30194: Removes test method from store. * Revert "MM-30194: Removes test method from store." This reverts commit d5a6e8529bd5f4d993824c828e239d009b05e567. * MM-31094: Conforming to make's strange syntax. * MM-31094: Configures helper for read replica with option. * MM-31094: Adds some missing ctx's. * MM-31094: WIP * MM-31094: Updates test names. * MM-31094: WIP * MM-31094: Removes unnecessary master reads. * MM-31094: ID case changes out of scope. * MM-31094: Removes unused context. * MM-31094: Switches to a helper. Removes some var naming changes. Fixes a merge error. * MM-31094: Removes SQLITE db driver ref. * MM-31094: Layer generate fix. * MM-31094: Removes unnecessary changes. * MM-31094: Moves test method. * MM-31094: Re-add previous fix. * MM-31094: Removes make command for dev. * MM-31094: Fix for login. Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
64 строки
1.7 KiB
Go
64 строки
1.7 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
|
|
"gopkg.in/yaml.v2"
|
|
)
|
|
|
|
type DockerCompose struct {
|
|
Version string `yaml:"version"`
|
|
Services map[string]*Container `yaml:"services"`
|
|
}
|
|
|
|
type Container struct {
|
|
Command string `yaml:"command,omitempty"`
|
|
Image string `yaml:"image,omitempty"`
|
|
Network []string `yaml:"networks,omitempty"`
|
|
DependsOn []string `yaml:"depends_on,omitempty"`
|
|
}
|
|
|
|
func main() {
|
|
validServices := map[string]int{
|
|
"mysql": 3306,
|
|
"postgres": 5432,
|
|
"minio": 9000,
|
|
"inbucket": 10080,
|
|
"openldap": 389,
|
|
"elasticsearch": 9200,
|
|
"dejavu": 1358,
|
|
"keycloak": 8080,
|
|
"prometheus": 9090,
|
|
"grafana": 3000,
|
|
"mysql-read-replica": 3306, // FIXME: not recorgnizing the successfully running service on port 3307.
|
|
}
|
|
command := []string{}
|
|
for _, arg := range os.Args[1:] {
|
|
port, ok := validServices[arg]
|
|
if !ok {
|
|
panic(fmt.Sprintf("Unknown service %s", arg))
|
|
}
|
|
command = append(command, fmt.Sprintf("%s:%d", arg, port))
|
|
}
|
|
|
|
var dockerCompose DockerCompose
|
|
dockerCompose.Version = "2.4"
|
|
dockerCompose.Services = map[string]*Container{}
|
|
dockerCompose.Services["start_dependencies"] = &Container{
|
|
Image: "mattermost/mattermost-wait-for-dep:latest",
|
|
Network: []string{"mm-test"},
|
|
DependsOn: os.Args[1:],
|
|
Command: strings.Join(command, " "),
|
|
}
|
|
resultData, err := yaml.Marshal(dockerCompose)
|
|
if err != nil {
|
|
panic(fmt.Sprintf("Unable to serialize the docker-compose file: %s.", err.Error()))
|
|
}
|
|
fmt.Println(string(resultData))
|
|
}
|