Categorygithub.com/ONSdigital/dp-geodata-api
module
0.0.0-20240815083739-86b9d5918af2
Repository: https://github.com/onsdigital/dp-geodata-api.git
Documentation: pkg.go.dev

# README

dp-geodata-api

⚠️ This repository will be archived in August 2024 as it is no longer in development. ⚠️

Census Atlas geodata API and database.

Further Docs

  • Environment Variables

    Database connection details and feature flags are controlled with environment variables. Almost all processes depend on these variables being set correctly, so be careful to verify before running anything risky.

  • Postgres/PostGIS

    The system is designed around Postgres with PostGIS extensions. The database may be run as a native local process, within a container, or as an RDS instance.

  • Data Ingest

    The "ingest" process takes source data files and loads them into the database. For best results, the ingest should be applied to a local native postgres instance. Running against RDS directly or against a containerised postgres instance is too slow.

    Source data files should be in place, and the postgres environment variables must be exported before running the ingest script (indigestion.sh).

  • Export/Import

    The export/import processes copies a database. Our main application is to export a locally ingested database for import into RDS.

  • API

    The API presents a specific interface for querying the database. It is mainly used by the front end application.

    The API may be run as a local process, within a container, or on some temporary EC2 instances we have in place for the moment. The plan is that instance of the API will run within the standard develop and prod environments.

  • CLIs

    These clis are mostly for developers, and may not be fully caught up with features of the API.

  • Testing

  • Terraform

  • How-Tos

Getting started

  • Run make debug

To enable postgres and census queries, set ENABLE_DATABASE, and the postgres environment variables. To lookup the postgres password in Secrets Manager, set FI_PG_SECRET_ID instead of PGPASSWORD, and make sure to set AWS_REGION and any other AWS environment variables.

Auto generated code

swagger.yaml is used to generate code via make generate

Particularly api/api.go (and similar files) shouldn't be directly edited.

Configuration

Environment variableDefaultDescription
BIND_ADDR:25252The host and port to bind to
GRACEFUL_SHUTDOWN_TIMEOUT5sThe graceful shutdown timeout in seconds (time.Duration format)
HEALTHCHECK_INTERVAL30sTime between self-healthchecks (time.Duration format)
HEALTHCHECK_CRITICAL_TIMEOUT90sTime to wait until an unhealthy dependent propagates its state to make this app unhealthy (time.Duration format)
ENABLE_DATABASEfalseEnable postgres and census query functionality
AWS_REGIONused by AWS SDK when ENABLE_DATABASE is true and PGPASSWORD is empty
PGHOSTpostgres host when ENABLE_DATABASE is true
PGPORTpostgres port when ENABLE_DATABASE is true
PGUSERpostgres user when ENABLE_DATABASE is true
PGPASSWORDpostgres password when ENABLE_DATABASE is true (also see FI_PG_SECRET_ID)
PGDATABASEpostgres database when ENABLE_DATABASE is true
FI_PG_SECRET_IDARN of key holding postgres password if PGPASSWORD is empty
DO_CORSfalseAdd Access-Control-Allow-Origin: * to headers if true (not needed in develop / prod)

Contributing

See CONTRIBUTING for details.

License

Copyright © 2022, Office for National Statistics (https://www.ons.gov.uk)

Released under MIT license, see LICENSE for details.

# Packages

Package api provides primitives to interact with the openapi HTTP API.
The cache package provides content caching and a mechanism to prevent cache stampedes.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Package Swagger provides primitives to interact the openapi HTTP API.