Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Commit

Permalink
Replace bash scripts with workflow (#278)
Browse files Browse the repository at this point in the history
And remove the docker configuration files as they are difficult to maintain and rarely used in practice.
  • Loading branch information
bchapuis committed Aug 3, 2022
1 parent a8621d5 commit b37d688
Show file tree
Hide file tree
Showing 35 changed files with 772 additions and 1,559 deletions.
5 changes: 0 additions & 5 deletions .dockerignore

This file was deleted.

23 changes: 0 additions & 23 deletions Dockerfile

This file was deleted.

82 changes: 22 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,71 +5,42 @@
OpenStreetMap Vecto is a general-purpose configuration for [Baremaps](https://github.com/baremaps/baremaps).
It is used to generate vector tiles and to produce a Mapbox style inspired by [OpenStreetMap Carto](https://github.com/gravitystorm/openstreetmap-carto).

![OpenStreetMap Vecto](screenshot.png)
## Requirements

### Requirements
* [Postgres](https://www.postgresql.org/) 13+
* [PostGIS](https://postgis.net/) 3+
* [Java](https://adoptium.net/) 17+
* [Baremaps](https://www.baremaps.com/) 0.7+

* [Docker](https://www.docker.com/) 18.09+.
* [Docker Compose](https://docs.docker.com/compose/) 1.27+.
The database should be accessible with the following jdbc settings:

```
jdbc:postgresql://localhost:5432/baremaps?user=baremaps&password=baremaps
```

## Getting started

In order to experiment with OpenStreetMap Vecto, you first need to clone the current repository

```
git clone [email protected]:baremaps/openstreetmap-vecto.git
cd openstreetmap-vecto/
```

Then, you can start the docker images, import the data, and edit the map with the following commands.
Assuming that the necessary requirements have been installed, the database can be populated with the following command.

```
docker-compose up --build -d
baremaps workflow execute --file workflow.json
```

This default environment will:

* Import OSM data of the Liechtenstein
* Import natural earth data (https://www.naturalearthdata.com/downloads/)
* import osm water polygon
* import osm simplified water polygons.

You can override this data loaded by modifying the `scripts/import.sh` file.

To override settings. Copy the `env.sample` file to `.env` and modify env var.


## Docker compose setup

A docker container containing a PostGIS database and all the tools required to run [Baremaps](https://github.com/baremaps/baremaps) can be started with [docker-compose](https://docs.docker.com/compose/).

The `docker-compose.yml` file contains two services: `db` and `app`.
The former holding a PostgreSQL 13.1 / PostGIS 3.1 database and the latter serving the applicative content, namely baremaps.
It's from the `app` containers that you want to run all baremaps commands to populate the database from data, or to start the web application using some of the commands defined hereunder.
The development server can be started with the following command.

The version of baremaps can be changed via the variable `BAREMAPS_VERSION` in the `env.sample` file. To find a specific version of baremaps go to the [github release page](https://github.com/baremaps/baremaps/releases/) of the project.

### Useful commands

Command | Description
:--------------------------------------- | :--------------------------------------------------
`docker-compose up --build` | Run the application in the foreground.
`docker-compose up --build --detach` | Run the application in the background.
`docker-compose stop` | Stop all containers.
`docker-compose down` | Stop and remove all containers (but keep the data).
`docker-compose down --volumes` | Stop and permanently delete all containers and data.
`docker-compose down --volumes --remove-orphans` | Same as previous and remove all dangling containers not defined in the Compose file.
`docker-compose exec app <command>` | Execute a command inside the running `app` container.
`docker-compose exec app bash -c ./scripts/import.sh` | Execute the import.sh script to populate the database (inside the container).
`docker-compose exec app bash -c ./scripts/edit.sh` | Edit the map (the db must be populated before running that command).
`docker-compose ps` | List running containers.
`docker-compose logs --tail 20 -f` | Print all containers logs to stdout (usefull when they were launched in the background).


Your browser ([http://localhost:9090/](http://localhost:9090/)) should now preview OpenStreetMap Vecto.
Here, the port is `9090`, but you will have to use the one you defined in your `.env` if you changed it.
You will also have to change the port and host in `tileset.json` if you don't use the standard ones.
Notice that a change in the configuration files (`tileset.json`) will automatically be reloaded by the browser.
```
baremaps map dev --log-level DEBUG \
--database 'jdbc:postgresql://localhost:5432/baremaps?user=baremaps&password=baremaps' \
--tileset 'tileset.json' \
--style 'style.json'
```

## Editing the tileset

Expand All @@ -80,7 +51,7 @@ Simply put, it adds in the ability to describe the `vector_tiles` and their cont
{
"tilejson": "2.2.0",
"tiles": [
"http://localhost:9090/tiles/{z}/{x}/{y}.mvt"
"http://localhost:9000/tiles/{z}/{x}/{y}.mvt"
],
"vector_layers": [
{
Expand Down Expand Up @@ -108,13 +79,4 @@ Baremaps integrates [Maputnik](https://maputnik.github.io/) and most of the modi

## Contributing

As a lot remains to be done, contributions and feedbacks are welcome.

## Troubleshooting windows

On windows, be careful with line endings (LF), especially when the files are mounted in a docker container.

```
docker run -d --name osmvecto --publish 5432:5432 --publish 9090:9090 --volume C:\openstreetmap-vecto:/home baremaps/osmvecto:latest
docker exec -ti osmvecto bash -c ./import.sh https://download.geofabrik.de/europe/switzerland-latest.osm.pbf
```
As a lot remains to be done, contributions and feedbacks are welcome.
58 changes: 0 additions & 58 deletions docker-compose.yml

This file was deleted.

5 changes: 0 additions & 5 deletions entrypoint.sh

This file was deleted.

12 changes: 0 additions & 12 deletions env.sample

This file was deleted.

Loading

0 comments on commit b37d688

Please sign in to comment.