diff --git a/Makefile b/Makefile index 2a6ab35ab..87e2ac30c 100644 --- a/Makefile +++ b/Makefile @@ -69,6 +69,17 @@ help: ## - Show help message @printf "${CMD_COLOR_ON} usage: make [target]\n\n${CMD_COLOR_OFF}" @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | sed -e "s/^Makefile://" | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' +.PHONY: multipass +multipass: ## - Launch a multipass instance for development +ifeq ($(shell uname -p),arm) + $(eval ARCH := arm64) +else + $(eval ARCH := amd64) +endif + @cat dev-tools/multipass-cloud-init.yml.txt | GO_VERSION=${GO_VERSION} ARCH=${ARCH} envsubst > dev-tools/multipass-cloud-init.yml + @multipass launch --cloud-init=dev-tools/multipass-cloud-init.yml --mount ..:~/git --name fleet-server-dev --memory 8G --cpus 2 --disk 50G noble + @rm dev-tools/multipass-cloud-init.yml + .PHONY: list-platforms list-platforms: ## - Show the possible PLATFORMS @echo "${PLATFORMS}" diff --git a/dev-tools/multipass-cloud-init.yml b/dev-tools/multipass-cloud-init.yml.txt similarity index 70% rename from dev-tools/multipass-cloud-init.yml rename to dev-tools/multipass-cloud-init.yml.txt index 657ce8745..e947fd984 100644 --- a/dev-tools/multipass-cloud-init.yml +++ b/dev-tools/multipass-cloud-init.yml.txt @@ -10,7 +10,7 @@ apt: sources: docker.list: - source: deb [arch=amd64] https://download.docker.com/linux/ubuntu $RELEASE stable + source: deb [arch=${ARCH}] https://download.docker.com/linux/ubuntu noble stable keyid: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 groups: - docker @@ -32,9 +32,12 @@ packages: - containerd.io - docker-buildx-plugin - docker-compose-plugin + - unzip + - zip write_files: - content: | export PATH=$PATH:/usr/local/go/bin + export PATH=$PATH:$(go env GOPATH)/bin path: /etc/profile.d/go-bin.sh # backwords compatibilityi alias for docker-compose # makefile does not use the alias @@ -43,6 +46,8 @@ write_files: path: /etc/profile.d/docker-compose-alias.sh runcmd: - [ mkdir, /run/go ] - - [ wget, https://go.dev/dl/go1.20.4.linux-amd64.tar.gz, -O, /run/go/go.tar.gz ] # FIXME don't hardcode go version + - [ wget, https://go.dev/dl/go${GO_VERSION}.linux-${ARCH}.tar.gz, -O, /run/go/go.tar.gz ] - [ tar, -xzf, /run/go/go.tar.gz, -C, /usr/local/ ] - [ rm, -rf, /run/go ] + - [ su, ubuntu, -c, "/usr/local/go/bin/go install github.com/magefile/mage@latest" ] + - [ su, ubuntu, -c, "/usr/local/go/bin/go install github.com/go-delve/delve/cmd/dlv@latest" ]