Commit Graph

79 Commits

Author SHA1 Message Date
Yuri Astrakhan
81153f38af
Update dependencies, tests, connection limit (#1530) 2024-10-01 00:10:06 -04:00
Yuri Astrakhan
2aa4627cf3 Fix Demo CI, update just files 2024-09-11 19:37:54 -04:00
Yuri Astrakhan
9f06f552bc
Bump a few more dependencies (#1510) 2024-09-11 18:46:48 -04:00
paigewilliams
7f18b6bbf2
add web UI placeholder (#1395)
Add an optional web UI interface for Martin, including docker-based cross-compilation support.  The UI itself is a placeholder with a logo, but will grow in subsequent PRs.

This was branched off of https://github.com/maplibre/martin/pull/1142 to
address the PR feedback from @nyurik .

---------

Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
Co-authored-by: Tomer Ronen <tomer207@gmail.com>
Co-authored-by: tomeronen <45331634+tomeronen@users.noreply.github.com>
2024-07-14 13:39:29 -04:00
Yuri Astrakhan
ccd550a2cf
Add binary diff for mbtiles (#1358)
* `mbtiles diff` now has an additional `--patch-type` param with
`whole`, `bin-diff-raw` and `bin-diff-gz` values:
* `whole` stores different tiles as before - as whole tiles in the
`tiles` table
* `bin-diff-raw` computes binary difference between tiles, and stores
them as brotli-encoded value in a `bsdiffraw` table, together with a
`xxh3_64` hash of the tile as it will be stored after patching
* `bin-diff-gz` same as `bin-diff-raw`, but assumes the tiles are
gzip-compressed, so it uncompresses them before comparing. The `xxh3_64`
stores the hash of the uncompressed tile. The data will be stored in the
`bsdiffrawgz` table (identical structure with above)

* `mbtiles copy --apply-patch` will automatically detect if
`bsdiffrawgz` or `bsdiffraw` tables exist, and will use binary patching.
* `mbtiles apply-patch` does not support binary patching yet
* `mbtiles copy --diff-with-file ... --patch-type ...` is an alias to
`mbtiles diff --patch-type ...`
2024-06-25 19:34:14 +00:00
Yuri Astrakhan
16a54e1c33
Use --locked with cargo install (#1216)
This will prevent installation issues in case dependencies break semver
promise

Fixes #1211
2024-02-27 15:40:20 +08:00
Yuri Astrakhan
fba9af8749
Bump locks, blessed expected tests (#1212) 2024-02-25 05:46:59 -05:00
Yuri Astrakhan
a54b2d7c8c minor linting 2024-02-09 03:59:31 -05:00
Yuri Astrakhan
0f3cfaa1af fix it again 2024-02-06 01:33:35 -05:00
Yuri Astrakhan
b9917a2294 fix justfile 2024-02-05 22:07:43 -05:00
Yuri Astrakhan
b4dd29d5ba justfile improvement and deps 2024-02-05 21:49:36 -05:00
Josh Lee
9f9f18163c
Add AWS Lambda support (#1127)
This adds the lambda-web crate to adapt the actix App to speak to Lambda
by way of the lambda_runtime crate.

AWS Lambda has native support for scripting languages to
execute a function directly; compiled languages must embed a runtime to
fetch incoming events from Lambda and post the responses. This detects
the environment variables to start up in Lambda mode instead of the
normal HTTP server, and is added as an optional feature.

Lambda has five (!) distinct ways of routing HTTP requests to a
function; this supports some of them. (Specifically, the most obvious
way to do this is with a Function URL, which is newest and simplest, and
perhaps with CloudFront, which speaks to the Function URL and not Lambda
directly.)

The error handling could probably be refined, I was just trying to get
this to compile.

(Supported: API Gateway HTTP API with payload format version 2.0; API
Gateway REST API; Lambda function URLs / Not supported: API Gateway HTTP
API with payload format version 1.0; Application Load Balancer)

Necessary for #1102 to be able to run the released packages directly,
and only having to configure the appropriate environment.

---------

Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
2024-02-01 18:56:40 +00:00
Just van den Broecke
a864b9981c
Adapt justfiles for Docker Compose command (#1153)
This should solve #1149. See also [my comment there for the
approach](https://github.com/maplibre/martin/issues/11). In short
through a variable that is substituted. Note that this may not work if
an older Docker version is installed without the Python `docker-compose`
script...As both variants will not be present. Maybe add an extra
test+warning msg for that case.

```
dockercompose := `if docker-compose --version &> /dev/null; then echo "docker-compose"; else echo "docker compose"; fi`
.
.
up:
   {{ dockercompose }} up

up-build:
    {{ dockercompose }} up --build
.
.
```

---------

Co-authored-by: Lucas <zhangyijunmetro@hotmail.com>
2024-01-29 13:15:10 -05:00
Yuri Astrakhan
ec16b984d0
add PGPARAMS to just for testing connections (#1131)
A small justfile improvement
2024-01-14 20:21:30 -05:00
Yuri Astrakhan
e3821b8d78 better bench test 2023-12-27 14:53:12 -05:00
Yuri Astrakhan
61d3286815
Lots of small refactorings (#1107)
* Use `Option<&T>` instead of `&Option<T>` in function arguments.
* Cleaner var names
* Slight optimization of `get_tile` with query params
* Split up srv/server.rs into fonts, sprites, tiles, and tiles_info
files
* better error reporting in tests
2023-12-26 07:43:47 +00:00
Yuri Astrakhan
35faf420f4 benchmarking just targets 2023-12-25 23:55:20 -05:00
Yuri Astrakhan
2def6288f1
PMTiles cache, refactor file configs, modularize (#1094)
* Make it possible to have configuration specific to the file-based
config sections: pmtiles, mbtiles, and sprites.
* Implement PMTiles directory cache shared between all pmtiles (both
http and local), with configurable max cache size (in MB), or 0 to
disable. Defaults to 32MB (?)
* PMTiles now share web client instance, which optimizes connection
reuse in case multiple pmtiles reside on the same host
* Major refactoring to allow modular reuse, enabling the following build
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
* Use justfile in the CI

Fixes #1093
2023-12-25 05:52:04 +00:00
Yuri Astrakhan
c8df2799db
Move some build commands to CI (#1101) 2023-12-24 23:43:58 -05:00
Yuri Astrakhan
1a8e7c89a4
Implement http pmtiles (#991)
PMTiles is a web-optimized format, allowing the actual file to be read
with HTTP range requests. Supporting this use case instantly allows
Martin to function as a lambda executable accessing PMTiles, but without
any significant investment into devops or hosting large file.

PMTiles config now also allows `http` and `https` protocol.

```
# Publish PMTiles files
pmtiles:
  paths:
    # specific pmtiles file will be published as mypmtiles source
    # (use last portion of the URL without extension)
    - http://example.org/path/to/mypmtiles.pmtiles
  sources:
    # named source matching source name to a single file
    pm-src1: https://example.org/path/to/some_pmtiles.pmtiles
 ```

fixes #884

---------

Co-authored-by: Kyle Slugg-Urbino <35903887+kyleslugg@users.noreply.github.com>
2023-12-22 06:01:50 +00:00
Yuri Astrakhan
5006641588
Make martin-cp integration tests ignore gen version (#1082)
This avoids blessing test results after version upgrade
2023-12-18 21:20:36 -05:00
Yuri Astrakhan
bb802c5688
Feature: mbtiles copy --bbox ... to copy tiles within a bbox only (#1060)
Allow users to copy tiles between mbtiles files that are only within a
bounding box. Multiple `--bbox` params are allowed.
2023-12-15 23:13:57 -05:00
Yuri Astrakhan
f88db05582
Fix SQL comments when func or table is pre-configured (#1045)
When a SQL comment is set on a table or a function to customize
tilejson, and that tbl/func is pre-configured as part of the config
file, the comment was silently ignored. Now both table and function
cases are handled correctly.

Also, update docs to not include function parameters - makes SQL example
a bit simpler.

Thanks @jjcfrancisco for reporting!

Fixes: #1044
2023-12-07 07:24:51 +00:00
Lucas
4814d3369c
Add Markdown linting and url check to CI and justfile (#1030)
Fix #979 with
[markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) and
[markdown-link-check](https://github.com/actions-marketplace-validations/gaurav-nelson_github-action-markdown-link-check)

## Link check
- [x] Add link check to just clippy
- [x] Add relative links check with
[markdown-link-check](https://github.com/actions-marketplace-validations/gaurav-nelson_github-action-markdown-link-check)
- [x] Ignore `CHANGELOG.md`
- [x] Ignore `localhost` and `127.0.0.1`
- [x] Ignore `http://opensource.org`
- [x] Add to justfile

## Lintting

- [x] Add markdown linting
- [x] Add markdown lint to just fmt
- [x] Ignore `CHANGELOG.md`?
- [x] Ignore [Line
Length](https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md013.md)
- [x] Ignore [First line in a file should be a top-level
heading](https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md041.md)
- [x] Ignore [Inline
HTML](https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md033.md)
- [x] Ignore [Images should have alternate
text](https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md045.md)
- [x] Ignore [Heading levels should only increment by one level at a
time](https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md001.md)
- [x] Rename lint config file.
- [x] Add to justfile

---------

Co-authored-by: Yuri Astrakhan <YuriAstrakhan@gmail.com>
2023-12-04 22:11:03 +00:00
Yuri Astrakhan
713a51b74d
Upgarde to v0.10 spreet crate, cleanup SpreetResult (#984) 2023-11-29 19:09:05 -05:00
Yuri Astrakhan
d311888f94
Update Docker build process (#1022)
* Fix docker file builds to use debian
* add a few more things to `.dockerignore`
* remove unused `martin` from docker-compose.yml
* delete unused arm64.Dockerfile

This should also fix #1021
2023-11-23 21:14:32 -05:00
Yuri Astrakhan
f88fd10aa8
Add martin-cp tool to bulk-copy tiles from any Martin-supported sources (#1011)
This adds a new utility called `martin-cp` that allows copying any
number of tiles from a single source (or a composite source) to an
mbtiles file.

`martin-cp` is a tool for generating tiles in bulk, and save retrieved
tiles into a new or an existing MBTiles file. It can be used to generate
tiles for a large area or multiple areas. If multiple areas overlap, it
will generate tiles only once. `martin-cp` supports the same
configuration file and CLI arguments as Martin server, so it can support
all sources and even combining sources.
2023-11-20 06:27:51 +00:00
Yuri Astrakhan
dec09bdabf
Do not serialize missing configs (#999)
Make sure minimum config does not save unused sub-systems.
2023-11-13 04:40:34 +00:00
Yuri Astrakhan
f7c69f8302
Minor cleanup and just reorg (#992)
Only run git push diff on linux to make development on non-linux easier,
and a few preparations for pmtiles over http serving

Fixes #855
2023-11-08 19:46:23 -05:00
Lucas
c6170c5913
Improve MBTiles documentation (#961)
Fixes #918 

---------

Co-authored-by: Yuri Astrakhan <YuriAstrakhan@gmail.com>
2023-10-31 00:41:21 -04:00
Yuri Astrakhan
47b3106ac6
Rename martin-mbtiles crate to mbtiles (#976)
This simplifies usage as both a crate and as a tool
2023-10-28 08:50:49 +00:00
Yuri Astrakhan
d9eb5fd174 justfile fixes 2023-10-22 03:31:01 -04:00
Yuri Astrakhan
b88d714bf6 justfile insta install 2023-10-21 18:41:21 -04:00
Yuri Astrakhan
502413aecb
Fix martin integration tests (#952)
Turns out some integration tests were not running after `martin` was
moved to subdir
2023-10-20 11:40:08 +08:00
Yuri Astrakhan
108bc05042
pg func discovery ignore sys schemas (#946)
* Blessing results should destroy test db
* ignore `pg_catalog` and `information_schema` schemas during functions
autodiscovery
2023-10-16 21:22:54 -04:00
Yuri Astrakhan
8b34cd374c
Add metadat copy/apply-diff, new testing framework (#921)
* Fix metadata copying
* Introduce a new metadata field `agg_tiles_hash_after_apply` for diff
files
* Added a lot of new info and debug logging
* Simplified Copying interface - not much value in having all the
complex builder pattern here it seems, might as well use a simple
object.

## Testing
* Generate SQLite DBs in memory on the fly to validate just what we need
* Use `insta` for validating DB content

There is now a function `dump(connection) -> Vec<Entry>` to dump the
content of the entire SQLite DB into text with `serde`. At many steps
through the testing, the DB content is validated with the corresponding
.snap file with `insta` crate (which makes this process mega-simple,
including a simple way to "bless" (update) any changes).

## Discovered bugs
* Seems like normalized files do not get copied properly - they contain
extras that should be removed.
2023-10-10 11:10:17 -04:00
Yuri Astrakhan
0459d3f748
add encoding=UTF8 pragma, refactoring (#919) 2023-10-03 21:20:41 -04:00
Yuri Astrakhan
64d652f5af
Improve SSL mode testing (#913) 2023-09-30 22:49:56 -04:00
Yuri Astrakhan
d1fe026639 Fix justfile ssl test, print hba config 2023-09-30 12:06:49 -04:00
Yuri Astrakhan
8d7204c53d
Switch to Rustls (#474)
Fixes #471
2023-09-30 17:58:49 +08:00
Yuri Astrakhan
6f08aa9465
Fix mbtiles validation, CI, and logging (#903) 2023-09-29 14:37:18 -04:00
Yuri Astrakhan
f87da9adf8
Minor Linting and rename dst_type (#864) 2023-09-06 11:12:53 -04:00
Yuri Astrakhan
bd4d314b2b adjust run target 2023-08-29 12:55:52 -04:00
Binabh
e3e6b3563f
adds support for id_column in tables for auto_publish (#790)
Resolves #682 

- [x] Get id_column string from config.yaml and use for id column
- [x] Support for list of strings
- [x] Add info/warnings if column is not there or is of wrong type
- [x] if column for the feature ID is found, remove it from properties
(see inline comment)
- [x] cleanup logging messages
- [x] need more tests to catch other edge cases

---------

Co-authored-by: Yuri Astrakhan <YuriAstrakhan@gmail.com>
2023-08-13 02:06:23 +00:00
Yuri Astrakhan
405d4b27a2
Improve auto-publish usability (#795)
* on `--save-config`, only save configured `auto_publish` settings
* alias `from_schemas` as `from_schema`
* add integration testing for `auto_publish`
* if integration test DB preloading fails, try to clean up the test DB
* A few more info traces

This change should benefit testing of the #790 cc: @Binabh
2023-08-03 23:51:10 +02:00
rstanciu
42c2df46ef
Add ability to copy to existing mbtiles files (#778)
* Allow the `dst` in `mbtiles copy <src> <dst>` command to already
contain data, merging tilesets
* Add `mbtiles copy --on-duplicate (override|ignore|abort)`

---------

Co-authored-by: rstanciu <rstanciu@rivian.com>
Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
2023-07-27 18:54:49 +00:00
baishikele
e1f7436d62
Debian package (#730)
Add deb package  by [cargo-deb](https://crates.io/crates/cargo-deb)
- [ ] add deb package metadata
- [ ] more research on systemd integration

To inspect the package:
```shell
# install cargo-deb dependices
sudo apt install dpkg
sudo apt install dpkg-dev
sudo apt install liblzma-dev

cargo install cargo-deb
cd martin
cargo deb
The Debian package will be created in `target/debian/martin_0.8.7_amd64.deb` . 
```

To decompress this package:
```shell
dpkg -x martin_0.8.7_amd64.deb path_of_decompress  
```

---------

Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
2023-07-10 18:38:48 +00:00
Yuri Astrakhan
ed7d33a76d
Cleanup docker and related docs (#752)
* Use same docker image for postgis & psql
* Improve docker book
* rename just target `mdbook` to `book` (more obvious choice)
* Cleanup justfile to not duplicate "cargo install" check & installation
2023-07-07 20:44:30 +00:00
Yuri Astrakhan
144e10ff20
Upgrade sqlx to v0.7 (#743)
This is mostly a noop, just updating to the new way of storing cached
queries and a few other changes per
https://github.com/launchbadge/sqlx/blob/main/CHANGELOG.md#070---2023-06-30

Note that this uses some of the code from #729 (thanks @upsicleclown !)

A minor unrelated change - a reformat of `martin/release.toml`
2023-07-04 08:05:23 -04:00
Pirmin Kalberer
aabcb0aa0a
Add sqlx-rustls support (#720)
I'd like to add optional rustls support for SQLx. This PR implements the
required features, but tests using `--all-features` fail, because
runtime selection features are not additive. I didn't find a solution
apart from avoiding `--all-features`.

---------

Co-authored-by: Yuri Astrakhan <YuriAstrakhan@gmail.com>
2023-07-03 21:29:44 +00:00