diff --git a/Makefile b/Makefile index 21f1629a7a..aa1644e699 100644 --- a/Makefile +++ b/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 diff --git a/api4/apitestlib.go b/api4/apitestlib.go index 06745e92dd..5f983840f4 100644 --- a/api4/apitestlib.go +++ b/api4/apitestlib.go @@ -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 { diff --git a/api4/system_test.go b/api4/system_test.go index dfea98a42f..824cf0f86f 100644 --- a/api4/system_test.go +++ b/api4/system_test.go @@ -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") diff --git a/api4/team_test.go b/api4/team_test.go index 6170dc11e2..e69b6604b5 100644 --- a/api4/team_test.go +++ b/api4/team_test.go @@ -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) diff --git a/build/docker-compose.yml b/build/docker-compose.yml index 00b076a7d4..0a2e2fc9f9 100644 --- a/build/docker-compose.yml +++ b/build/docker-compose.yml @@ -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: diff --git a/build/legacy.mk b/build/legacy.mk index ff07c654fe..deca32b019 100644 --- a/build/legacy.mk +++ b/build/legacy.mk @@ -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 + diff --git a/build/release.mk b/build/release.mk index 9dccd7afeb..9dfca71547 100644 --- a/build/release.mk +++ b/build/release.mk @@ -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 diff --git a/cmd/mattermost/commands/config.go b/cmd/mattermost/commands/config.go index 6809c6172e..494e45a433 100644 --- a/cmd/mattermost/commands/config.go +++ b/cmd/mattermost/commands/config.go @@ -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, } diff --git a/config/database.go b/config/database.go index 1fbd9a64ef..20708d3389 100644 --- a/config/database.go +++ b/config/database.go @@ -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) { diff --git a/model/config.go b/model/config.go index 285ff61f66..b35f2681a4 100644 --- a/model/config.go +++ b/model/config.go @@ -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 { diff --git a/scripts/mysql-migration-test.sh b/scripts/mysql-migration-test.sh index d4acbbdb26..5da4cdde5b 100755 --- a/scripts/mysql-migration-test.sh +++ b/scripts/mysql-migration-test.sh @@ -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 diff --git a/scripts/psql-migration-test.sh b/scripts/psql-migration-test.sh index cf33ff662f..57997bcae1 100755 --- a/scripts/psql-migration-test.sh +++ b/scripts/psql-migration-test.sh @@ -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 diff --git a/services/filesstore/filesstore_test.go b/services/filesstore/filesstore_test.go index 4fa9c340c1..7630523f23 100644 --- a/services/filesstore/filesstore_test.go +++ b/services/filesstore/filesstore_test.go @@ -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") diff --git a/services/mailservice/inbucket.go b/services/mailservice/inbucket.go index 3e73eee0f6..5ae72711ab 100644 --- a/services/mailservice/inbucket.go +++ b/services/mailservice/inbucket.go @@ -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") diff --git a/store/storetest/settings.go b/store/storetest/settings.go index 41b092ef73..90247affe9 100644 --- a/store/storetest/settings.go +++ b/store/storetest/settings.go @@ -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" ) diff --git a/tests/test-config.json b/tests/test-config.json index ddd7836d75..a2a7ef3a7c 100644 --- a/tests/test-config.json +++ b/tests/test-config.json @@ -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,