altos-mapd: Install systemd service file and defaults file
authorKeith Packard <keithp@keithp.com>
Sun, 7 Oct 2018 05:22:26 +0000 (23:22 -0600)
committerKeith Packard <keithp@keithp.com>
Sun, 7 Oct 2018 05:22:26 +0000 (23:22 -0600)
This lets the map service 'just work' if enabled.

Signed-off-by: Keith Packard <keithp@keithp.com>
map-server/altos-mapd/Makefile.am
map-server/altos-mapd/altos-mapd-default [new file with mode: 0644]
map-server/altos-mapd/altos-mapd.service [new file with mode: 0644]

index a3fd196..39f6753 100644 (file)
@@ -22,6 +22,14 @@ FATJAR=altosmapd-fat.jar
 
 all-local: classes/altosmapd $(JAR) altos-mapd altos-mapd-test altos-mapd-jdb
 
+defaultsdir=$(sysconfdir)/default
+
+defaults_DATA=altos-mapd-default
+
+systemddir=$(libdir)/systemd/system
+
+systemd_DATA=altos-mapd.service
+
 install-altosmapdJAVA: altosmapd.jar
        @$(NORMAL_INSTALL)
        test -z "$(altosmapddir)" || $(MKDIR_P) "$(DESTDIR)$(altosmapddir)"
diff --git a/map-server/altos-mapd/altos-mapd-default b/map-server/altos-mapd/altos-mapd-default
new file mode 100644 (file)
index 0000000..40d283a
--- /dev/null
@@ -0,0 +1,3 @@
+MAPKEY=/home/altos-mapd/google-maps-api-key
+MAPDIR=/home/altos-mapd/maps
+LAUNCHSITES=/var/www/html/launch-sites.txt
diff --git a/map-server/altos-mapd/altos-mapd.service b/map-server/altos-mapd/altos-mapd.service
new file mode 100644 (file)
index 0000000..d6f01da
--- /dev/null
@@ -0,0 +1,14 @@
+[Unit]
+Description=AltOS Map Cache
+Requires=network-online.target
+After=network-online.target
+
+[Service]
+Type=simple
+User=altos-mapd
+Restart=always
+EnvironmentFile=/etc/default/altos-mapd-default
+ExecStart=/usr/bin/altos-mapd --key $MAPKEY --mapdir $MAPDIR --launch-sites $LAUNCHSITES
+
+[Install]
+WantedBy=multi-user.target