* Configurable dev environment * Add a bit of documentation * fixing gofmt * A bit more doc * Using variable * Adding license header * Moving LDAP_DATA variable to the default-config.mk file * Adding another docker-compose for the makefile to not brake anybody workflow * Moving dejavu to the config * Fixing docker-compose.makefile.yaml for dejavu * Adding keycloak support to the dev environment * Address PR review comments * Removing minio from default docker images * Changing the default version of mysql to the oldest supported (5.6) * Change the restart option to no for the dev environment * Fixing restart option * Reverting unneded changes * Restoring 5.7 to check if test passes * Going back to 5.6 mysql image * Fixing tests on mysql 5.6 * Skipping flaky test Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
61 строка
1.5 KiB
Go
61 строка
1.5 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,
|
|
}
|
|
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))
|
|
}
|