From 738236c7d2fd26edd2b0cca64800f229b921860d Mon Sep 17 00:00:00 2001 From: Khue Doan Date: Wed, 1 Dec 2021 22:44:10 +0700 Subject: [PATCH] build: optimize dev environment build targets --- Makefile | 4 ++++ docs/src/try_on_a_vm.md | 23 +++++++++++++++++++---- metal/Makefile | 13 ++++++------- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 8ad5ae5b..e6b7c20b 100644 --- a/Makefile +++ b/Makefile @@ -21,3 +21,7 @@ docs: lint: # TODO (feature) Add lint checks for everything make -C metal lint + +dev: + make -C metal cluster env=dev + make -C bootstrap diff --git a/docs/src/try_on_a_vm.md b/docs/src/try_on_a_vm.md index 7b9c94e9..fd3bf2da 100644 --- a/docs/src/try_on_a_vm.md +++ b/docs/src/try_on_a_vm.md @@ -4,8 +4,10 @@ Install the following packages: -- `virtualbox` +- `docker` +- `make` - `vagrant` +- `virtualbox` ## Build @@ -16,11 +18,24 @@ Change the IP prefix in the Vagrant config to match your LAN setup, for example {{#include ../../metal/Vagrantfile:4}} ``` -Follow the remaining steps in the [configuration guide](./deployment/configuration.md), then build the cluster and bootstrap it: +Follow the **remaining steps in the [configuration guide](./deployment/configuration.md)**, then create a test VM: ```sh -make -C metal dev -make bootstrap +cd metal +vagrant up +cd .. +``` + +Open the tools container: + +```sh +make tools +``` + +Build a cluster on the test VM and bootstrap it: + +``` +make dev ``` Finally follow the [DNS guide](./deployment/dns.md) to update your DNS setup (the easiest one is the `/etc/hosts` option) diff --git a/metal/Makefile b/metal/Makefile index ec613625..1ecb79ce 100644 --- a/metal/Makefile +++ b/metal/Makefile @@ -1,27 +1,26 @@ .POSIX: +env ?= "prod" + default: boot cluster boot: ansible-playbook \ - --inventory inventories/prod.ini \ + --inventory inventories/${env}.ini \ boot.yml cluster: ansible-playbook \ - --inventory inventories/prod.ini \ + --inventory inventories/${env}.ini \ cluster.yml shutdown: ansible-playbook \ - --inventory inventories/prod.ini \ + --inventory inventories/${env}.ini \ shutdown.yml lint: ansible-lint --project-dir . -dev: +vagrant: vagrant up - ansible-playbook \ - --inventory inventories/dev.ini \ - cluster.yml