MM 7971 dockerhost -> localhost && docker -> docker-compose (#10872)

* replace dockerhost with localhost

* remove uneeded setup-max build step (no more dockerhost)

* changes as recommended by @cpanato

* make clean-docker with docker-compose

* added ports to docker-compose.yml (needed for osx).   ignore error for ldapadd (when already exists)

* add clean-old-docker to legacy.mk

* docker-compose stop instead of down for `make stop-docker`
Этот коммит содержится в:
scott lee davis
2019-08-02 10:53:00 -04:00
коммит произвёл Jesse Hallam
родитель e4582905ea
Коммит 2fa63b10ec
16 изменённых файлов: 112 добавлений и 205 удалений

177
Makefile
Просмотреть файл

@@ -1,4 +1,4 @@
.PHONY: build package run stop run-client run-server stop-client stop-server restart restart-server restart-client start-docker clean-dist clean nuke check-style check-client-style check-server-style check-unit-tests test dist setup-mac prepare-enteprise run-client-tests setup-run-client-tests cleanup-run-client-tests test-client build-linux build-osx build-windows internal-test-web-client vet run-server-for-web-client-tests
.PHONY: build package run stop run-client run-server stop-client stop-server restart restart-server restart-client start-docker clean-dist clean nuke check-style check-client-style check-server-style check-unit-tests test dist prepare-enteprise run-client-tests setup-run-client-tests cleanup-run-client-tests test-client build-linux build-osx build-windows internal-test-web-client vet run-server-for-web-client-tests
ROOT := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
@@ -116,86 +116,9 @@ start-docker: ## Starts the docker containers for local development.
ifeq ($(IS_CI),false)
@echo Starting docker containers
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-mysql$$ | wc -l) -eq 0 ]; then \
echo starting mattermost-mysql; \
docker run --name mattermost-mysql -p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=mostest \
-e MYSQL_USER=mmuser \
-e MYSQL_PASSWORD=mostest \
-e MYSQL_DATABASE=mattermost_test \
-d mysql:5.7 > /dev/null; \
elif [ $(shell docker ps --no-trunc --quiet --filter name=^/mattermost-mysql$$ | wc -l) -eq 0 ]; then \
echo restarting mattermost-mysql; \
docker start mattermost-mysql > /dev/null; \
fi
docker-compose --no-ansi -f ./build/docker-compose.yml run --rm start_dependencies
docker-compose --no-ansi -f ./build/docker-compose.yml exec -T openldap bash -c 'ldapadd -x -D "cn=admin,dc=mm,dc=test,dc=com" -w mostest -f /${LDAP_DATA}-data.ldif || true';
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-postgres$$ | wc -l) -eq 0 ]; then \
echo starting mattermost-postgres; \
docker run --name mattermost-postgres -p 5432:5432 \
-e POSTGRES_USER=mmuser \
-e POSTGRES_PASSWORD=mostest \
-e POSTGRES_DB=mattermost_test \
-d postgres:9.4 > /dev/null; \
elif [ $(shell docker ps --no-trunc --quiet --filter name=^/mattermost-postgres$$ | wc -l) -eq 0 ]; then \
echo restarting mattermost-postgres; \
docker start mattermost-postgres > /dev/null; \
fi
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-inbucket$$ | wc -l) -eq 0 ]; then \
echo starting mattermost-inbucket; \
docker run --name mattermost-inbucket -p 9000:10080 -p 2500:10025 -d jhillyerd/inbucket:release-1.2.0 > /dev/null; \
elif [ $(shell docker ps --no-trunc --quiet --filter name=^/mattermost-inbucket$$ | wc -l) -eq 0 ]; then \
echo restarting mattermost-inbucket; \
docker start mattermost-inbucket > /dev/null; \
fi
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-minio$$ | wc -l) -eq 0 ]; then \
echo starting mattermost-minio; \
docker run --name mattermost-minio -p 9001:9000 -e "MINIO_ACCESS_KEY=minioaccesskey" \
-e "MINIO_SSE_MASTER_KEY=my-minio-key:6368616e676520746869732070617373776f726420746f206120736563726574" \
-e "MINIO_SECRET_KEY=miniosecretkey" -d minio/minio:RELEASE.2019-04-23T23-50-36Z server /data > /dev/null; \
docker exec -it mattermost-minio /bin/sh -c "mkdir -p /data/mattermost-test" > /dev/null; \
elif [ $(shell docker ps --no-trunc --quiet --filter name=^/mattermost-minio$$ | wc -l) -eq 0 ]; then \
echo restarting mattermost-minio; \
docker start mattermost-minio > /dev/null; \
fi
ifeq ($(BUILD_ENTERPRISE_READY),true)
@echo Ldap test user test.one
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-openldap$$ | wc -l) -eq 0 ]; then \
echo starting mattermost-openldap; \
docker run --name mattermost-openldap -p 389:389 -p 636:636 \
-e LDAP_TLS_VERIFY_CLIENT="never" \
-e LDAP_ORGANISATION="Mattermost Test" \
-e LDAP_DOMAIN="mm.test.com" \
-e LDAP_ADMIN_PASSWORD="mostest" \
-d osixia/openldap:1.2.2 > /dev/null;\
sleep 10; \
docker cp tests/test-data.ldif mattermost-openldap:/test-data.ldif;\
docker cp tests/qa-data.ldif mattermost-openldap:/qa-data.ldif;\
docker exec -ti mattermost-openldap bash -c 'ldapadd -x -D "cn=admin,dc=mm,dc=test,dc=com" -w mostest -f /$(LDAP_DATA)-data.ldif';\
elif [ $(shell docker ps | grep -ci mattermost-openldap) -eq 0 ]; then \
echo restarting mattermost-openldap; \
docker start mattermost-openldap > /dev/null; \
sleep 10; \
fi
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-elasticsearch$$ | wc -l) -eq 0 ]; then \
echo starting mattermost-elasticsearch; \
docker run --name mattermost-elasticsearch -p 9200:9200 -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" -e "ES_JAVA_OPTS=-Xms512m -Xmx512m" -d mattermost/mattermost-elasticsearch-docker:6.5.1 > /dev/null; \
elif [ $(shell docker ps --no-trunc --quiet --filter name=^/mattermost-elasticsearch$$ | wc -l) -eq 0 ]; then \
echo restarting mattermost-elasticsearch; \
docker start mattermost-elasticsearch> /dev/null; \
fi
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-redis$$ | wc -l) -eq 0 ]; then \
echo starting mattermost-redis; \
docker run --name mattermost-redis -p 6379:6379 -d redis > /dev/null; \
elif [ $(shell docker ps --no-trunc --quiet --filter name=^/mattermost-redis$$ | wc -l) -eq 0 ]; then \
echo restarting mattermost-redis; \
docker start mattermost-redis > /dev/null; \
fi
endif
else
@echo CI Build: skipping docker start
endif
@@ -203,101 +126,15 @@ endif
stop-docker: ## Stops the docker containers for local development.
@echo Stopping docker containers
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-mysql$$ | wc -l) -eq 1 ]; then \
echo stopping mattermost-mysql; \
docker stop mattermost-mysql > /dev/null; \
fi
docker-compose --no-ansi -f ./build/docker-compose.yml stop
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-mysql-unittest$$ | wc -l) -eq 1 ]; then \
echo stopping mattermost-mysql-unittest; \
docker stop mattermost-mysql-unittest > /dev/null; \
fi
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-postgres$$ | wc -l) -eq 1 ]; then \
echo stopping mattermost-postgres; \
docker stop mattermost-postgres > /dev/null; \
fi
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-postgres-unittest$$ | wc -l) -eq 1 ]; then \
echo stopping mattermost-postgres-unittest; \
docker stop mattermost-postgres-unittest > /dev/null; \
fi
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-openldap$$ | wc -l) -eq 1 ]; then \
echo stopping mattermost-openldap; \
docker stop mattermost-openldap > /dev/null; \
fi
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-inbucket$$ | wc -l) -eq 1 ]; then \
echo stopping mattermost-inbucket; \
docker stop mattermost-inbucket > /dev/null; \
fi
@if [ $(shell docker ps -a | grep -ci mattermost-minio) -eq 1 ]; then \
echo stopping mattermost-minio; \
docker stop mattermost-minio > /dev/null; \
fi
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-elasticsearch$$ | wc -l) -eq 1 ]; then \
echo stopping mattermost-elasticsearch; \
docker stop mattermost-elasticsearch > /dev/null; \
fi
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-redis$$ | wc -l) -eq 1 ]; then \
echo stopping mattermost-redis; \
docker stop mattermost-redis > /dev/null; \
fi
clean-docker: ## Deletes the docker containers for local development.
@echo Removing docker containers
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-mysql$$ | wc -l) -eq 1 ]; then \
echo removing mattermost-mysql; \
docker stop mattermost-mysql > /dev/null; \
docker rm -v mattermost-mysql > /dev/null; \
fi
docker-compose --no-ansi -f ./build/docker-compose.yml down -v
docker-compose --no-ansi -f ./build/docker-compose.yml rm -v
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-mysql-unittest$$ | wc -l) -eq 1 ]; then \
echo removing mattermost-mysql-unittest; \
docker stop mattermost-mysql-unittest > /dev/null; \
docker rm -v mattermost-mysql-unittest > /dev/null; \
fi
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-postgres$$ | wc -l) -eq 1 ]; then \
echo removing mattermost-postgres; \
docker stop mattermost-postgres > /dev/null; \
docker rm -v mattermost-postgres > /dev/null; \
fi
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-postgres-unittest$$ | wc -l) -eq 1 ]; then \
echo removing mattermost-postgres-unittest; \
docker stop mattermost-postgres-unittest > /dev/null; \
docker rm -v mattermost-postgres-unittest > /dev/null; \
fi
@if [ $(shell docker ps -a | grep -ci mattermost-openldap) -eq 1 ]; then \
echo removing mattermost-openldap; \
docker stop mattermost-openldap > /dev/null; \
docker rm -v mattermost-openldap > /dev/null; \
fi
@if [ $(shell docker ps -a | grep -ci mattermost-inbucket) -eq 1 ]; then \
echo removing mattermost-inbucket; \
docker stop mattermost-inbucket > /dev/null; \
docker rm -v mattermost-inbucket > /dev/null; \
fi
@if [ $(shell docker ps -a | grep -ci mattermost-minio) -eq 1 ]; then \
echo removing mattermost-minio; \
docker stop mattermost-minio > /dev/null; \
docker rm -v mattermost-minio > /dev/null; \
fi
@if [ $(shell docker ps -a | grep -ci mattermost-elasticsearch) -eq 1 ]; then \
echo removing mattermost-elasticsearch; \
docker stop mattermost-elasticsearch > /dev/null; \
docker rm -v mattermost-elasticsearch > /dev/null; \
fi
govet: ## Runs govet against all packages.
@echo Running GOVET
@@ -551,7 +388,7 @@ run-job-server: ## Runs the background job server.
config-ldap: ## Configures LDAP.
@echo Setting up configuration for local LDAP
@sed -i'' -e 's|"LdapServer": ".*"|"LdapServer": "dockerhost"|g' config/config.json
@sed -i'' -e 's|"LdapServer": ".*"|"LdapServer": "localhost"|g' config/config.json
@sed -i'' -e 's|"BaseDN": ".*"|"BaseDN": "dc=mm,dc=test,dc=com"|g' config/config.json
@sed -i'' -e 's|"BindUsername": ".*"|"BindUsername": "cn=admin,dc=mm,dc=test,dc=com"|g' config/config.json
@sed -i'' -e 's|"BindPassword": ".*"|"BindPassword": "mostest"|g' config/config.json

Просмотреть файл

@@ -524,10 +524,10 @@ func (me *TestHelper) AddUserToChannel(user *model.User, channel *model.Channel)
}
func (me *TestHelper) GenerateTestEmail() string {
if *me.App.Config().EmailSettings.SMTPServer != "dockerhost" && os.Getenv("CI_INBUCKET_PORT") == "" {
if *me.App.Config().EmailSettings.SMTPServer != "localhost" && os.Getenv("CI_INBUCKET_PORT") == "" {
return strings.ToLower("success+" + model.NewId() + "@simulator.amazonses.com")
}
return strings.ToLower(model.NewId() + "@dockerhost")
return strings.ToLower(model.NewId() + "@localhost")
}
func (me *TestHelper) CreateGroup() *model.Group {

Просмотреть файл

@@ -127,7 +127,7 @@ func TestEmailTest(t *testing.T) {
inbucket_host := os.Getenv("CI_INBUCKET_HOST")
if inbucket_host == "" {
inbucket_host = "dockerhost"
inbucket_host = "localhost"
}
inbucket_port := os.Getenv("CI_INBUCKET_PORT")
@@ -362,7 +362,7 @@ func TestS3TestConnection(t *testing.T) {
s3Host := os.Getenv("CI_MINIO_HOST")
if s3Host == "" {
s3Host = "dockerhost"
s3Host = "localhost"
}
s3Port := os.Getenv("CI_MINIO_PORT")

Просмотреть файл

@@ -109,7 +109,7 @@ func TestCreateTeamSanitization(t *testing.T) {
Name: GenerateTestTeamName(),
Email: th.GenerateTestEmail(),
Type: model.TEAM_OPEN,
AllowedDomains: "simulator.amazonses.com,dockerhost",
AllowedDomains: "simulator.amazonses.com,localhost",
}
rteam, resp := th.Client.CreateTeam(team)
@@ -125,7 +125,7 @@ func TestCreateTeamSanitization(t *testing.T) {
Name: GenerateTestTeamName(),
Email: th.GenerateTestEmail(),
Type: model.TEAM_OPEN,
AllowedDomains: "simulator.amazonses.com,dockerhost",
AllowedDomains: "simulator.amazonses.com,localhost",
}
rteam, resp := th.SystemAdminClient.CreateTeam(team)
@@ -192,7 +192,7 @@ func TestGetTeamSanitization(t *testing.T) {
Name: GenerateTestTeamName(),
Email: th.GenerateTestEmail(),
Type: model.TEAM_OPEN,
AllowedDomains: "simulator.amazonses.com,dockerhost",
AllowedDomains: "simulator.amazonses.com,localhost",
})
CheckNoError(t, resp)
@@ -375,7 +375,7 @@ func TestUpdateTeamSanitization(t *testing.T) {
Name: GenerateTestTeamName(),
Email: th.GenerateTestEmail(),
Type: model.TEAM_OPEN,
AllowedDomains: "simulator.amazonses.com,dockerhost",
AllowedDomains: "simulator.amazonses.com,localhost",
})
CheckNoError(t, resp)
@@ -480,7 +480,7 @@ func TestPatchTeamSanitization(t *testing.T) {
Name: GenerateTestTeamName(),
Email: th.GenerateTestEmail(),
Type: model.TEAM_OPEN,
AllowedDomains: "simulator.amazonses.com,dockerhost",
AllowedDomains: "simulator.amazonses.com,localhost",
})
CheckNoError(t, resp)
@@ -736,7 +736,7 @@ func TestGetAllTeamsSanitization(t *testing.T) {
Name: GenerateTestTeamName(),
Email: th.GenerateTestEmail(),
Type: model.TEAM_OPEN,
AllowedDomains: "simulator.amazonses.com,dockerhost",
AllowedDomains: "simulator.amazonses.com,localhost",
AllowOpenInvite: true,
})
CheckNoError(t, resp)
@@ -745,7 +745,7 @@ func TestGetAllTeamsSanitization(t *testing.T) {
Name: GenerateTestTeamName(),
Email: th.GenerateTestEmail(),
Type: model.TEAM_OPEN,
AllowedDomains: "simulator.amazonses.com,dockerhost",
AllowedDomains: "simulator.amazonses.com,localhost",
AllowOpenInvite: true,
})
CheckNoError(t, resp)
@@ -848,7 +848,7 @@ func TestGetTeamByNameSanitization(t *testing.T) {
Name: GenerateTestTeamName(),
Email: th.GenerateTestEmail(),
Type: model.TEAM_OPEN,
AllowedDomains: "simulator.amazonses.com,dockerhost",
AllowedDomains: "simulator.amazonses.com,localhost",
})
CheckNoError(t, resp)
@@ -973,7 +973,7 @@ func TestSearchAllTeamsSanitization(t *testing.T) {
Name: GenerateTestTeamName(),
Email: th.GenerateTestEmail(),
Type: model.TEAM_OPEN,
AllowedDomains: "simulator.amazonses.com,dockerhost",
AllowedDomains: "simulator.amazonses.com,localhost",
})
CheckNoError(t, resp)
team2, resp := th.Client.CreateTeam(&model.Team{
@@ -981,7 +981,7 @@ func TestSearchAllTeamsSanitization(t *testing.T) {
Name: GenerateTestTeamName(),
Email: th.GenerateTestEmail(),
Type: model.TEAM_OPEN,
AllowedDomains: "simulator.amazonses.com,dockerhost",
AllowedDomains: "simulator.amazonses.com,localhost",
})
CheckNoError(t, resp)
@@ -1091,7 +1091,7 @@ func TestGetTeamsForUserSanitization(t *testing.T) {
Name: GenerateTestTeamName(),
Email: th.GenerateTestEmail(),
Type: model.TEAM_OPEN,
AllowedDomains: "simulator.amazonses.com,dockerhost",
AllowedDomains: "simulator.amazonses.com,localhost",
})
CheckNoError(t, resp)
team2, resp := th.Client.CreateTeam(&model.Team{
@@ -1099,7 +1099,7 @@ func TestGetTeamsForUserSanitization(t *testing.T) {
Name: GenerateTestTeamName(),
Email: th.GenerateTestEmail(),
Type: model.TEAM_OPEN,
AllowedDomains: "simulator.amazonses.com,dockerhost",
AllowedDomains: "simulator.amazonses.com,localhost",
})
CheckNoError(t, resp)

Просмотреть файл

@@ -5,6 +5,8 @@ services:
restart: always
networks:
- mm-test
ports:
- "3306:3306"
environment:
MYSQL_ROOT_HOST: "%"
MYSQL_ROOT_PASSWORD: mostest
@@ -19,6 +21,8 @@ services:
restart: always
networks:
- mm-test
ports:
- "5432:5432"
environment:
POSTGRES_USER: mmuser
POSTGRES_PASSWORD: mostest
@@ -29,6 +33,8 @@ services:
command: "server /data"
networks:
- mm-test
ports:
- "9000:9000"
environment:
MINIO_ACCESS_KEY: minioaccesskey
MINIO_SECRET_KEY: miniosecretkey
@@ -38,11 +44,18 @@ services:
restart: always
networks:
- mm-test
ports:
- "10025:10025"
- "10080:10080"
- "10110:10110"
openldap:
image: "osixia/openldap:1.2.2"
restart: always
networks:
- mm-test
ports:
- "389:389"
- "636:636"
environment:
LDAP_TLS_VERIFY_CLIENT: "never"
LDAP_ORGANISATION: "Mattermost Test"
@@ -55,6 +68,9 @@ services:
image: "mattermost/mattermost-elasticsearch-docker:6.5.1"
networks:
- mm-test
ports:
- "9200:9200"
- "9300:9300"
environment:
http.host: "0.0.0.0"
transport.host: "127.0.0.1"
@@ -63,7 +79,8 @@ services:
image: redis
networks:
- mm-test
ports:
- "6379:6379"
start_dependencies:
image: mattermost/mattermost-wait-for-dep:latest
networks:

Просмотреть файл

@@ -3,3 +3,56 @@ test-te: test-server
# test-ee used to just run the enterprise edition tests, but now runs whatever is available
test-ee: test-server
# clean old docker images
clean-old-docker:
@echo Removing docker containers
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-mysql$$ | wc -l) -eq 1 ]; then \
echo removing mattermost-mysql; \
docker stop mattermost-mysql > /dev/null; \
docker rm -v mattermost-mysql > /dev/null; \
fi
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-mysql-unittest$$ | wc -l) -eq 1 ]; then \
echo removing mattermost-mysql-unittest; \
docker stop mattermost-mysql-unittest > /dev/null; \
docker rm -v mattermost-mysql-unittest > /dev/null; \
fi
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-postgres$$ | wc -l) -eq 1 ]; then \
echo removing mattermost-postgres; \
docker stop mattermost-postgres > /dev/null; \
docker rm -v mattermost-postgres > /dev/null; \
fi
@if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-postgres-unittest$$ | wc -l) -eq 1 ]; then \
echo removing mattermost-postgres-unittest; \
docker stop mattermost-postgres-unittest > /dev/null; \
docker rm -v mattermost-postgres-unittest > /dev/null; \
fi
@if [ $(shell docker ps -a | grep -ci mattermost-openldap) -eq 1 ]; then \
echo removing mattermost-openldap; \
docker stop mattermost-openldap > /dev/null; \
docker rm -v mattermost-openldap > /dev/null; \
fi
@if [ $(shell docker ps -a | grep -ci mattermost-inbucket) -eq 1 ]; then \
echo removing mattermost-inbucket; \
docker stop mattermost-inbucket > /dev/null; \
docker rm -v mattermost-inbucket > /dev/null; \
fi
@if [ $(shell docker ps -a | grep -ci mattermost-minio) -eq 1 ]; then \
echo removing mattermost-minio; \
docker stop mattermost-minio > /dev/null; \
docker rm -v mattermost-minio > /dev/null; \
fi
@if [ $(shell docker ps -a | grep -ci mattermost-elasticsearch) -eq 1 ]; then \
echo removing mattermost-elasticsearch; \
docker stop mattermost-elasticsearch > /dev/null; \
docker rm -v mattermost-elasticsearch > /dev/null; \
fi

Просмотреть файл

@@ -47,7 +47,7 @@ package:
sed -i'' -e 's|"SendEmailNotifications": true,|"SendEmailNotifications": false,|g' $(DIST_PATH)/config/config.json
sed -i'' -e 's|"FeedbackEmail": "test@example.com",|"FeedbackEmail": "",|g' $(DIST_PATH)/config/config.json
sed -i'' -e 's|"ReplyToAddress": "test@example.com",|"ReplyToAddress": "",|g' $(DIST_PATH)/config/config.json
sed -i'' -e 's|"SMTPServer": "dockerhost",|"SMTPServer": "",|g' $(DIST_PATH)/config/config.json
sed -i'' -e 's|"SMTPServer": "localhost",|"SMTPServer": "",|g' $(DIST_PATH)/config/config.json
sed -i'' -e 's|"SMTPPort": "2500",|"SMTPPort": "",|g' $(DIST_PATH)/config/config.json
@# Package webapp

Просмотреть файл

@@ -73,7 +73,7 @@ var MigrateConfigCmd = &cobra.Command{
Use: "migrate [from_config] [to_config]",
Short: "Migrate existing config between backends",
Long: "Migrate a file-based configuration to (or from) a database-based configuration. Point the Mattermost server at the target configuration to start using it",
Example: `config migrate path/to/config.json "postgres://mmuser:mostest@dockerhost:5432/mattermost_test?sslmode=disable&connect_timeout=10"`,
Example: `config migrate path/to/config.json "postgres://mmuser:mostest@localhost:5432/mattermost_test?sslmode=disable&connect_timeout=10"`,
Args: cobra.ExactArgs(2),
RunE: configMigrateCmdF,
}

Просмотреть файл

@@ -93,10 +93,10 @@ func initializeConfigurationsTable(db *sqlx.DB) error {
// parseDSN splits up a connection string into a driver name and data source name.
//
// For example:
// mysql://mmuser:mostest@dockerhost:5432/mattermost_test
// mysql://mmuser:mostest@localhost:5432/mattermost_test
// returns
// driverName = mysql
// dataSourceName = mmuser:mostest@dockerhost:5432/mattermost_test
// dataSourceName = mmuser:mostest@localhost:5432/mattermost_test
//
// By contrast, a Postgres DSN is returned unmodified.
func parseDSN(dsn string) (string, string, error) {

Просмотреть файл

@@ -104,7 +104,7 @@ const (
TEAM_SETTINGS_DEFAULT_CUSTOM_DESCRIPTION_TEXT = ""
TEAM_SETTINGS_DEFAULT_USER_STATUS_AWAY_TIMEOUT = 300
SQL_SETTINGS_DEFAULT_DATA_SOURCE = "mmuser:mostest@tcp(dockerhost:3306)/mattermost_test?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s"
SQL_SETTINGS_DEFAULT_DATA_SOURCE = "mmuser:mostest@tcp(localhost:3306)/mattermost_test?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s"
FILE_SETTINGS_DEFAULT_DIRECTORY = "./data/"
@@ -151,7 +151,7 @@ const (
TEAM_SETTINGS_DEFAULT_TEAM_TEXT = "default"
ELASTICSEARCH_SETTINGS_DEFAULT_CONNECTION_URL = "http://dockerhost:9200"
ELASTICSEARCH_SETTINGS_DEFAULT_CONNECTION_URL = "http://localhost:9200"
ELASTICSEARCH_SETTINGS_DEFAULT_USERNAME = "elastic"
ELASTICSEARCH_SETTINGS_DEFAULT_PASSWORD = "changeme"
ELASTICSEARCH_SETTINGS_DEFAULT_POST_INDEX_REPLICAS = 1
@@ -1218,7 +1218,7 @@ func (s *EmailSettings) SetDefaults(isUpdate bool) {
}
if s.SMTPServer == nil || len(*s.SMTPServer) == 0 {
s.SMTPServer = NewString("dockerhost")
s.SMTPServer = NewString("localhost")
}
if s.SMTPPort == nil || len(*s.SMTPPort) == 0 {

Просмотреть файл

@@ -10,14 +10,14 @@ echo "Importing mysql dump from version 5.0"
docker exec -i mattermost-mysql mysql -D migrated -uroot -pmostest < $(pwd)/scripts/mattermost-mysql-5.0.sql
echo "Setting up config for db migration"
make ARGS="config set SqlSettings.DataSource 'mmuser:mostest@tcp(dockerhost:3306)/migrated?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s' --config $TMPDIR/config.json" run-cli
make ARGS="config set SqlSettings.DataSource 'mmuser:mostest@tcp(localhost:3306)/migrated?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s' --config $TMPDIR/config.json" run-cli
make ARGS="config set SqlSettings.DriverName 'mysql' --config $TMPDIR/config.json" run-cli
echo "Running the migration"
make ARGS="version --config $TMPDIR/config.json" run-cli
echo "Setting up config for fresh db setup"
make ARGS="config set SqlSettings.DataSource 'mmuser:mostest@tcp(dockerhost:3306)/latest?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s' --config $TMPDIR/config.json" run-cli
make ARGS="config set SqlSettings.DataSource 'mmuser:mostest@tcp(localhost:3306)/latest?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s' --config $TMPDIR/config.json" run-cli
echo "Setting up fresh db"
make ARGS="version --config $TMPDIR/config.json" run-cli

Просмотреть файл

@@ -10,14 +10,14 @@ echo "Importing postgres dump from version 5.0"
docker exec -i mattermost-postgres psql -U mmuser -d migrated < $(pwd)/scripts/mattermost-postgresql-5.0.sql
echo "Setting up config for db migration"
make ARGS="config set SqlSettings.DataSource 'postgres://mmuser:mostest@dockerhost:5432/migrated?sslmode=disable&connect_timeout=10' --config $TMPDIR/config.json" run-cli
make ARGS="config set SqlSettings.DataSource 'postgres://mmuser:mostest@localhost:5432/migrated?sslmode=disable&connect_timeout=10' --config $TMPDIR/config.json" run-cli
make ARGS="config set SqlSettings.DriverName 'postgres' --config $TMPDIR/config.json" run-cli
echo "Running the migration"
make ARGS="version --config $TMPDIR/config.json" run-cli
echo "Setting up config for fresh db setup"
make ARGS="config set SqlSettings.DataSource 'postgres://mmuser:mostest@dockerhost:5432/latest?sslmode=disable&connect_timeout=10' --config $TMPDIR/config.json" run-cli
make ARGS="config set SqlSettings.DataSource 'postgres://mmuser:mostest@localhost:5432/latest?sslmode=disable&connect_timeout=10' --config $TMPDIR/config.json" run-cli
echo "Setting up fresh db"
make ARGS="version --config $TMPDIR/config.json" run-cli

Просмотреть файл

@@ -58,7 +58,7 @@ func TestS3FileBackendTestSuiteWithEncryption(t *testing.T) {
func runBackendTest(t *testing.T, encrypt bool) {
s3Host := os.Getenv("CI_MINIO_HOST")
if s3Host == "" {
s3Host = "dockerhost"
s3Host = "localhost"
}
s3Port := os.Getenv("CI_MINIO_PORT")

Просмотреть файл

@@ -191,7 +191,7 @@ func getInbucketHost() (host string) {
inbucket_host := os.Getenv("CI_INBUCKET_HOST")
if inbucket_host == "" {
inbucket_host = "dockerhost"
inbucket_host = "localhost"
}
inbucket_port := os.Getenv("CI_INBUCKET_PORT")

Просмотреть файл

@@ -21,8 +21,8 @@ import (
)
const (
defaultMysqlDSN = "mmuser:mostest@tcp(dockerhost:3306)/mattermost_test?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=30s"
defaultPostgresqlDSN = "postgres://mmuser:mostest@dockerhost:5432/mattermost_test?sslmode=disable&connect_timeout=10"
defaultMysqlDSN = "mmuser:mostest@tcp(localhost:3306)/mattermost_test?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=30s"
defaultPostgresqlDSN = "postgres://mmuser:mostest@localhost:5432/mattermost_test?sslmode=disable&connect_timeout=10"
defaultMysqlRootPWD = "mostest"
)

Просмотреть файл

@@ -108,7 +108,7 @@
},
"SqlSettings": {
"DriverName": "mysql",
"DataSource": "mmuser:mostest@tcp(dockerhost:3306)/mattermost_test?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=30s",
"DataSource": "mmuser:mostest@tcp(localhost:3306)/mattermost_test?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=30s",
"DataSourceReplicas": [],
"DataSourceSearchReplicas": [],
"MaxIdleConns": 20,
@@ -169,7 +169,7 @@
"EnableSMTPAuth": false,
"SMTPUsername": "",
"SMTPPassword": "",
"SMTPServer": "dockerhost",
"SMTPServer": "localhost",
"SMTPPort": "2500",
"ConnectionSecurity": "",
"SendPushNotifications": false,
@@ -339,7 +339,7 @@
"MaxUsersForStatistics": 2500
},
"ElasticsearchSettings": {
"ConnectionUrl": "http://dockerhost:9200",
"ConnectionUrl": "http://localhost:9200",
"Username": "elastic",
"Password": "changeme",
"EnableIndexing": false,