diff --git a/motech/lib/systemd/system/motech.service b/motech/lib/systemd/system/motech.service index d5bf666..f62de67 100644 --- a/motech/lib/systemd/system/motech.service +++ b/motech/lib/systemd/system/motech.service @@ -4,9 +4,11 @@ After=network.target [Service] Type=forking +User=motech +WorkingDirectory=/srv/motech +ExecStartPre=/srv/motech/update-ip.sh ExecStart=/srv/motech/bin/startup.sh ExecStop=/srv/motech/bin/shutdown.sh -User=motech [Install] WantedBy=multi-user.target diff --git a/motech/srv/motech/.motech/config/motech-settings.properties b/motech/srv/motech/.motech/config/motech-settings.properties index 61167ad..838d8dd 100644 --- a/motech/srv/motech/.motech/config/motech-settings.properties +++ b/motech/srv/motech/.motech/config/motech-settings.properties @@ -1,2 +1,3 @@ system.language=en login.mode=repository +server.url=http://127.0.0.1 diff --git a/motech/srv/motech/update-ip.sh b/motech/srv/motech/update-ip.sh new file mode 100755 index 0000000..c0a2399 --- /dev/null +++ b/motech/srv/motech/update-ip.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +URL=$(ip route get 1 | awk '{print $NF;exit}') +sed -i "s|^server\.url.*|server.url=https://${URL}/motech|" /srv/motech/.motech/config/motech-settings.properties