more deployment changes

This commit is contained in:
byte[] 2020-04-07 12:00:55 -04:00
parent 00a5cd13a6
commit 8d9f6fc3d3
4 changed files with 8 additions and 8 deletions

View file

@ -66,8 +66,6 @@ config :philomena, PhilomenaWeb.Endpoint,
secret_key_base: secret_key_base, secret_key_base: secret_key_base,
server: true server: true
config :mnesia, :dir, System.get_env("MNESIA_DIR") |> String.to_charlist()
# ## Using releases (Elixir v1.9+) # ## Using releases (Elixir v1.9+)
# #
# If you are doing OTP releases, you need to instruct Phoenix # If you are doing OTP releases, you need to instruct Phoenix

View file

@ -20,7 +20,7 @@ defmodule Philomena.Application do
Philomena.Servers.UserFingerprintUpdater, Philomena.Servers.UserFingerprintUpdater,
Philomena.Servers.UserIpUpdater, Philomena.Servers.UserIpUpdater,
Philomena.Servers.Config, 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)}, {Redix, name: :redix, host: Application.get_env(:philomena, :redis_host)},
# Start the endpoint when the application starts # Start the endpoint when the application starts

View file

@ -50,7 +50,7 @@ lsof -i :4000
BLUE_STARTED=$? BLUE_STARTED=$?
lsof -i :4001 lsof -i :4001
GREEN_STARTED=$1 GREEN_STARTED=$?
if [[ $BLUE_STARTED == 1 && $GREEN_STARTED == 1 ]]; then if [[ $BLUE_STARTED == 1 && $GREEN_STARTED == 1 ]]; then
die "both blue and green instances are running; is another deploy in progress?" 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 if [[ $BLUE_STARTED == 0 && $GREEN_STARTED == 0 ]]; then
echo "app not started, starting it now" 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 fi
if [[ $BLUE_STARTED == 1 && $GREEN_STARTED == 0 ]]; then if [[ $BLUE_STARTED == 1 && $GREEN_STARTED == 0 ]]; then
echo "rolling blue (4000) over to green (4001)" echo "rolling blue (4000) over to green (4001)"
BLUE_PID=$(lsof -Fp -i :4000 | head -n1 | sed 's/^p//') 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 sleep 20
kill -TERM $BLUE_PID kill -TERM $BLUE_PID
fi fi
@ -72,8 +72,7 @@ fi
if [[ $BLUE_STARTED == 0 && $GREEN_STARTED == 1 ]]; then if [[ $BLUE_STARTED == 0 && $GREEN_STARTED == 1 ]]; then
echo "rolling green (4001) over to blue (4000)" echo "rolling green (4001) over to blue (4000)"
GREEN_PID=$(lsof -Fp -i :4001 | head -n1 | sed 's/^p//') 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 sleep 20
kill -TERM $GREEN_PID kill -TERM $GREEN_PID
fi fi

View file

@ -8,6 +8,9 @@
## Cookie for distributed erlang ## Cookie for distributed erlang
-setcookie <%= release.profile.cookie %> -setcookie <%= release.profile.cookie %>
## Path for Mnesia
-mnesia dir ${MNESIA_DIR}
## Heartbeat management; auto-restarts VM if it dies or becomes unresponsive ## Heartbeat management; auto-restarts VM if it dies or becomes unresponsive
## (Disabled by default..use with caution!) ## (Disabled by default..use with caution!)
##-heart ##-heart