From 19d6fe40c244b4871f289f4390d6cc12830bfb83 Mon Sep 17 00:00:00 2001 From: Tim Scheuermann Date: Fri, 17 Jun 2022 13:42:56 +0200 Subject: [PATCH] [MM-44363] Detect M1 and load compatible Elasticsearch version (#20420) Thanks to @phoinixgrr, @agnivade, and @isacikgoz for their help. --- Makefile | 12 +++++++++++- docker-compose.makefile.m1.yml | 13 +++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 docker-compose.makefile.m1.yml diff --git a/Makefile b/Makefile index 7985a7679e..c5e6fc0d2b 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,11 @@ else export IS_LINUX = endif +# Detect M1/M2 Macs and set a flag. +ifeq ($(shell uname)/$(shell uname -m),Darwin/arm64) + M1_MAC = true +endif + define LICENSE_HEADER // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. @@ -177,6 +182,11 @@ ifneq ("$(wildcard ./docker-compose.override.yaml)","") DOCKER_COMPOSE_OVERRIDE=-f docker-compose.override.yaml endif +ifeq ($(M1_MAC),true) + $(info M1 detected, applying elasticsearch override) + DOCKER_COMPOSE_OVERRIDE := -f docker-compose.makefile.m1.yml $(DOCKER_COMPOSE_OVERRIDE) +endif + ifneq ($(DOCKER_SERVICES_OVERRIDE),true) ifeq (,$(findstring minio,$(ENABLED_DOCKER_SERVICES))) TEMP_DOCKER_SERVICES:=$(TEMP_DOCKER_SERVICES) minio @@ -187,7 +197,7 @@ ifneq ($(DOCKER_SERVICES_OVERRIDE),true) endif ifeq (,$(findstring elasticsearch,$(ENABLED_DOCKER_SERVICES))) TEMP_DOCKER_SERVICES:=$(TEMP_DOCKER_SERVICES) elasticsearch - endif + endif endif ENABLED_DOCKER_SERVICES:=$(ENABLED_DOCKER_SERVICES) $(TEMP_DOCKER_SERVICES) endif diff --git a/docker-compose.makefile.m1.yml b/docker-compose.makefile.m1.yml new file mode 100644 index 0000000000..69255bae05 --- /dev/null +++ b/docker-compose.makefile.m1.yml @@ -0,0 +1,13 @@ +version: '2.4' +services: + elasticsearch: + image: "elasticsearch:7.17.3" + platform: linux/arm64/v8 + restart: 'no' + container_name: mattermost-elasticsearch + ports: + - "9200:9200" + - "9300:9300" + extends: + file: build/docker-compose.common.yml + service: elasticsearch