From 2e2a9a19fb8b71334fd3b88c1cfff90cc7eba14b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Etil=C3=A8ne=20Jourdier?= Date: Sun, 30 Mar 2025 22:32:42 +0200 Subject: [PATCH] document usage without docker --- README.md | 14 +++++++++++++- config.ru | 15 ++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2ebfb1d..6537f2b 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,22 @@ Underpass-API aim to be a [Overpass-API](https://github.com/drolbr/Overpass-API) ## Prepare the data & Run the server -Folow the instruction of one of the backends: +### With docker (recommended) + +Follow the instruction of one of the backends: * [Postgres+PostGIS / Osmosis](backends/postgres_osmosis/README.md), Osmosis schema * [DuckDB+Spatial / QuackOSM](backends/duckdb_quackosm/README.md), Quackosm schema +### Without docker + +It is possible to use Underpass-API without docker with the following instructions : + +* declare environment variables (add new lines in `~/.bashrc` or `~/.profile` then reload with `source ~/.bashrc`) : + - DuckDB+Spatial / QuackOSM: `export BACKEND="DuckdbQuackosm"` and `export DB="/data/database.parquet"` + - Postgres+PostGIS / Osmosis: `export BACKEND="PostgresOsmosis"` and `export "DATABASE_URL='postgresql://user:pw@host:5432/database"` +* install software : `bundle install` +* start server : `bundle exec rackup` + ## Query The API as available at http://localhost:9292/interpreter diff --git a/config.ru b/config.ru index 52b0dda..c8b2f94 100644 --- a/config.ru +++ b/config.ru @@ -4,13 +4,22 @@ require 'bundler/setup' require 'hanami/api' require 'overpass_parser' require 'json' -require_relative 'backends/postgres_osmosis/postgres_osmosis' -require_relative 'backends/duckdb_quackosm/duckdb_quackosm' +case ENV['BACKEND'] +when 'DuckdbQuackosm' + require_relative 'backends/duckdb_quackosm/duckdb_quackosm' +when 'PostgresOsmosis' + require_relative 'backends/postgres_osmosis/postgres_osmosis' +end class App < Hanami::API def initialize super - @@backend = ENV['BACKEND'].constantize.new + @@backend = case ENV['BACKEND'] + when 'DuckdbQuackosm' + DuckdbQuackosm.new + when 'PostgresOsmosis' + PostgresOsmosis.new + end end helpers do