github.com/jfrerich/mattermost-server@v5.8.0-rc2+incompatible/Makefile (about) 1 .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 2 3 ROOT := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) 4 5 IS_CI ?= false 6 # Build Flags 7 BUILD_NUMBER ?= $(BUILD_NUMBER:) 8 BUILD_DATE = $(shell date -u) 9 BUILD_HASH = $(shell git rev-parse HEAD) 10 # If we don't set the build number it defaults to dev 11 ifeq ($(BUILD_NUMBER),) 12 BUILD_NUMBER := dev 13 endif 14 BUILD_ENTERPRISE_DIR ?= ../enterprise 15 BUILD_ENTERPRISE ?= true 16 BUILD_ENTERPRISE_READY = false 17 BUILD_TYPE_NAME = team 18 BUILD_HASH_ENTERPRISE = none 19 ifneq ($(wildcard $(BUILD_ENTERPRISE_DIR)/.),) 20 ifeq ($(BUILD_ENTERPRISE),true) 21 BUILD_ENTERPRISE_READY = true 22 BUILD_TYPE_NAME = enterprise 23 BUILD_HASH_ENTERPRISE = $(shell cd $(BUILD_ENTERPRISE_DIR) && git rev-parse HEAD) 24 else 25 BUILD_ENTERPRISE_READY = false 26 BUILD_TYPE_NAME = team 27 endif 28 else 29 BUILD_ENTERPRISE_READY = false 30 BUILD_TYPE_NAME = team 31 endif 32 BUILD_WEBAPP_DIR ?= ../mattermost-webapp 33 BUILD_CLIENT = false 34 BUILD_HASH_CLIENT = independant 35 ifneq ($(wildcard $(BUILD_WEBAPP_DIR)/.),) 36 ifeq ($(BUILD_CLIENT),true) 37 BUILD_CLIENT = true 38 BUILD_HASH_CLIENT = $(shell cd $(BUILD_WEBAPP_DIR) && git rev-parse HEAD) 39 else 40 BUILD_CLIENT = false 41 endif 42 else 43 BUILD_CLIENT = false 44 endif 45 46 # Golang Flags 47 GOPATH ?= $(shell go env GOPATH) 48 GOFLAGS ?= $(GOFLAGS:) 49 GO=go 50 DELVE=dlv 51 GO_LINKER_FLAGS ?= -ldflags \ 52 "-X github.com/mattermost/mattermost-server/model.BuildNumber=$(BUILD_NUMBER)\ 53 -X 'github.com/mattermost/mattermost-server/model.BuildDate=$(BUILD_DATE)'\ 54 -X github.com/mattermost/mattermost-server/model.BuildHash=$(BUILD_HASH)\ 55 -X github.com/mattermost/mattermost-server/model.BuildHashEnterprise=$(BUILD_HASH_ENTERPRISE)\ 56 -X github.com/mattermost/mattermost-server/model.BuildEnterpriseReady=$(BUILD_ENTERPRISE_READY)" 57 58 # GOOS/GOARCH of the build host, used to determine whether we're cross-compiling or not 59 BUILDER_GOOS_GOARCH="$(shell $(GO) env GOOS)_$(shell $(GO) env GOARCH)" 60 61 PLATFORM_FILES="./cmd/mattermost/main.go" 62 63 # Output paths 64 DIST_ROOT=dist 65 DIST_PATH=$(DIST_ROOT)/mattermost 66 67 # Tests 68 TESTS=. 69 70 TESTFLAGS ?= -short 71 TESTFLAGSEE ?= -short 72 73 # Packages lists 74 TE_PACKAGES=$(shell go list ./...) 75 76 # Plugins Packages 77 PLUGIN_PACKAGES=mattermost-plugin-zoom mattermost-plugin-jira 78 79 # Prepares the enterprise build if exists. The IGNORE stuff is a hack to get the Makefile to execute the commands outside a target 80 ifeq ($(BUILD_ENTERPRISE_READY),true) 81 IGNORE:=$(shell echo Enterprise build selected, preparing) 82 IGNORE:=$(shell rm -f imports/imports.go) 83 IGNORE:=$(shell cp $(BUILD_ENTERPRISE_DIR)/imports/imports.go imports/) 84 IGNORE:=$(shell rm -f enterprise) 85 IGNORE:=$(shell ln -s $(BUILD_ENTERPRISE_DIR) enterprise) 86 else 87 IGNORE:=$(shell rm -f imports/imports.go) 88 endif 89 90 EE_PACKAGES=$(shell go list ./enterprise/...) 91 92 ifeq ($(BUILD_ENTERPRISE_READY),true) 93 ALL_PACKAGES=$(TE_PACKAGES) $(EE_PACKAGES) 94 else 95 ALL_PACKAGES=$(TE_PACKAGES) 96 endif 97 98 99 all: run ## Alias for 'run'. 100 101 include build/*.mk 102 103 start-docker: ## Starts the docker containers for local development. 104 ifeq ($(IS_CI),false) 105 @echo Starting docker containers 106 107 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-mysql$$ | wc -l) -eq 0 ]; then \ 108 echo starting mattermost-mysql; \ 109 docker run --name mattermost-mysql -p 3306:3306 \ 110 -e MYSQL_ROOT_PASSWORD=mostest \ 111 -e MYSQL_USER=mmuser \ 112 -e MYSQL_PASSWORD=mostest \ 113 -e MYSQL_DATABASE=mattermost_test \ 114 -d mysql:5.7 > /dev/null; \ 115 elif [ $(shell docker ps --no-trunc --quiet --filter name=^/mattermost-mysql$$ | wc -l) -eq 0 ]; then \ 116 echo restarting mattermost-mysql; \ 117 docker start mattermost-mysql > /dev/null; \ 118 fi 119 120 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-postgres$$ | wc -l) -eq 0 ]; then \ 121 echo starting mattermost-postgres; \ 122 docker run --name mattermost-postgres -p 5432:5432 \ 123 -e POSTGRES_USER=mmuser \ 124 -e POSTGRES_PASSWORD=mostest \ 125 -e POSTGRES_DB=mattermost_test \ 126 -d postgres:9.4 > /dev/null; \ 127 elif [ $(shell docker ps --no-trunc --quiet --filter name=^/mattermost-postgres$$ | wc -l) -eq 0 ]; then \ 128 echo restarting mattermost-postgres; \ 129 docker start mattermost-postgres > /dev/null; \ 130 fi 131 132 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-inbucket$$ | wc -l) -eq 0 ]; then \ 133 echo starting mattermost-inbucket; \ 134 docker run --name mattermost-inbucket -p 9000:10080 -p 2500:10025 -d jhillyerd/inbucket:release-1.2.0 > /dev/null; \ 135 elif [ $(shell docker ps --no-trunc --quiet --filter name=^/mattermost-inbucket$$ | wc -l) -eq 0 ]; then \ 136 echo restarting mattermost-inbucket; \ 137 docker start mattermost-inbucket > /dev/null; \ 138 fi 139 140 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-minio$$ | wc -l) -eq 0 ]; then \ 141 echo starting mattermost-minio; \ 142 docker run --name mattermost-minio -p 9001:9000 -e "MINIO_ACCESS_KEY=minioaccesskey" \ 143 -e "MINIO_SECRET_KEY=miniosecretkey" -d minio/minio:RELEASE.2018-05-25T19-49-13Z server /data > /dev/null; \ 144 docker exec -it mattermost-minio /bin/sh -c "mkdir -p /data/mattermost-test" > /dev/null; \ 145 elif [ $(shell docker ps --no-trunc --quiet --filter name=^/mattermost-minio$$ | wc -l) -eq 0 ]; then \ 146 echo restarting mattermost-minio; \ 147 docker start mattermost-minio > /dev/null; \ 148 fi 149 150 ifeq ($(BUILD_ENTERPRISE_READY),true) 151 @echo Ldap test user test.one 152 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-openldap$$ | wc -l) -eq 0 ]; then \ 153 echo starting mattermost-openldap; \ 154 docker run --name mattermost-openldap -p 389:389 -p 636:636 \ 155 -e LDAP_TLS_VERIFY_CLIENT="never" \ 156 -e LDAP_ORGANISATION="Mattermost Test" \ 157 -e LDAP_DOMAIN="mm.test.com" \ 158 -e LDAP_ADMIN_PASSWORD="mostest" \ 159 -d osixia/openldap:1.2.2 > /dev/null;\ 160 sleep 10; \ 161 docker cp tests/add-users.ldif mattermost-openldap:/add-users.ldif;\ 162 docker cp tests/add-groups.ldif mattermost-openldap:/add-groups.ldif;\ 163 docker cp tests/qa-data.ldif mattermost-openldap:/qa-data.ldif;\ 164 docker exec -ti mattermost-openldap bash -c 'ldapadd -x -D "cn=admin,dc=mm,dc=test,dc=com" -w mostest -f /add-users.ldif';\ 165 docker exec -ti mattermost-openldap bash -c 'ldapadd -x -D "cn=admin,dc=mm,dc=test,dc=com" -w mostest -f /add-groups.ldif';\ 166 elif [ $(shell docker ps | grep -ci mattermost-openldap) -eq 0 ]; then \ 167 echo restarting mattermost-openldap; \ 168 docker start mattermost-openldap > /dev/null; \ 169 sleep 10; \ 170 fi 171 172 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-elasticsearch$$ | wc -l) -eq 0 ]; then \ 173 echo starting mattermost-elasticsearch; \ 174 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=-Xms250m -Xmx250m" -d grundleborg/elasticsearch:latest > /dev/null; \ 175 elif [ $(shell docker ps --no-trunc --quiet --filter name=^/mattermost-elasticsearch$$ | wc -l) -eq 0 ]; then \ 176 echo restarting mattermost-elasticsearch; \ 177 docker start mattermost-elasticsearch> /dev/null; \ 178 fi 179 180 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-redis$$ | wc -l) -eq 0 ]; then \ 181 echo starting mattermost-redis; \ 182 docker run --name mattermost-redis -p 6379:6379 -d redis > /dev/null; \ 183 elif [ $(shell docker ps --no-trunc --quiet --filter name=^/mattermost-redis$$ | wc -l) -eq 0 ]; then \ 184 echo restarting mattermost-redis; \ 185 docker start mattermost-redis > /dev/null; \ 186 fi 187 endif 188 else 189 @echo CI Build: skipping docker start 190 endif 191 192 stop-docker: ## Stops the docker containers for local development. 193 @echo Stopping docker containers 194 195 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-mysql$$ | wc -l) -eq 1 ]; then \ 196 echo stopping mattermost-mysql; \ 197 docker stop mattermost-mysql > /dev/null; \ 198 fi 199 200 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-mysql-unittest$$ | wc -l) -eq 1 ]; then \ 201 echo stopping mattermost-mysql-unittest; \ 202 docker stop mattermost-mysql-unittest > /dev/null; \ 203 fi 204 205 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-postgres$$ | wc -l) -eq 1 ]; then \ 206 echo stopping mattermost-postgres; \ 207 docker stop mattermost-postgres > /dev/null; \ 208 fi 209 210 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-postgres-unittest$$ | wc -l) -eq 1 ]; then \ 211 echo stopping mattermost-postgres-unittest; \ 212 docker stop mattermost-postgres-unittest > /dev/null; \ 213 fi 214 215 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-openldap$$ | wc -l) -eq 1 ]; then \ 216 echo stopping mattermost-openldap; \ 217 docker stop mattermost-openldap > /dev/null; \ 218 fi 219 220 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-inbucket$$ | wc -l) -eq 1 ]; then \ 221 echo stopping mattermost-inbucket; \ 222 docker stop mattermost-inbucket > /dev/null; \ 223 fi 224 225 @if [ $(shell docker ps -a | grep -ci mattermost-minio) -eq 1 ]; then \ 226 echo stopping mattermost-minio; \ 227 docker stop mattermost-minio > /dev/null; \ 228 fi 229 230 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-elasticsearch$$ | wc -l) -eq 1 ]; then \ 231 echo stopping mattermost-elasticsearch; \ 232 docker stop mattermost-elasticsearch > /dev/null; \ 233 fi 234 235 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-redis$$ | wc -l) -eq 1 ]; then \ 236 echo stopping mattermost-redis; \ 237 docker stop mattermost-redis > /dev/null; \ 238 fi 239 240 clean-docker: ## Deletes the docker containers for local development. 241 @echo Removing docker containers 242 243 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-mysql$$ | wc -l) -eq 1 ]; then \ 244 echo removing mattermost-mysql; \ 245 docker stop mattermost-mysql > /dev/null; \ 246 docker rm -v mattermost-mysql > /dev/null; \ 247 fi 248 249 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-mysql-unittest$$ | wc -l) -eq 1 ]; then \ 250 echo removing mattermost-mysql-unittest; \ 251 docker stop mattermost-mysql-unittest > /dev/null; \ 252 docker rm -v mattermost-mysql-unittest > /dev/null; \ 253 fi 254 255 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-postgres$$ | wc -l) -eq 1 ]; then \ 256 echo removing mattermost-postgres; \ 257 docker stop mattermost-postgres > /dev/null; \ 258 docker rm -v mattermost-postgres > /dev/null; \ 259 fi 260 261 @if [ $(shell docker ps -a --no-trunc --quiet --filter name=^/mattermost-postgres-unittest$$ | wc -l) -eq 1 ]; then \ 262 echo removing mattermost-postgres-unittest; \ 263 docker stop mattermost-postgres-unittest > /dev/null; \ 264 docker rm -v mattermost-postgres-unittest > /dev/null; \ 265 fi 266 267 @if [ $(shell docker ps -a | grep -ci mattermost-openldap) -eq 1 ]; then \ 268 echo removing mattermost-openldap; \ 269 docker stop mattermost-openldap > /dev/null; \ 270 docker rm -v mattermost-openldap > /dev/null; \ 271 fi 272 273 @if [ $(shell docker ps -a | grep -ci mattermost-inbucket) -eq 1 ]; then \ 274 echo removing mattermost-inbucket; \ 275 docker stop mattermost-inbucket > /dev/null; \ 276 docker rm -v mattermost-inbucket > /dev/null; \ 277 fi 278 279 @if [ $(shell docker ps -a | grep -ci mattermost-minio) -eq 1 ]; then \ 280 echo removing mattermost-minio; \ 281 docker stop mattermost-minio > /dev/null; \ 282 docker rm -v mattermost-minio > /dev/null; \ 283 fi 284 285 @if [ $(shell docker ps -a | grep -ci mattermost-elasticsearch) -eq 1 ]; then \ 286 echo removing mattermost-elasticsearch; \ 287 docker stop mattermost-elasticsearch > /dev/null; \ 288 docker rm -v mattermost-elasticsearch > /dev/null; \ 289 fi 290 291 govet: ## Runs govet against all packages. 292 @echo Running GOVET 293 $(GO) vet $(GOFLAGS) $(TE_PACKAGES) || exit 1 294 295 ifeq ($(BUILD_ENTERPRISE_READY),true) 296 $(GO) vet $(GOFLAGS) $(EE_PACKAGES) || exit 1 297 endif 298 299 gofmt: ## Runs gofmt against all packages. 300 @echo Running GOFMT 301 302 @for package in $(TE_PACKAGES) $(EE_PACKAGES); do \ 303 echo "Checking "$$package; \ 304 files=$$(go list -f '{{range .GoFiles}}{{$$.Dir}}/{{.}} {{end}}' $$package); \ 305 if [ "$$files" ]; then \ 306 gofmt_output=$$(gofmt -d -s $$files 2>&1); \ 307 if [ "$$gofmt_output" ]; then \ 308 echo "$$gofmt_output"; \ 309 echo "gofmt failure"; \ 310 exit 1; \ 311 fi; \ 312 fi; \ 313 done 314 @echo "gofmt success"; \ 315 316 megacheck: ## Run megacheck on codebasis 317 go get honnef.co/go/tools/cmd/megacheck 318 $(GOPATH)/bin/megacheck $(TE_PACKAGES) 319 320 ifeq ($(BUILD_ENTERPRISE_READY),true) 321 $(GOPATH)/bin/megacheck $(EE_PACKAGES) || exit 1 322 endif 323 324 i18n-extract: ## Extract strings for translation from the source code 325 go get -u github.com/mattermost/mattermost-utilities/mmgotool 326 $(GOPATH)/bin/mmgotool i18n extract 327 328 store-mocks: ## Creates mock files. 329 go get -u github.com/vektra/mockery/... 330 $(GOPATH)/bin/mockery -dir store -all -output store/storetest/mocks -note 'Regenerate this file using `make store-mocks`.' 331 332 filesstore-mocks: ## Creates mock files. 333 go get -u github.com/vektra/mockery/... 334 $(GOPATH)/bin/mockery -dir services/filesstore -all -output services/filesstore/mocks -note 'Regenerate this file using `make filesstore-mocks`.' 335 336 ldap-mocks: ## Creates mock files for ldap. 337 go get -u github.com/vektra/mockery/... 338 $(GOPATH)/bin/mockery -dir enterprise/ldap -all -output enterprise/ldap/mocks -note 'Regenerate this file using `make ldap-mocks`.' 339 340 plugin-mocks: ## Creates mock files for plugins. 341 go get -u github.com/vektra/mockery/... 342 $(GOPATH)/bin/mockery -dir plugin -name API -output plugin/plugintest -outpkg plugintest -case underscore -note 'Regenerate this file using `make plugin-mocks`.' 343 $(GOPATH)/bin/mockery -dir plugin -name Hooks -output plugin/plugintest -outpkg plugintest -case underscore -note 'Regenerate this file using `make plugin-mocks`.' 344 345 pluginapi: ## Generates api and hooks glue code for plugins 346 go generate ./plugin 347 348 check-licenses: ## Checks license status. 349 ./scripts/license-check.sh $(TE_PACKAGES) $(EE_PACKAGES) 350 351 check-prereqs: ## Checks prerequisite software status. 352 ./scripts/prereq-check.sh 353 354 check-style: govet gofmt check-licenses ## Runs govet and gofmt against all packages. 355 356 test-te-race: ## Checks for race conditions in the team edition. 357 @echo Testing TE race conditions 358 359 @echo "Packages to test: "$(TE_PACKAGES) 360 361 @for package in $(TE_PACKAGES); do \ 362 echo "Testing "$$package; \ 363 $(GO) test $(GOFLAGS) -race -run=$(TESTS) -test.timeout=4000s $$package || exit 1; \ 364 done 365 366 test-ee-race: ## Checks for race conditions in the enterprise edition. 367 @echo Testing EE race conditions 368 369 ifeq ($(BUILD_ENTERPRISE_READY),true) 370 @echo "Packages to test: "$(EE_PACKAGES) 371 372 for package in $(EE_PACKAGES); do \ 373 echo "Testing "$$package; \ 374 $(GO) test $(GOFLAGS) -race -run=$(TESTS) -c $$package; \ 375 if [ -f $$(basename $$package).test ]; then \ 376 echo "Testing "$$package; \ 377 ./$$(basename $$package).test -test.timeout=2000s || exit 1; \ 378 rm -r $$(basename $$package).test; \ 379 fi; \ 380 done 381 382 rm -f config/*.crt 383 rm -f config/*.key 384 endif 385 386 test-server-race: test-te-race test-ee-race ## Checks for race conditions. 387 find . -type d -name data -not -path './vendor/*' | xargs rm -rf 388 389 do-cover-file: ## Creates the test coverage report file. 390 @echo "mode: count" > cover.out 391 392 go-junit-report: 393 go get -u github.com/jstemmer/go-junit-report 394 395 test-compile: 396 @echo COMPILE TESTS 397 398 for package in $(TE_PACKAGES) $(EE_PACKAGES); do \ 399 $(GO) test $(GOFLAGS) -c $$package; \ 400 done 401 402 test-server: start-docker go-junit-report do-cover-file ## Runs tests. 403 ifeq ($(BUILD_ENTERPRISE_READY),true) 404 @echo Running all tests 405 else 406 @echo Running only TE tests 407 endif 408 ./scripts/test.sh "$(GO)" "$(GOFLAGS)" "$(ALL_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" 409 410 internal-test-web-client: ## Runs web client tests. 411 $(GO) run $(GOFLAGS) $(PLATFORM_FILES) test web_client_tests 412 413 run-server-for-web-client-tests: ## Tests the server for web client. 414 $(GO) run $(GOFLAGS) $(PLATFORM_FILES) test web_client_tests_server 415 416 test-client: ## Test client app. 417 @echo Running client tests 418 419 cd $(BUILD_WEBAPP_DIR) && $(MAKE) test 420 421 test: test-server test-client ## Runs all checks and tests below (except race detection and postgres). 422 423 cover: ## Runs the golang coverage tool. You must run the unit tests first. 424 @echo Opening coverage info in browser. If this failed run make test first 425 426 $(GO) tool cover -html=cover.out 427 $(GO) tool cover -html=ecover.out 428 429 test-data: start-docker ## Add test data to the local instance. 430 $(GO) run $(GOFLAGS) $(GO_LINKER_FLAGS) $(PLATFORM_FILES) sampledata -w 1 431 432 @echo You may need to restart the Mattermost server before using the following 433 @echo ======================================================================== 434 @echo Login with a system admin account username=sysadmin password=sysadmin 435 @echo Login with a regular account username=user-1 password=user-1 436 @echo ======================================================================== 437 438 run-server: start-docker ## Starts the server. 439 @echo Running mattermost for development 440 441 mkdir -p $(BUILD_WEBAPP_DIR)/dist/files 442 $(GO) run $(GOFLAGS) $(GO_LINKER_FLAGS) $(PLATFORM_FILES) --disableconfigwatch & 443 444 debug-server: start-docker 445 mkdir -p $(BUILD_WEBAPP_DIR)/dist/files 446 $(DELVE) debug $(PLATFORM_FILES) --build-flags="-ldflags '\ 447 -X github.com/mattermost/mattermost-server/model.BuildNumber=$(BUILD_NUMBER)\ 448 -X \"github.com/mattermost/mattermost-server/model.BuildDate=$(BUILD_DATE)\"\ 449 -X github.com/mattermost/mattermost-server/model.BuildHash=$(BUILD_HASH)\ 450 -X github.com/mattermost/mattermost-server/model.BuildHashEnterprise=$(BUILD_HASH_ENTERPRISE)\ 451 -X github.com/mattermost/mattermost-server/model.BuildEnterpriseReady=$(BUILD_ENTERPRISE_READY)'" 452 453 run-cli: start-docker ## Runs CLI. 454 @echo Running mattermost for development 455 @echo Example should be like 'make ARGS="-version" run-cli' 456 457 $(GO) run $(GOFLAGS) $(GO_LINKER_FLAGS) $(PLATFORM_FILES) ${ARGS} 458 459 run-client: ## Runs the webapp. 460 @echo Running mattermost client for development 461 462 ln -nfs $(BUILD_WEBAPP_DIR)/dist client 463 cd $(BUILD_WEBAPP_DIR) && $(MAKE) run 464 465 run-client-fullmap: ## Legacy alias to run-client 466 @echo Running mattermost client for development 467 468 cd $(BUILD_WEBAPP_DIR) && $(MAKE) run 469 470 run: check-prereqs run-server run-client ## Runs the server and webapp. 471 472 run-fullmap: run-server run-client ## Legacy alias to run 473 474 stop-server: ## Stops the server. 475 @echo Stopping mattermost 476 477 ifeq ($(BUILDER_GOOS_GOARCH),"windows_amd64") 478 wmic process where "Caption='go.exe' and CommandLine like '%go.exe run%'" call terminate 479 wmic process where "Caption='mattermost.exe' and CommandLine like '%go-build%'" call terminate 480 else 481 @for PID in $$(ps -ef | grep "[g]o run" | awk '{ print $$2 }'); do \ 482 echo stopping go $$PID; \ 483 kill $$PID; \ 484 done 485 @for PID in $$(ps -ef | grep "[g]o-build" | awk '{ print $$2 }'); do \ 486 echo stopping mattermost $$PID; \ 487 kill $$PID; \ 488 done 489 endif 490 491 stop-client: ## Stops the webapp. 492 @echo Stopping mattermost client 493 494 cd $(BUILD_WEBAPP_DIR) && $(MAKE) stop 495 496 stop: stop-server stop-client ## Stops server and client. 497 498 restart: restart-server restart-client ## Restarts the server and webapp. 499 500 restart-server: | stop-server run-server ## Restarts the mattermost server to pick up development change. 501 502 restart-client: | stop-client run-client ## Restarts the webapp. 503 504 run-job-server: ## Runs the background job server. 505 @echo Running job server for development 506 $(GO) run $(GOFLAGS) $(GO_LINKER_FLAGS) $(PLATFORM_FILES) jobserver --disableconfigwatch & 507 508 config-ldap: ## Configures LDAP. 509 @echo Setting up configuration for local LDAP 510 511 @sed -i'' -e 's|"LdapServer": ".*"|"LdapServer": "dockerhost"|g' config/config.json 512 @sed -i'' -e 's|"BaseDN": ".*"|"BaseDN": "dc=mm,dc=test,dc=com"|g' config/config.json 513 @sed -i'' -e 's|"BindUsername": ".*"|"BindUsername": "cn=admin,dc=mm,dc=test,dc=com"|g' config/config.json 514 @sed -i'' -e 's|"BindPassword": ".*"|"BindPassword": "mostest"|g' config/config.json 515 @sed -i'' -e 's|"FirstNameAttribute": ".*"|"FirstNameAttribute": "cn"|g' config/config.json 516 @sed -i'' -e 's|"LastNameAttribute": ".*"|"LastNameAttribute": "sn"|g' config/config.json 517 @sed -i'' -e 's|"NicknameAttribute": ".*"|"NicknameAttribute": "cn"|g' config/config.json 518 @sed -i'' -e 's|"EmailAttribute": ".*"|"EmailAttribute": "mail"|g' config/config.json 519 @sed -i'' -e 's|"UsernameAttribute": ".*"|"UsernameAttribute": "uid"|g' config/config.json 520 @sed -i'' -e 's|"IdAttribute": ".*"|"IdAttribute": "uid"|g' config/config.json 521 @sed -i'' -e 's|"LoginIdAttribute": ".*"|"LoginIdAttribute": "uid"|g' config/config.json 522 @sed -i'' -e 's|"GroupDisplayNameAttribute": ".*"|"GroupDisplayNameAttribute": "cn"|g' config/config.json 523 @sed -i'' -e 's|"GroupIdAttribute": ".*"|"GroupIdAttribute": "entryUUID"|g' config/config.json 524 525 config-reset: ## Resets the config/config.json file to the default. 526 @echo Resetting configuration to default 527 rm -f config/config.json 528 cp config/default.json config/config.json 529 530 clean: stop-docker ## Clean up everything except persistant server data. 531 @echo Cleaning 532 533 rm -Rf $(DIST_ROOT) 534 go clean $(GOFLAGS) -i ./... 535 536 cd $(BUILD_WEBAPP_DIR) && $(MAKE) clean 537 538 find . -type d -name data -not -path './vendor/*' | xargs rm -rf 539 rm -rf logs 540 541 rm -f mattermost.log 542 rm -f mattermost.log.jsonl 543 rm -f npm-debug.log 544 rm -f .prepare-go 545 rm -f enterprise 546 rm -f cover.out 547 rm -f ecover.out 548 rm -f *.out 549 rm -f *.test 550 rm -f imports/imports.go 551 rm -f cmd/platform/cprofile*.out 552 rm -f cmd/mattermost/cprofile*.out 553 554 nuke: clean clean-docker ## Clean plus removes persistant server data. 555 @echo BOOM 556 557 rm -rf data 558 559 setup-mac: ## Adds macOS hosts entries for Docker. 560 echo $$(boot2docker ip 2> /dev/null) dockerhost | sudo tee -a /etc/hosts 561 562 563 todo: ## Display TODO and FIXME items in the source code. 564 @! ag --ignore Makefile --ignore-dir vendor --ignore-dir runtime TODO 565 @! ag --ignore Makefile --ignore-dir vendor --ignore-dir runtime XXX 566 @! ag --ignore Makefile --ignore-dir vendor --ignore-dir runtime FIXME 567 @! ag --ignore Makefile --ignore-dir vendor --ignore-dir runtime "FIX ME" 568 ifeq ($(BUILD_ENTERPRISE_READY),true) 569 @! ag --ignore Makefile --ignore-dir vendor --ignore-dir runtime TODO enterprise/ 570 @! ag --ignore Makefile --ignore-dir vendor --ignore-dir runtime XXX enterprise/ 571 @! ag --ignore Makefile --ignore-dir vendor --ignore-dir runtime FIXME enterprise/ 572 @! ag --ignore Makefile --ignore-dir vendor --ignore-dir runtime "FIX ME" enterprise/ 573 endif 574 575 ## Help documentatin à la https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html 576 help: 577 @grep -E '^[a-zA-Z_-]+:.*?## .*$$' ./Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'