From 8d9f6fc3d38938ff182dcc8518e45523c90afb41 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Tue, 7 Apr 2020 12:00:55 -0400 Subject: [PATCH] more deployment changes --- config/prod.secret.exs | 2 -- lib/philomena/application.ex | 2 +- post-receive | 9 ++++----- rel/vm.args | 3 +++ 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/config/prod.secret.exs b/config/prod.secret.exs index 5d95742d..038f61d4 100644 --- a/config/prod.secret.exs +++ b/config/prod.secret.exs @@ -66,8 +66,6 @@ config :philomena, PhilomenaWeb.Endpoint, secret_key_base: secret_key_base, server: true -config :mnesia, :dir, System.get_env("MNESIA_DIR") |> String.to_charlist() - # ## Using releases (Elixir v1.9+) # # If you are doing OTP releases, you need to instruct Phoenix diff --git a/lib/philomena/application.ex b/lib/philomena/application.ex index 8e288b0a..46b31e77 100644 --- a/lib/philomena/application.ex +++ b/lib/philomena/application.ex @@ -20,7 +20,7 @@ defmodule Philomena.Application do Philomena.Servers.UserFingerprintUpdater, Philomena.Servers.UserIpUpdater, Philomena.Servers.Config, - Pow.Store.Backend.MnesiaCache, + {Pow.Store.Backend.MnesiaCache, extra_db_nodes: Node.list()}, {Redix, name: :redix, host: Application.get_env(:philomena, :redis_host)}, # Start the endpoint when the application starts diff --git a/post-receive b/post-receive index dc945363..d37b5da4 100755 --- a/post-receive +++ b/post-receive @@ -50,7 +50,7 @@ lsof -i :4000 BLUE_STARTED=$? lsof -i :4001 -GREEN_STARTED=$1 +GREEN_STARTED=$? if [[ $BLUE_STARTED == 1 && $GREEN_STARTED == 1 ]]; then die "both blue and green instances are running; is another deploy in progress?" @@ -58,13 +58,13 @@ fi if [[ $BLUE_STARTED == 0 && $GREEN_STARTED == 0 ]]; then echo "app not started, starting it now" - NODENAME=philomena_0 PORT=4000 _build/prod/rel/philomena/bin/philomena start + NODENAME=philomena_0 PORT=4000 MNESIA_DIR=/home/derpibooru/philomena/_build/prod/rel/philomena/Mnesia.philomena_0@127.0.0.1 _build/prod/rel/philomena/bin/philomena start fi if [[ $BLUE_STARTED == 1 && $GREEN_STARTED == 0 ]]; then echo "rolling blue (4000) over to green (4001)" BLUE_PID=$(lsof -Fp -i :4000 | head -n1 | sed 's/^p//') - NODENAME=philomena_1 PORT=4001 _build/prod/rel/philomena/bin/philomena start + NODENAME=philomena_1 PORT=4001 MNESIA_DIR=/home/derpibooru/philomena/_build/prod/rel/philomena/Mnesia.philomena_1@127.0.0.1 _build/prod/rel/philomena/bin/philomena start sleep 20 kill -TERM $BLUE_PID fi @@ -72,8 +72,7 @@ fi if [[ $BLUE_STARTED == 0 && $GREEN_STARTED == 1 ]]; then echo "rolling green (4001) over to blue (4000)" GREEN_PID=$(lsof -Fp -i :4001 | head -n1 | sed 's/^p//') - NODENAME=philomena_0 PORT=4000 _build/prod/rel/philomena/bin/philomena start + NODENAME=philomena_0 PORT=4000 MNESIA_DIR=/home/derpibooru/philomena/_build/prod/rel/philomena/Mnesia.philomena_0@127.0.0.1 _build/prod/rel/philomena/bin/philomena start sleep 20 kill -TERM $GREEN_PID fi - diff --git a/rel/vm.args b/rel/vm.args index e91821ec..d5e3a134 100644 --- a/rel/vm.args +++ b/rel/vm.args @@ -8,6 +8,9 @@ ## Cookie for distributed erlang -setcookie <%= release.profile.cookie %> +## Path for Mnesia +-mnesia dir ${MNESIA_DIR} + ## Heartbeat management; auto-restarts VM if it dies or becomes unresponsive ## (Disabled by default..use with caution!) ##-heart