Requires :
- NodeJS >= 9
- PostgreSQL >= 10
- PostGIS >= 2.5
- A properly initialized Ça reste ouvert database (with
countries_subcountries
table)
Then run these commands :
cd caresteouvert_backend/
npm install
psql -d mydb -f src/init.sql
npm run start:api # Launch API listening process
npm run start:osm # Launch OSM data sending process
DATABASE_URL
: connection string for PostgreSQL databaseDELAY_OSM
: optional, delay between two calls to either notes or features updates (in milliseconds)OSM_API_URL
: OSM API endpoint to use (for example https://master.apis.dev.openstreetmap.org)OSM_API_KEY
: OSM API keyOSM_API_SECRET
: OSM API secret keyOSM_USER
: OSM user nameOSM_PASS
: OSM user passwordOSM_LANG
: language used for OpenStreetMap notes and changesets (code used insrc/locales.json
)
The back-end can be deployed using Docker. It consists of three containers:
db
– a PostgreSQL database to hold contributions (docker/db/Dockerfile),web
– a web server to accept contributions and insert them into the database (docker/web/Dockerfile),worker
– a worker to relay contributions to OSM as changesets and notes (docker/worker/Dockerfile).
To deploy using Docker Compose:
- Copy
env.example
to.env
and set environment variables. - Run
docker-compose up
to build and run the containers. - Open http://localhost:8080/ to check that it returns
{"status":"OK"}
.
Notes:
- On the first run, the database will be created automatically. It is a known issue that the worker fails in this case, because it tries to access the database before it exists.
- To reset the database, run
docker-compose down --volumes
.
Content managed by backend can be translated on Transifex.
Copyright (c) "Ça reste ouvert" 2020
Released under the AGPL v3 terms, see the LICENSE file to read the full text.