From 166d454677affc9e4983882c03490c50266d66f7 Mon Sep 17 00:00:00 2001 From: sharkAndshark Date: Sun, 16 Jul 2023 13:01:19 +0800 Subject: [PATCH 1/3] add basic support for systemd --- 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 000000000..bc4490f21 --- /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 \ No newline at end of file diff --git a/debian/martin.service b/debian/martin.service new file mode 100644 index 000000000..65a6a8a0a --- /dev/null +++ b/debian/martin.service @@ -0,0 +1,8 @@ +[Unit] +Description = A blazing fast tile server which can generate and serve vector tiles on the fly from large PostGIS databases, PMTile, and MBTile files Rust + +[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 a11c2a932..21cf3fd86 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" From f73e69b02c642be5d578a4cc52df218151390ee9 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Tue, 25 Jul 2023 14:25:59 -0400 Subject: [PATCH 2/3] Update config.yaml --- debian/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/config.yaml b/debian/config.yaml index bc4490f21..93f7c4642 100644 --- a/debian/config.yaml +++ b/debian/config.yaml @@ -28,4 +28,4 @@ worker_processes: 8 # - /dir-path # - /path/to/mbtiles.mbtiles # sources: -# mb-src1: /path/to/mbtiles1.mbtiles \ No newline at end of file +# mb-src1: /path/to/mbtiles1.mbtiles From 33ed60266a050a18b156da2283a20cdfa421d255 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Tue, 25 Jul 2023 14:27:40 -0400 Subject: [PATCH 3/3] Update martin.service --- debian/martin.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/martin.service b/debian/martin.service index 65a6a8a0a..46f349072 100644 --- a/debian/martin.service +++ b/debian/martin.service @@ -1,5 +1,5 @@ [Unit] -Description = A blazing fast tile server which can generate and serve vector tiles on the fly from large PostGIS databases, PMTile, and MBTile files Rust +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