From 09a47e0beb2cebe6359ac3e98607b669226d6afa Mon Sep 17 00:00:00 2001 From: Lucas Date: Wed, 26 Jul 2023 14:06:57 +0800 Subject: [PATCH] Add basic support for systemd (#761) --- debian/config.yaml | 31 +++++++++++++++++++++++++++++++ debian/martin.service | 8 ++++++++ martin/Cargo.toml | 15 +++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 debian/config.yaml create mode 100644 debian/martin.service diff --git a/debian/config.yaml b/debian/config.yaml new file mode 100644 index 00000000..93f7c464 --- /dev/null +++ b/debian/config.yaml @@ -0,0 +1,31 @@ +# Connection keep alive timeout [default: 75] +keep_alive: 75 + +# The socket address to bind [default: 0.0.0.0:3000] +listen_addresses: '0.0.0.0:3000' + +# Number of web server workers +worker_processes: 8 + +# see https://maplibre.org/martin/config-file.html + +# postgres: +# connection_string: 'postgresql://postgres@localhost:5432/db' +# default_srid: 4326 +# pool_size: 20 +# max_feature_count: 1000 +# disable_bounds: false + +# pmtiles: +# paths: +# - /dir-path +# - /path/to/pmtiles.pmtiles +# sources: +# pm-src1: /path/to/pmtiles1.pmtiles + +# mbtiles: +# paths: +# - /dir-path +# - /path/to/mbtiles.mbtiles +# sources: +# mb-src1: /path/to/mbtiles1.mbtiles diff --git a/debian/martin.service b/debian/martin.service new file mode 100644 index 00000000..46f34907 --- /dev/null +++ b/debian/martin.service @@ -0,0 +1,8 @@ +[Unit] +Description = A blazing fast map tile server which can generate and serve vector tiles on the fly from large PostGIS databases, PMTile, and MBTile files + +[Service] +ExecStart = /usr/bin/martin --config /usr/local/etc/martin/config.yaml + +[Install] +WantedBy = multi-user.target diff --git a/martin/Cargo.toml b/martin/Cargo.toml index a11c2a93..21cf3fd8 100644 --- a/martin/Cargo.toml +++ b/martin/Cargo.toml @@ -20,6 +20,21 @@ homepage.workspace = true name = "martin" maintainer = "Stepan Kuzmin , Yuri Astrakhan , MapLibre contributors" depends = "$auto" +maintainer-scripts = "../debian" +assets = [ + ["target/release/martin", "/usr/bin/martin", "755"], + ["../README.md","/usr/share/doc/martin/README.md","644"], + ["../debian/config.yaml", "/usr/share/doc/martin/config.yaml", "644"], + ["../debian/config.yaml", "/usr/local/etc/martin/config.yaml", "644"], +] + +# see https://github.com/kornelski/cargo-deb/blob/main/systemd.md#packagemetadatadebsystemd-units-options +[package.metadata.deb.systemd-units] +unit-scripts = "../debian/" +enable = false +start = false +restart-after-upgrade = false +stop-on-upgrade = true [lib] path = "src/lib.rs"