rebar3: define a release

Further with the release, rebar3 will also start the application
when calling `rebar3 shell`.

Change-Id: I76cb16e28b5bc6fb231566be1bd7905235fdf56b
diff --git a/README.md b/README.md
index 8d8dc01..76d7a95 100644
--- a/README.md
+++ b/README.md
@@ -27,20 +27,12 @@
 
 ```
 $ rebar3 shell
-1> osmo_dia2gsup:start().
 ```
 
 Passing a config file:
 
 ```
 $ rebar3 shell --config ./examples/sys.config
-1> osmo_dia2gsup:start().
-```
-
-Running it with one shell command:
-
-```
-$ rebar3 shell --config ./examples/sys.config --eval "osmo_dia2gsup:start()."
 ```
 
 Running it as an escript:
@@ -49,3 +41,8 @@
 $ rebar3 escriptize
 $ ERL_FLAGS='-config ./examples/sys.config' _build/default/bin/osmo-dia2gsup
 ```
+
+## Build a new release
+
+rebar3 release
+
diff --git a/contrib/systemd/osmo_dia2gsup.service b/contrib/systemd/osmo_dia2gsup.service
index b57247b..2ef737c 100644
--- a/contrib/systemd/osmo_dia2gsup.service
+++ b/contrib/systemd/osmo_dia2gsup.service
@@ -9,7 +9,7 @@
 Restart=always
 Environment="HOME=/var/lib/osmo_dia2gsup"
 ExecStartPre=/usr/bin/mkdir -p /var/lib/osmo_dia2gsup
-ExecStart=/usr/bin/osmo-dia2gsup
+ExecStart=/usr/bin/osmo-dia2gsup foreground
 RestartSec=2
 
 [Install]
diff --git a/rebar.config b/rebar.config
index 69013aa..3bda3e5 100644
--- a/rebar.config
+++ b/rebar.config
@@ -33,3 +33,12 @@
 {escript_incl_apps, [osmo_dia2gsup]}.
 {escript_main_app, osmo_dia2gsup}.
 {escript_name, "osmo-dia2gsup"}.
+
+{relx,
+        [{release, {'osmo-dia2gsup', {git, long}},
+                [osmo_dia2gsup]},
+        {sys_config, "./config/sys.config"},
+        {vm_args, "./config/vm.args"},
+        {dev_mode, false},
+        {include_erts, true},
+        {extended_start_script, true}]}.