Browse Source

add deploy scripts

main
Inhji Y. 8 months ago
parent
commit
17dda15135
  1. 25
      build.sh
  2. 14
      deploy.sh
  3. 17
      mirage.service

25
build.sh

@ -0,0 +1,25 @@
#!/usr/bin/env bash
echo ""
echo "Installing Hex/Rebar"
echo "--------------------------"
MIX_ENV=prod mix local.hex --if-missing --force
MIX_ENV=prod mix local.rebar --if-missing --force
echo ""
echo "Getting/compiling Hex dependencies"
echo "--------------------------"
MIX_ENV=prod mix deps.get --only prod
MIX_ENV=prod mix deps.compile
echo ""
echo "Getting/compiling NPM dependencies"
echo "--------------------------"
npm install --prefix ./assets
NODE_ENV=production npm run deploy --prefix ./assets
MIX_ENV=prod mix phx.digest
echo ""
echo "Generating release"
echo "--------------------------"
MIX_ENV=prod mix release --overwrite

14
deploy.sh

@ -0,0 +1,14 @@
#!/usr/bin/env bash
echo ""
echo "Build starting!"
echo "--------------------------"
ssh -T mirage@inhji.de << EOSSH
cd /opt/mirage
git pull
./build.sh
EOSSH
echo ""
echo "Build complete, restarting..."
echo "--------------------------"
ssh -T mirage@inhji.de sudo systemctl restart mirage

17
mirage.service

@ -0,0 +1,17 @@
[Unit]
Description=Mirage
[Service]
Type=forking
User=mirage
Group=mirage
Restart=on-failure
EnvironmentFile=/opt/mirage/.env
WorkingDirectory=/opt/mirage/_build/prod/rel/mirage/bin
ExecStartPre=/opt/mirage/_build/prod/rel/mirage/bin/mirage eval "Akedia.Release.migrate"
ExecStart=/opt/mirage/_build/prod/rel/mirage/bin/mirage daemon
ExecStop=/opt/mirage/_build/prod/rel/mirage/bin/mirage stop
[Install]
WantedBy=multi-user.target
Loading…
Cancel
Save