From 0d529a486506e163a2583c44f857ed5987386992 Mon Sep 17 00:00:00 2001 From: ILYA Khlopotov Date: Fri, 5 Nov 2021 06:04:01 -0700 Subject: [PATCH 01/13] Setup asdf and direnv managed development environment Now `cd` into the project directory would activate correct versions of build dependencies. --- .envrc | 3 ++ .gitignore | 4 ++ .tool-versions | 4 ++ Makefile | 29 +++++++++++++ README.md | 111 +++++++++++++++++++++++++++++++++++++++++++++++-- 5 files changed, 147 insertions(+), 4 deletions(-) create mode 100644 .envrc create mode 100644 .tool-versions create mode 100644 Makefile diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..d6e34ba6 --- /dev/null +++ b/.envrc @@ -0,0 +1,3 @@ +use asdf +watch_file ".asdf" +dotenv_if_exists .envrc.local \ No newline at end of file diff --git a/.gitignore b/.gitignore index 522466d9..2ac1c29e 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,7 @@ build.log build.log .cache clouseau.iml + +# direnv & asdf +.asdf +.envrc.local \ No newline at end of file diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 00000000..0aacd074 --- /dev/null +++ b/.tool-versions @@ -0,0 +1,4 @@ +maven 3.8.2 +java zulu-7.48.0.11 +scala 2.9.1.final + diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..f4b23aba --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +.PHONY: build +# target: build - Build package, run tests and create distribution +build: .asdf + @mvn + +# target: tools - Bootstrap all build tools +PHONY: tools +tools: .asdf + @touch .envrc + +.PHONY: run +# target: run - Start local inistance of clouseau +run: .asdf + @mvn scala:run -Dlauncher=clouseau1 + +.PHONY: help +# target: help - Print this help +help: + @egrep "^# target: " Makefile \ + | sed -e 's/^# target: //g' \ + | sort \ + | awk '{printf(" %-20s", $$1); $$1=$$2=""; print "-" $$0}' + +.asdf: .tool-versions + @cat $< | cut -d' ' -f 1 | xargs -I {} sh -c '\ + asdf list {} > /dev/null 2>&1 \ + || asdf plugin-add {}' + @asdf install + @touch $@ diff --git a/README.md b/README.md index f458dd2c..37e1b86e 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,111 @@ Expose Lucene features to erlang RPC. +## Setting up the development environment + +We use a combination of [`direnv`](https://github.com/direnv/direnv) and [`asdf`](https://github.com/asdf-vm/asdf) to manage development environment. +The minimal set of tools you need to install manually is: + +- xcode +- brew +- asdf +- git +- coreutils + +1. install asdf itself +``` +brew install asdf +``` +2. integrate asdf with your shell + - fish + ``` + echo -e "\nsource $(brew --prefix asdf)/libexec/asdf.fish" >> ~/.config/fish/config.fish + ``` + - bash + ``` + echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ~/.bash_profile + ``` + - zsh + ``` + echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ${ZDOTDIR:-~}/.zshrc + ``` +3. install direnv plugin +``` +asdf plugin-add direnv +asdf install direnv latest +asdf global direnv latest +``` +4. integrate direnv plugin with your shell + - fish + ``` + printf "\ + # Hook direnv into your shell. + asdf exec direnv hook fish | source + + # A shortcut for asdf managed direnv. + function direnv + asdf exec direnv \"\$argv\" + end + " >> ~/.config/fish/config.fish + ``` + - bash + ``` + cat << EOF >> ~/.bashrc + # Hook direnv into your shell. + eval "$(asdf exec direnv hook bash)" + + # A shortcut for asdf managed direnv. + direnv() { asdf exec direnv "$@"; } + EOF + ``` + - zsh + ``` + cat << EOF >> ~/.zshrc + # Hook direnv into your shell. + eval "$(asdf exec direnv hook zsh)" + + # A shortcut for asdf managed direnv. + direnv() { asdf exec direnv "$@"; } + EOF + ``` +5. enable `use asdf` feature +``` +echo 'source "$(asdf direnv hook asdf)"' >> ~/.config/direnv/direnvrc +``` +6. exit from the current shell or start a new one +7. `cd` into the directory where you checked out `clouseau` and do `direnv allow` +8. do `make tools` (we need it only when we add new tools into `.tool-versions`) + +Now every time you `cd` into the project directory the correct versions of tools +will be activated. + +### Custom Java + +In some cases version of Java is not available in asdf-java. +There is a trick which makes globally available version recognized by +asdf. + +``` +ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home ~/.asdf/installs/java/oracle-1.7.0 +asdf reshim java +``` + +## Building distribution + +Just run `make` to get `target/clouseau-{version}-SNAPSHOT.zip` file. + +## Running locally + +`make run` + +## Changing tools version + +The list of tools are configured in a `.tool-versions` file. Make sure you +run `make tools` every time you add new tools. You don't need to do it when +there is just a version change. + ## Configuration options -This guide explains the various clouseau configuration options available, and how to use them to tune clouseau performance and scalability. There are two categories of clouseau options, first category is about tuning the JVM (ex: Xmx) and other category of options that go into clouseau.ini. +This guide explains the various clouseau configuration options available, and how to use them to tune clouseau performance and scalability. There are two categories of clouseau options, first category is about tuning the JVM (ex: Xmx) and other category of options that go into clouseau.ini. Clouseau configuration options (as determined by the relevant role in chef-repo) are stored in `/opt/clouseau/etc/clouseau.ini` and some options (about JVM tuning) go into the command used to start and stop clouseau. @@ -52,7 +155,7 @@ This option allows to specify the maximum number indices opened at a given point These options allows us to close the search indices if there is no activity within a specified interval. As mentioned in the above section about the `max_indexes_open`, when number of indices opened reaches the `max_indexes_open` limit then clouseau will close the index that was opened first even if there is an activity on that index. This was leading to errors and hence added this option to close the idle indices first. Basically we will close the idle indices so that we can avoid reaching the limit specified in `max_indexes_open`. So that we will close the idle indices first and if we still reach the limit then clouseau will close the oldest index (based on the open time). -If `close_if_idle` is set to true, then it will start monitoring the activity of the indices and will close the index if there is no activity in two consecutive idle check intervals. By default the `idle_check_interval_secs` is 300 seconds (5 minutes) and can be overridden by specifying the `idle_check_interval_secs`. In the example configuration specified in the above section, this was set to 600 seconds, which will close the index if there is no activity for anywhere between 601 to 1200 seconds. +If `close_if_idle` is set to true, then it will start monitoring the activity of the indices and will close the index if there is no activity in two consecutive idle check intervals. By default the `idle_check_interval_secs` is 300 seconds (5 minutes) and can be overridden by specifying the `idle_check_interval_secs`. In the example configuration specified in the above section, this was set to 600 seconds, which will close the index if there is no activity for anywhere between 601 to 1200 seconds. This variation (instead of fixed) in the index closing due to inactivity is a result of the implementation approach, where during the first index idle check interval we mark the index as idle and close that index if the state is still idle during the next check. And if there is any activity between the two `index idle check` intervals then it will not be closed. @@ -64,7 +167,7 @@ This variation (instead of fixed) in the index closing due to inactivity is a re s:maintenance_mode("heap dump of clouseau"). ``` 2. Find the clouseau pid (process: "java [...] com.cloudant.clouseau.Main /opt/cloudant/etc/clouseau.ini" ): - + ``` ps aux | grep clouseau ``` @@ -84,5 +187,5 @@ This variation (instead of fixed) in the index closing due to inactivity is a re ``` rsync -avz db..cloudant.com:/srv/heap.bin . ``` - + 7. Analyze the heap dump using `visualVM` tool or Eclipse memory analyzer tool(http://www.eclipse.org/mat/downloads.php). From 06565f2e21771b979da950ca73e8c0b76eb788b7 Mon Sep 17 00:00:00 2001 From: ILYA Khlopotov Date: Fri, 5 Nov 2021 08:08:20 -0700 Subject: [PATCH 02/13] Replace `make run` with `make clouseau{1,2,3}` targets --- Makefile | 18 ++++++++++++++---- README.md | 11 ++++++++++- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index f4b23aba..7daf5537 100644 --- a/Makefile +++ b/Makefile @@ -8,10 +8,20 @@ PHONY: tools tools: .asdf @touch .envrc -.PHONY: run -# target: run - Start local inistance of clouseau -run: .asdf - @mvn scala:run -Dlauncher=clouseau1 +.PHONY: clouseau1 +# target: clouseau1 - Start local inistance of clouseau1 node +clouseau1: .asdf + @mvn scala:run -Dlauncher=$< + +.PHONY: clouseau2 +# target: clouseau2 - Start local inistance of clouseau2 node +clouseau2: .asdf + @mvn scala:run -Dlauncher=$< + +.PHONY: clouseau3 +# target: clouseau3 - Start local inistance of clouseau3 node +clouseau3: .asdf + @mvn scala:run -Dlauncher=$< .PHONY: help # target: help - Print this help diff --git a/README.md b/README.md index 37e1b86e..b673bc43 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,16 @@ Just run `make` to get `target/clouseau-{version}-SNAPSHOT.zip` file. ## Running locally -`make run` +To run single node instance use `make clouseau1`. + +Usually for testing all three nodes might be needed. In such case run following +from separate terminals: + +``` +make clouseau1 +make clouseau2 +make clouseau3 +``` ## Changing tools version From 7c9a89e7d633710564af67cbde73f66f1ced7a30 Mon Sep 17 00:00:00 2001 From: ILYA Khlopotov Date: Mon, 8 Nov 2021 10:59:21 -0800 Subject: [PATCH 03/13] Add 'make clean' --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 7daf5537..074af6ad 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,11 @@ clouseau2: .asdf clouseau3: .asdf @mvn scala:run -Dlauncher=$< +.PHONY: clean +# target: clean - Remove build artifacts +clean: + @mvn clean + .PHONY: help # target: help - Print this help help: From c13699f7f8d2d782f79bd312049194212aa9ff6e Mon Sep 17 00:00:00 2001 From: ILYA Khlopotov Date: Mon, 8 Nov 2021 11:14:15 -0800 Subject: [PATCH 04/13] Fix launcher name for 'make clouseau{1,2,3}' --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 074af6ad..80391841 100644 --- a/Makefile +++ b/Makefile @@ -11,17 +11,17 @@ tools: .asdf .PHONY: clouseau1 # target: clouseau1 - Start local inistance of clouseau1 node clouseau1: .asdf - @mvn scala:run -Dlauncher=$< + @mvn scala:run -Dlauncher=$@ .PHONY: clouseau2 # target: clouseau2 - Start local inistance of clouseau2 node clouseau2: .asdf - @mvn scala:run -Dlauncher=$< + @mvn scala:run -Dlauncher=$@ .PHONY: clouseau3 # target: clouseau3 - Start local inistance of clouseau3 node clouseau3: .asdf - @mvn scala:run -Dlauncher=$< + @mvn scala:run -Dlauncher=$@ .PHONY: clean # target: clean - Remove build artifacts From 693246061b0d9d81c304c35413761219dd04a80d Mon Sep 17 00:00:00 2001 From: ILYA Khlopotov Date: Mon, 20 Nov 2023 11:21:49 -0800 Subject: [PATCH 05/13] Modernize setup --- .envrc | 40 ++++++- .gitignore | 2 +- .tool-versions | 1 - Makefile | 283 +++++++++++++++++++++++++++++++++++++++++++++---- 4 files changed, 303 insertions(+), 23 deletions(-) diff --git a/.envrc b/.envrc index d6e34ba6..9f22f3cb 100644 --- a/.envrc +++ b/.envrc @@ -1,3 +1,41 @@ +tools::has() { + type "$1" &>/dev/null +} + +if ! tools::has tput; then + echo "'tput' tool is missing" +fi + +console::bold() { + tput bold +} + +console::red() { + tput setaf 1 +} + +console::reset() { + tput sgr0 +} + +die() { + echo -e "$(console::red)$(console::bold)FATAL: ${*}$(console::reset)" >&2 + exit 1 +} + + +asdf::has() { + asdf current $1 >>/dev/null 2>&1 +} + use asdf + +while read asdf_tool; do + if ! asdf::has ${asdf_tool}; then asdf direnv local ${asdf_tool}; fi +done < <(cat .tool-versions | grep -v '\#') + watch_file ".asdf" -dotenv_if_exists .envrc.local \ No newline at end of file +dotenv_if_exists .envrc.local + +export JAVA_HOME=$(dirname $(dirname $(expand_path $(asdf which java) "/"))) +export ASDF_DIRENV_CLOUSEAU=true diff --git a/.gitignore b/.gitignore index 2ac1c29e..f6635c60 100644 --- a/.gitignore +++ b/.gitignore @@ -44,4 +44,4 @@ clouseau.iml # direnv & asdf .asdf -.envrc.local \ No newline at end of file +.envrc.local diff --git a/.tool-versions b/.tool-versions index 0aacd074..33f8f571 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,4 +1,3 @@ maven 3.8.2 java zulu-7.48.0.11 scala 2.9.1.final - diff --git a/Makefile b/Makefile index 80391841..44490039 100644 --- a/Makefile +++ b/Makefile @@ -1,44 +1,287 @@ +.PHONY: help +# target: help - Print this help +help: + @egrep "^# target: " Makefile \ + | sed -e 's/^# target: //g' \ + | sort \ + | awk '{printf(" %-20s", $$1); $$1=$$2=""; print "-" $$0}' + .PHONY: build # target: build - Build package, run tests and create distribution build: .asdf @mvn -# target: tools - Bootstrap all build tools -PHONY: tools -tools: .asdf - @touch .envrc - .PHONY: clouseau1 # target: clouseau1 - Start local inistance of clouseau1 node clouseau1: .asdf - @mvn scala:run -Dlauncher=$@ + @mvn scala:run -Dname=$@ .PHONY: clouseau2 # target: clouseau2 - Start local inistance of clouseau2 node clouseau2: .asdf - @mvn scala:run -Dlauncher=$@ + @mvn scala:run -Dname=$@ .PHONY: clouseau3 # target: clouseau3 - Start local inistance of clouseau3 node clouseau3: .asdf - @mvn scala:run -Dlauncher=$@ + @mvn scala:run -Dname=$@ .PHONY: clean # target: clean - Remove build artifacts clean: @mvn clean -.PHONY: help -# target: help - Print this help -help: - @egrep "^# target: " Makefile \ - | sed -e 's/^# target: //g' \ - | sort \ - | awk '{printf(" %-20s", $$1); $$1=$$2=""; print "-" $$0}' +# ========================== +# Setting up the environment +# -------------------------- + +define CURRENT_SHELL +"$(shell basename $${SHELL})" +endef -.asdf: .tool-versions - @cat $< | cut -d' ' -f 1 | xargs -I {} sh -c '\ - asdf list {} > /dev/null 2>&1 \ - || asdf plugin-add {}' - @asdf install +define CURRENT_OS +"$(shell uname -s | tr '[:upper:]' '[:lower:]')" +endef + +# Testing from fish +# set SHELL bash && make .asdf +# set SHELL fish && make .asdf +# set SHELL zsh && make .asdf +# set SHELL unsupported && make .asdf +# Testing from other shells +# SHELL=bash && make .asdf +# SHELL=fish && make .asdf +# SHELL=zsh && make .asdf +# SHELL=unsupported && make .asdf + +ifndef ASDF_DIRENV_BIN +.asdf: + @case $(CURRENT_SHELL)-$(CURRENT_OS) in \ + fish-darwin) echo "$$FISH_DARWIN_HELP" ;; \ + bash-darwin) echo "$$BASH_DARWIN_HELP" ;; \ + zsh-darwin) echo "$$ZSH_DARWIN_HELP" ;; \ + *) echo "$$CONTRIBUTE_SHELL_SETUP" ;; \ + esac +else +.asdf: @touch $@ + @touch .envrc +endif + +define FISH_DARWIN_HELP +There are two steps which need to be done to set up environment. + + - The asdf tool manager would need to be installed + - The direnv plugin for asdf manager would need to be installed + + += Setting up asdf tool manager + + You can install asdf from brew by following command. + + ``` + brew install asdf + ``` + + Once you finish installation add following line to ~/.config/fish/config.fish + + ``` + source (brew --prefix asdf)/libexec/asdf.fish + ``` + + You can do it by copy/paste of the following line + + ``` + echo -e "\\nsource (brew --prefix asdf)/libexec/asdf.fish" >> ~/.config/fish/config.fish + ``` + += Setting up direnv + + Run following commands to install direnv plugin + + ``` + asdf plugin-add direnv + asdf install direnv latest + asdf global direnv latest + ``` + + Once you have done with above commands add following to the ~/.config/fish/config.fish + + ``` + # Hook direnv into your shell. + asdf exec direnv hook fish | source + + # A shortcut for asdf managed direnv. + function direnv + asdf exec direnv "$$argv" + end + ``` + + You can do it by copy/paste of the following + + ``` + printf "\ + # Hook direnv into your shell. + asdf exec direnv hook fish | source + + # A shortcut for asdf managed direnv. + function direnv + asdf exec direnv \\"\$$argv\\" + end + " >> ~/.config/fish/config.fish + ``` + += Enabling direnv integration + +- After finishing the above two steps restart your shell. +- Run following `asdf direnv setup --shell fish --version latest` +- Restart your shell once again + +endef +export FISH_DARWIN_HELP + +define BASH_DARWIN_HELP + +There are two steps which need to be done to set up environment. + + - The asdf tool manager would need to be installed + - The direnv plugin for asdf manager would need to be installed + + += Setting up asdf tool manager + + You can install asdf from brew by following command. + + ``` + brew install asdf + ``` + + Once you finish installation add following line to ~/.bash_profile + + ``` + source $$(brew --prefix asdf)/libexec/asdf.sh + ``` + + You can do it by copy/paste of the following line + ``` + echo -e "\n. $$(brew --prefix asdf)/libexec/asdf.sh" >> ~/.bash_profile + ``` + += Setting up direnv + + Run following commands to install direnv plugin + + ``` + asdf plugin-add direnv + asdf install direnv latest + asdf global direnv latest + ``` + + Once you have done with above commands add following to the ~/.bash_profile + + ``` + # Hook direnv into your shell. + eval "$$(asdf exec direnv hook bash)" + + # A shortcut for asdf managed direnv. + direnv() { asdf exec direnv "$$@"; } + ``` + + You can do it by copy/paste of the following + + ``` + cat << EOF >> ~/.bashrc + # Hook direnv into your shell. + eval "$$(asdf exec direnv hook bash)" + + # A shortcut for asdf managed direnv. + direnv() { asdf exec direnv "$$@"; } + EOF + ``` + += Enabling direnv integration + +- After finishing the above two steps restart your shell. +- Run following `asdf direnv setup --shell bash --version latest` +- Restart your shell once again + +endef +export BASH_DARWIN_HELP + +define ZSH_DARWIN_HELP + +There are two steps which need to be done to set up environment. + + - The asdf tool manager would need to be installed + - The direnv plugin for asdf manager would need to be installed + + += Setting up asdf tool manager + + You can install asdf from brew by following command. + + ``` + brew install asdf + ``` + + Once you finish installation add following line to ~/.zshrc + (or ${ZDOTDIR}/.zshrc if you use custom location). + + ``` + source $$(brew --prefix asdf)/libexec/asdf.sh + ``` + + You can do it by copy/paste of the following line + ``` + echo -e "\n. $$(brew --prefix asdf)/libexec/asdf.sh" >> $${ZDOTDIR:-~}/.zshrc + ``` + += Setting up direnv + + Run following commands to install direnv plugin + + ``` + asdf plugin-add direnv + asdf install direnv latest + asdf global direnv latest + ``` + + Once you have done with above commands add following to the ~/.zshrc + (or ${ZDOTDIR}/.zshrc if you use custom location). + + + ``` + # Hook direnv into your shell. + eval "$$(asdf exec direnv hook zsh)" + + # A shortcut for asdf managed direnv. + direnv() { asdf exec direnv "$$@"; } + ``` + + You can do it by copy/paste of the following + + ``` + cat << EOF >> ~/.zshrc + # Hook direnv into your shell. + eval "$$(asdf exec direnv hook zsh)" + + # A shortcut for asdf managed direnv. + direnv() { asdf exec direnv "$$@"; } + EOF + ``` + += Enabling direnv integration + +- After finishing the above two steps restart your shell. +- Run following `asdf direnv setup --shell zsh --version latest` +- Restart your shell once again + +endef +export ZSH_DARWIN_HELP + + +define CONTRIBUTE_SHELL_SETUP + We detected $(CURRENT_SHELL) running on $(CURRENT_OS). Unfortunatelly + documentation for this combination is not available. Contributions are welcome. +endef +export CONTRIBUTE_SHELL_SETUP \ No newline at end of file From 0963ee06d5c853660ad961675c276eda50db779b Mon Sep 17 00:00:00 2001 From: ILYA Khlopotov Date: Mon, 20 Nov 2023 11:40:18 -0800 Subject: [PATCH 06/13] Add check-epmd --- Makefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 44490039..8a4146f6 100644 --- a/Makefile +++ b/Makefile @@ -8,22 +8,22 @@ help: .PHONY: build # target: build - Build package, run tests and create distribution -build: .asdf +build: .asdf check-epmd @mvn .PHONY: clouseau1 # target: clouseau1 - Start local inistance of clouseau1 node -clouseau1: .asdf +clouseau1: .asdf check-epmd @mvn scala:run -Dname=$@ .PHONY: clouseau2 # target: clouseau2 - Start local inistance of clouseau2 node -clouseau2: .asdf +clouseau2: .asdf check-epmd @mvn scala:run -Dname=$@ .PHONY: clouseau3 # target: clouseau3 - Start local inistance of clouseau3 node -clouseau3: .asdf +clouseau3: .asdf check-epmd @mvn scala:run -Dname=$@ .PHONY: clean @@ -31,6 +31,9 @@ clouseau3: .asdf clean: @mvn clean +check-epmd: + @if ! lsof -i TCP:4369 | grep -q epmd ; then echo "Error: Please start 'epmd' first"; exit 1; fi + # ========================== # Setting up the environment # -------------------------- From d814b411a1c0108e340e873dfd1d86285b606743 Mon Sep 17 00:00:00 2001 From: ILYA Khlopotov Date: Mon, 20 Nov 2023 11:54:52 -0800 Subject: [PATCH 07/13] Add empty line at the end of a Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8a4146f6..9d43664a 100644 --- a/Makefile +++ b/Makefile @@ -287,4 +287,4 @@ define CONTRIBUTE_SHELL_SETUP We detected $(CURRENT_SHELL) running on $(CURRENT_OS). Unfortunatelly documentation for this combination is not available. Contributions are welcome. endef -export CONTRIBUTE_SHELL_SETUP \ No newline at end of file +export CONTRIBUTE_SHELL_SETUP From 6e4110721ab6b786426057f50e9220d3302f945c Mon Sep 17 00:00:00 2001 From: ILYA Khlopotov Date: Mon, 20 Nov 2023 18:56:30 -0800 Subject: [PATCH 08/13] Add +dependency-reduced-pom.xml to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index f6635c60..b561cfda 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,8 @@ build.log build.log .cache clouseau.iml +dependency-reduced-pom.xml + # direnv & asdf .asdf From 8987d6eb25d2913555050c2e2ea8b539561f3f0d Mon Sep 17 00:00:00 2001 From: ILYA Khlopotov Date: Tue, 21 Nov 2023 12:27:24 -0800 Subject: [PATCH 09/13] Add direnv to .tool-versions --- .tool-versions | 1 + 1 file changed, 1 insertion(+) diff --git a/.tool-versions b/.tool-versions index 33f8f571..aec3a948 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,4 @@ +direnv 2.32.3 maven 3.8.2 java zulu-7.48.0.11 scala 2.9.1.final From 5e95fd5c9b72d0eac92bae9a519bd115ee22ce7f Mon Sep 17 00:00:00 2001 From: ILYA Khlopotov Date: Tue, 21 Nov 2023 12:28:40 -0800 Subject: [PATCH 10/13] Colapse redundant targets --- Makefile | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 9d43664a..2b5b6f22 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +instances = clouseau1 clouseau2 clouseau3 .PHONY: help # target: help - Print this help help: @@ -11,19 +12,10 @@ help: build: .asdf check-epmd @mvn -.PHONY: clouseau1 # target: clouseau1 - Start local inistance of clouseau1 node -clouseau1: .asdf check-epmd - @mvn scala:run -Dname=$@ - -.PHONY: clouseau2 # target: clouseau2 - Start local inistance of clouseau2 node -clouseau2: .asdf check-epmd - @mvn scala:run -Dname=$@ - -.PHONY: clouseau3 # target: clouseau3 - Start local inistance of clouseau3 node -clouseau3: .asdf check-epmd +$(instances): .asdf check-epmd @mvn scala:run -Dname=$@ .PHONY: clean From 8099855a0ab17b61df1db60b8efc75ddc75dcc8a Mon Sep 17 00:00:00 2001 From: ILYA Khlopotov Date: Tue, 21 Nov 2023 12:30:03 -0800 Subject: [PATCH 11/13] Add WITH_COOKIE support --- Makefile | 6 +++++- README.md | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2b5b6f22..1817b865 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,8 @@ instances = clouseau1 clouseau2 clouseau3 +ifneq ($(WITH_COOKIE),) +with-cookie := -Dlauncher=with-cookie -Dcookie=$(WITH_COOKIE) +endif + .PHONY: help # target: help - Print this help help: @@ -16,7 +20,7 @@ build: .asdf check-epmd # target: clouseau2 - Start local inistance of clouseau2 node # target: clouseau3 - Start local inistance of clouseau3 node $(instances): .asdf check-epmd - @mvn scala:run -Dname=$@ + @mvn scala:run -Dname=$@ $(with-cookie) .PHONY: clean # target: clean - Remove build artifacts diff --git a/README.md b/README.md index b673bc43..d486c53f 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,14 @@ make clouseau2 make clouseau3 ``` +## Specifying Erlang cookie + +The cookie for a node can be specified using following + +``` +make clouseau2 WITH_COOKIE=2123 +``` + ## Changing tools version The list of tools are configured in a `.tool-versions` file. Make sure you From e362d8792b4bd3bf3750f822c01694af94d2d8c0 Mon Sep 17 00:00:00 2001 From: ILYA Khlopotov Date: Tue, 21 Nov 2023 12:30:24 -0800 Subject: [PATCH 12/13] Use pgrep instead of lsof --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1817b865..84784f01 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ clean: @mvn clean check-epmd: - @if ! lsof -i TCP:4369 | grep -q epmd ; then echo "Error: Please start 'epmd' first"; exit 1; fi + @if ! pgrep epmd >>/dev/null 2>&1 ; then echo "Error: Please start 'epmd' first"; exit 1; fi # ========================== # Setting up the environment From 42827b4ee35ae4747a991264a25d5fc17b19236d Mon Sep 17 00:00:00 2001 From: ILYA Khlopotov Date: Tue, 21 Nov 2023 12:30:39 -0800 Subject: [PATCH 13/13] Fix typo in documentation --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 84784f01..e32013ec 100644 --- a/Makefile +++ b/Makefile @@ -280,7 +280,7 @@ export ZSH_DARWIN_HELP define CONTRIBUTE_SHELL_SETUP - We detected $(CURRENT_SHELL) running on $(CURRENT_OS). Unfortunatelly + We detected $(CURRENT_SHELL) running on $(CURRENT_OS). Unfortunately documentation for this combination is not available. Contributions are welcome. endef export CONTRIBUTE_SHELL_SETUP