From eaa10c0ea210dc3fc18a65667d7b5abd17306293 Mon Sep 17 00:00:00 2001 From: Alisson Machado Date: Sat, 30 Nov 2024 01:32:58 -0300 Subject: [PATCH] fix: change start service and add dependency --- mix.exs | 3 ++- scripts/start_application.sh | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/mix.exs b/mix.exs index 7e47057..f7e68ec 100644 --- a/mix.exs +++ b/mix.exs @@ -60,7 +60,8 @@ defmodule DigistabStore.MixProject do {:dns_cluster, "~> 0.1.1"}, {:bandit, "~> 1.5"}, {:phoenix_html_helpers, "~> 1.0"}, - {:money, "~> 1.12"} + {:money, "~> 1.12"}, + {:hackney, "~> 1.9"} ] end diff --git a/scripts/start_application.sh b/scripts/start_application.sh index 18661d6..74c0099 100755 --- a/scripts/start_application.sh +++ b/scripts/start_application.sh @@ -8,9 +8,9 @@ KEY_BASE=$(aws ssm get-parameter --name "/digistab_store/prod/secret_key_base" - echo "Setting up directory permissions..." -mkdir -p /opt/digistab_store/_build/prod/rel/digistab_store/tmp -chown -R ubuntu:ubuntu /opt/digistab_store/_build/prod/rel/digistab_store/tmp -chmod -R 755 /opt/digistab_store/_build/prod/rel/digistab_store/tmp +sudo mkdir -p /opt/digistab_store/_build/prod/rel/digistab_store/tmp +sudo chown -R ubuntu:ubuntu /opt/digistab_store/_build/prod/rel/digistab_store/tmp +sudo chmod -R 755 /opt/digistab_store/_build/prod/rel/digistab_store/tmp echo "Creating systemd service file..." sudo tee /etc/systemd/system/digistab_store.service > /dev/null << EOL @@ -19,7 +19,7 @@ Description=Digistab Store Phoenix Application After=network.target postgresql.service [Service] -Type=forking +Type=simple User=ubuntu Group=ubuntu WorkingDirectory=/opt/digistab_store @@ -34,7 +34,7 @@ Environment=RELEASE_NAME=digistab_store Environment=DATABASE_URL=${DB_URL} Environment=SECRET_KEY_BASE=${KEY_BASE} -ExecStart=/opt/digistab_store/_build/prod/rel/digistab_store/bin/digistab_store daemon +ExecStart=/opt/digistab_store/_build/prod/rel/digistab_store/bin/digistab_store start ExecStop=/opt/digistab_store/_build/prod/rel/digistab_store/bin/digistab_store stop Restart=always RestartSec=5 @@ -43,7 +43,7 @@ RestartSec=5 WantedBy=multi-user.target EOL -echo "Setting proper permissions for service file..." +echo "Setting proper permissions..." sudo chmod 644 /etc/systemd/system/digistab_store.service echo "Downloading RDS certificate if needed..."