Skip to content

Commit 2e2a9a1

Browse files
committed
document usage without docker
1 parent 9d40b56 commit 2e2a9a1

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,22 @@ Underpass-API aim to be a [Overpass-API](https://github.com/drolbr/Overpass-API)
66

77
## Prepare the data & Run the server
88

9-
Folow the instruction of one of the backends:
9+
### With docker (recommended)
10+
11+
Follow the instruction of one of the backends:
1012
* [Postgres+PostGIS / Osmosis](backends/postgres_osmosis/README.md), Osmosis schema
1113
* [DuckDB+Spatial / QuackOSM](backends/duckdb_quackosm/README.md), Quackosm schema
1214

15+
### Without docker
16+
17+
It is possible to use Underpass-API without docker with the following instructions :
18+
19+
* declare environment variables (add new lines in `~/.bashrc` or `~/.profile` then reload with `source ~/.bashrc`) :
20+
- DuckDB+Spatial / QuackOSM: `export BACKEND="DuckdbQuackosm"` and `export DB="/data/database.parquet"`
21+
- Postgres+PostGIS / Osmosis: `export BACKEND="PostgresOsmosis"` and `export "DATABASE_URL='postgresql://user:pw@host:5432/database"`
22+
* install software : `bundle install`
23+
* start server : `bundle exec rackup`
24+
1325
## Query
1426

1527
The API as available at http://localhost:9292/interpreter

config.ru

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,22 @@ require 'bundler/setup'
44
require 'hanami/api'
55
require 'overpass_parser'
66
require 'json'
7-
require_relative 'backends/postgres_osmosis/postgres_osmosis'
8-
require_relative 'backends/duckdb_quackosm/duckdb_quackosm'
7+
case ENV['BACKEND']
8+
when 'DuckdbQuackosm'
9+
require_relative 'backends/duckdb_quackosm/duckdb_quackosm'
10+
when 'PostgresOsmosis'
11+
require_relative 'backends/postgres_osmosis/postgres_osmosis'
12+
end
913

1014
class App < Hanami::API
1115
def initialize
1216
super
13-
@@backend = ENV['BACKEND'].constantize.new
17+
@@backend = case ENV['BACKEND']
18+
when 'DuckdbQuackosm'
19+
DuckdbQuackosm.new
20+
when 'PostgresOsmosis'
21+
PostgresOsmosis.new
22+
end
1423
end
1524

1625
helpers do

0 commit comments

Comments
 (0)