Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust readme and martin book #1253

Merged
merged 27 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4a9c4e8
Update installation.md
sharkAndshark Mar 14, 2024
00c6a20
Remove API
sharkAndshark Mar 15, 2024
358f044
Remove Running Martin Service
sharkAndshark Mar 15, 2024
c07b924
Remove installation from readme
sharkAndshark Mar 15, 2024
257ff15
Remove Re-use Martin as a library
sharkAndshark Mar 15, 2024
7450a26
Add Martin as a library to book
sharkAndshark Mar 15, 2024
935b81d
Use x64 instead of amd-64
sharkAndshark Mar 18, 2024
6d3ac61
Add helpful doc links to readme
sharkAndshark Mar 18, 2024
5253789
Add Re-use-Martin-as-a-library.md to SUMMARY.md
sharkAndshark Mar 18, 2024
2bcc365
wip
sharkAndshark Mar 18, 2024
1f345ee
wip
sharkAndshark Mar 18, 2024
efbd7ba
wip
sharkAndshark Mar 19, 2024
75eb52c
wip
sharkAndshark Apr 1, 2024
05fc15e
Update quick start with windows
sharkAndshark Apr 1, 2024
85f904c
just fmt-md
sharkAndshark Apr 1, 2024
4987ddb
wip
sharkAndshark Apr 12, 2024
9c11229
add quick-start with linux and cleanup
sharkAndshark May 6, 2024
179525f
temporally remove the quick start link to pass link check
sharkAndshark May 11, 2024
40a8524
adjust images
sharkAndshark May 11, 2024
c7efd5b
adjust case
sharkAndshark May 11, 2024
ea63a34
adjust images
sharkAndshark May 11, 2024
04bd462
update doc about martin as a library
sharkAndshark May 11, 2024
eb4c6ee
fix links
sharkAndshark May 11, 2024
e12aa97
Replace image
sharkAndshark May 13, 2024
f64097b
Merge branch 'main' into readme
nyurik May 25, 2024
adbe489
Merge branch 'main' into readme
nyurik May 26, 2024
6d9f0f9
reworked documentation
nyurik May 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 0 additions & 101 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,107 +14,6 @@ Additionally, there are [several tools](https://maplibre.org/martin/tools.html)

See [Martin book](https://maplibre.org/martin/) for complete documentation.

## Installation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should create some something like a list of important information, and point it to the book - e.g. installation should point directly to the installation section, etc. Just the most important topics, not everything?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this?

Helpful Martin docs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but without the header - just a few links. We may also want to add a "quick start" - makes novice users go there first


_See [installation instructions](https://maplibre.org/martin/installation.html) in the Martin book._

**Prerequisites:** If using Martin with PostgreSQL database, you must install PostGIS with at least v3.0+, v3.1+ recommended.

You can download martin from [GitHub releases page](https://github.com/maplibre/martin/releases).

| Platform | AMD-64 | ARM-64 |
|----------|--------------------------------------------------------------------------------------------------|-------------------------------------|
| Linux | [.tar.gz][rl-linux-x64] (gnu)<br>[.tar.gz][rl-linux-x64-musl] (musl)<br>[.deb][rl-linux-x64-deb] | [.tar.gz][rl-linux-a64-musl] (musl) |
| macOS | [.tar.gz][rl-macos-x64] | [.tar.gz][rl-macos-a64] |
| Windows | [.zip][rl-win64-zip] | |

[rl-linux-x64]: https://github.com/maplibre/martin/releases/latest/download/martin-x86_64-unknown-linux-gnu.tar.gz
[rl-linux-x64-musl]: https://github.com/maplibre/martin/releases/latest/download/martin-x86_64-unknown-linux-musl.tar.gz
[rl-linux-x64-deb]: https://github.com/maplibre/martin/releases/latest/download/martin-Debian-x86_64.deb
[rl-linux-a64-musl]: https://github.com/maplibre/martin/releases/latest/download/martin-aarch64-unknown-linux-musl.tar.gz
[rl-macos-x64]: https://github.com/maplibre/martin/releases/latest/download/martin-x86_64-apple-darwin.tar.gz
[rl-macos-a64]: https://github.com/maplibre/martin/releases/latest/download/martin-aarch64-apple-darwin.tar.gz
[rl-win64-zip]: https://github.com/maplibre/martin/releases/latest/download/martin-x86_64-pc-windows-msvc.zip

If you are using macOS and [Homebrew](https://brew.sh/) you can install `martin` and `mbtiles` using Homebrew tap.

```shell
brew tap maplibre/martin
brew install martin
```

## Running Martin Service

_See [running instructions](https://maplibre.org/martin/run.html) in the Martin book._

Martin supports any number of PostgreSQL/PostGIS database connections with [geospatial-enabled](https://postgis.net/docs/using_postgis_dbmanagement.html#geometry_columns) tables and tile-producing SQL functions, as well as [PMTile](https://protomaps.com/blog/pmtiles-v3-whats-new) and [MBTile](https://github.com/mapbox/mbtiles-spec) files as tile sources.

Martin can auto-discover tables and functions using a [connection string](https://maplibre.org/martin/pg-connections.html). A PG connection string can also be passed via the `DATABASE_URL` environment variable.

Each tile source will have a [TileJSON](https://github.com/mapbox/tilejson-spec) endpoint.

#### Examples

```shell
# publish all tables and functions from a single database
export DATABASE_URL="postgresql://user:password@host:port/database"
martin

# same as above, but passing connection string via CLI, together with a directory of .mbtiles/.pmtiles files
martin postgresql://user:password@host:port/database path/to/dir

# publish all discovered tables/funcs from two DBs
# and generate config file with all detected sources
martin postgres://... postgres://... --save-config config.yaml

# use configuration file instead of auto-discovery
martin --config config.yaml
```

#### Docker Example

_See [Docker instructions](https://maplibre.org/martin/run-with-docker.html) in the Martin book._

Martin is also available as a [Docker image](https://ghcr.io/maplibre/martin). You could either share a configuration file from the host with the container via the `-v` param, or you can let Martin auto-discover all sources e.g. by passing `DATABASE_URL` or specifying the .mbtiles/.pmtiles files.

```shell
export PGPASSWORD=postgres # secret!
docker run -p 3000:3000 \
-e PGPASSWORD \
-e DATABASE_URL=postgresql://user@host:port/db \
-v /path/to/config/dir:/config \
ghcr.io/maplibre/martin --config /config/config.yaml
```

## API

_See [API documentation](https://maplibre.org/martin/using.html) in the Martin book._

Martin data is available via the HTTP `GET` endpoints:

| URL | Description |
|-----------------------------------------|-----------------------------------------------|
| `/` | Status text, that will eventually show web UI |
| `/catalog` | List of all sources |
| `/{sourceID}` | Source TileJSON |
| `/{sourceID}/{z}/{x}/{y}` | Map Tiles |
| `/{source1},…,{sourceN}` | Composite Source TileJSON |
| `/{source1},…,{sourceN}/{z}/{x}/{y}` | Composite Source Tiles |
| `/sprite/{spriteID}[@2x].{json,png}` | Sprites (low and high DPI, index/png) |
| `/font/{font}/{start}-{end}` | Font source |
| `/font/{font1},…,{fontN}/{start}-{end}` | Composite Font source |
| `/health` | Martin server health check: returns 200 `OK` |

## Re-use Martin as a library

Martin can be used as a standalone server, or as a library in your own Rust application. When used as a library, you can use the following features:

* **postgres** - enable PostgreSQL/PostGIS tile sources
* **pmtiles** - enable PMTile tile sources
* **mbtiles** - enable MBTile tile sources
* **fonts** - enable font sources
* **sprites** - enable sprite sources

## Documentation

See [Martin book](https://maplibre.org/martin/) for complete documentation.
Expand Down
9 changes: 9 additions & 0 deletions docs/src/Re-use-Martin-as-a-library.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Re-use Martin as a library
sharkAndshark marked this conversation as resolved.
Show resolved Hide resolved

Martin can be used as a standalone server, or as a library in your own Rust application. When used as a library, you can use the following features:

* **postgres** - enable PostgreSQL/PostGIS tile sources
* **pmtiles** - enable PMTile tile sources
* **mbtiles** - enable MBTile tile sources
* **fonts** - enable font sources
* **sprites** - enable sprite sources
68 changes: 47 additions & 21 deletions docs/src/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,73 @@

If using Martin with PostgreSQL database, you must install PostGIS with at least v3.0+, v3.1+ recommended.

### Binary Distributions
### Docker

Martin is also available as a [Docker image](https://ghcr.io/maplibre/martin). You could either share a configuration file from the host with the container via the `-v` param, or you can let Martin auto-discover all sources e.g. by passing `DATABASE_URL` or specifying the .mbtiles/.pmtiles files or URLs to .pmtiles.

```shell
export PGPASSWORD=postgres # secret!
docker run -p 3000:3000 \
-e PGPASSWORD \
-e DATABASE_URL=postgresql://user@host:port/db \
-v /path/to/config/dir:/config \
ghcr.io/maplibre/martin --config /config/config.yaml
```

### From Binary Distributions Manually

You can download martin from [GitHub releases page](https://github.com/maplibre/martin/releases).

| Platform | Downloads (latest) |
|----------|------------------------|
| Linux | [64-bit][rl-linux-tar] |
| macOS | [64-bit][rl-macos-tar] |
| Windows | [64-bit][rl-win64-zip] |
| Platform | AMD-64 | ARM-64 |
sharkAndshark marked this conversation as resolved.
Show resolved Hide resolved
|----------|--------------------------------------------------------------------------------------------------|-------------------------------------|
| Linux | [.tar.gz][rl-linux-x64] (gnu)<br>[.tar.gz][rl-linux-x64-musl] (musl)<br>[.deb][rl-linux-x64-deb] | [.tar.gz][rl-linux-a64-musl] (musl) |
| macOS | [.tar.gz][rl-macos-x64] | [.tar.gz][rl-macos-a64] |
| Windows | [.zip][rl-win64-zip] | |

[rl-linux-tar]: https://github.com/maplibre/martin/releases/latest/download/martin-x86_64-unknown-linux-gnu.tar.gz
[rl-macos-tar]: https://github.com/maplibre/martin/releases/latest/download/martin-x86_64-apple-darwin.tar.gz
[rl-linux-x64]: https://github.com/maplibre/martin/releases/latest/download/martin-x86_64-unknown-linux-gnu.tar.gz
[rl-linux-x64-musl]: https://github.com/maplibre/martin/releases/latest/download/martin-x86_64-unknown-linux-musl.tar.gz
[rl-linux-x64-deb]: https://github.com/maplibre/martin/releases/latest/download/martin-Debian-x86_64.deb
[rl-linux-a64-musl]: https://github.com/maplibre/martin/releases/latest/download/martin-aarch64-unknown-linux-musl.tar.gz
[rl-macos-x64]: https://github.com/maplibre/martin/releases/latest/download/martin-x86_64-apple-darwin.tar.gz
[rl-macos-a64]: https://github.com/maplibre/martin/releases/latest/download/martin-aarch64-apple-darwin.tar.gz
[rl-win64-zip]: https://github.com/maplibre/martin/releases/latest/download/martin-x86_64-pc-windows-msvc.zip

### Building with Cargo

If you [install Rust](https://www.rust-lang.org/tools/install), you can build martin from source with Cargo:
For rust user, You could install pre-built martin binary via [cargo-binstall](https://github.com/cargo-bins/cargo-binstall) and `cargo`.

```shell
cargo install martin --locked
cargo install cargo-binstall
cargo binstall martin
martin --help
```

### Homebrew
### From package

To install with apt source and others, We need your help to [improve packaging for various platforms](https://github.com/maplibre/martin/issues/578).

#### Homebrew

If you are using macOS and [Homebrew](https://brew.sh/) you can install martin using Homebrew tap.

```shell
brew tap maplibre/martin
brew install martin
martin --help
```

### Docker
#### Debian Packages(x86_64) manually

Martin is also available as a [Docker image](https://ghcr.io/maplibre/martin). You could either share a configuration file from the host with the container via the `-v` param, or you can let Martin auto-discover all sources e.g. by passing `DATABASE_URL` or specifying the .mbtiles/.pmtiles files or URLs to .pmtiles.
```shell
curl -O https://github.com/maplibre/martin/releases/download/v0.13.0/martin-Debian-x86_64.deb
sudo dpkg -i ./martin-Debian-x86_64.deb
martin --help
rm ./martin-Debian-x86_64.deb
```

### Building From source

If you [install Rust](https://www.rust-lang.org/tools/install), you can build martin from source with Cargo:

```shell
export PGPASSWORD=postgres # secret!
docker run -p 3000:3000 \
-e PGPASSWORD \
-e DATABASE_URL=postgresql://user@host:port/db \
-v /path/to/config/dir:/config \
ghcr.io/maplibre/martin --config /config/config.yaml
cargo install martin --locked
martin --help
```