From 07761e1e7c690e495661db4842c285815a9e99c3 Mon Sep 17 00:00:00 2001 From: Thiago Esteves Date: Fri, 24 May 2024 09:21:18 -0300 Subject: [PATCH] Adding possibility of passing the RELEASE_COOKIE via ENV VAR to allow /bin/calori remote connections --- README.md | 16 +++++++++------- rel/env.sh.eex | 4 +++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 70b2baa..11129a2 100644 --- a/README.md +++ b/README.md @@ -202,10 +202,11 @@ Avoid the execute a hotupgrade in the following situations: #### 1. IEX shell Access to Deployex App -Connecting the iex shell: +To connect to the iex shell, you may need to export the cookie if AWS is configured with a value different from the default 'cookie', which is highly recommended to change. ```bash ubuntu@ip-10-0-1-56:~$ sudo su +root@ip-10-0-1-56:/home/ubuntu$ export RELEASE_COOKIE=COOKIE12345678912345789 root@ip-10-0-1-56:/home/ubuntu$ /opt/deployex/bin/deployex remote Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [jit:ns] @@ -215,15 +216,16 @@ iex(deployex@ip-10-0-1-56)1> ##### 2. IEX shell Access to Calori App -Connecting the iex shell: +To connect to the iex shell, you may need to export the cookie if AWS is configured with a value different from the default 'cookie', which is highly recommended to change. ```bash -root@ip-10-0-1-56:/home/ubuntu$ sudo -su deployex -deployex@ip-10-0-1-56:$ /var/lib/deployex/service/calori/current/bin/calori remote -Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [jit:ns] +ubuntu@ip-10-0-1-56:~$ sudo su +root@ip-10-0-1-56:/home/ubuntu$ export RELEASE_COOKIE=COOKIE12345678912345789 +root@ip-10-0-1-56:/home/ubuntu$ /var/lib/deployex/service/calori/current/bin/calori remote +Erlang/OTP 26 [erts-14.1.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [jit:ns] Interactive Elixir (1.16.0) - press Ctrl+C to exit (type h() ENTER for help) -iex(calori@ip-10-0-1-56)1> +iex(calori@ip-10-0-1-174)1> ``` ##### 3. Logs @@ -262,7 +264,7 @@ root@ip-10-0-1-56:/home/ubuntu$ tail -f /var/log/calori-stdout.log ##### 4. Updating CALORI_PHX_HOST -In case you need to update the *__CALORI_PHX_HOST__*, there are 2 files that need to be updated: `/etc/systemd/system/deployex.service` and `/etc/nginx/sites-available/default` (you need to be `root`` user to update them). +In case you need to update the *__CALORI_PHX_HOST__*, there are 2 files that need to be updated: `/etc/systemd/system/deployex.service` and `/etc/nginx/sites-available/default` (you need to be `root` user to update them). ```bash ubuntu@ip-10-0-1-56:~$ sudo su diff --git a/rel/env.sh.eex b/rel/env.sh.eex index 4462732..ba5d119 100644 --- a/rel/env.sh.eex +++ b/rel/env.sh.eex @@ -44,6 +44,8 @@ export ELIXIR_ERL_OPTIONS="-proto_dist inet_tls -ssl_dist_optfile /tmp/inet_tls. # export RELEASE_DISTRIBUTION=name # export RELEASE_NODE=<%= @release.name %> -export RELEASE_COOKIE="cookie" +# The Erlang cookie value is expected to be sourced by AWS and the next line +# defines it if not passed to allow ./bin/app remote to use RELEASE_COOKIE +[ -z ${RELEASE_COOKIE} ] && export RELEASE_COOKIE="cookie" export RELEASE_DISTRIBUTION=sname export RELEASE_NODE=<%= @release.name %>