modulepackage
0.21.0
Repository: https://github.com/onsdigital/dp-areas-api.git
Documentation: pkg.go.dev
# README
dp-areas-api
Digital Publishing areas API used to navigate profiles for different geographical areas across the UK
Getting started
- Run
make debug
Dependencies
- No further dependencies other than those defined in
go.mod
Configuration
Environment variable | Default | Description |
---|---|---|
BIND_ADDR | :25500 | The host and port to bind to |
GRACEFUL_SHUTDOWN_TIMEOUT | 5s | The graceful shutdown timeout in seconds (time.Duration format) |
HEALTHCHECK_INTERVAL | 30s | Time between self-healthchecks (time.Duration format) |
HEALTHCHECK_CRITICAL_TIMEOUT | 90s | Time to wait until an unhealthy dependent propagates its state to make this app unhealthy (time.Duration format) |
Connecting to the AWS AURORA RDS instance from your local machine
Note: <RDS_INSTANCE_ENDPOINT>
can be obtained from the AWS AURORA RDS cluster console here:
- Add DB host to /etc/hosts:
127.0.0.1 <RDS_INSTANCE_ENDPOINT>
- Set the following in your environment - remote postgres connection:
export AWS_PROFILE="development"
export PG_USER="dp-areas-api-publishing"
export PGPASSWORD="$(aws rds generate-db-auth-token --hostname
--port 5432 --region eu-west-1 --username dp-areas-api-publishing)"
These config variables are only required if running the dp-areas-api branch I’m working on (https://github.com/ONSdigital/dp-areas-api/tree/feature/postgres_healthcheck):
export DBNAME="dp-areas-api"
export DBUSER="dp-areas-api-publishing"
export DBHOST="<RDS_INSTANCE_ENDPOINT>"
export DBPORT=5432
export AWSREGION=<AWS_REGION>
for local postgres connection (relies on dp-compose
):
Note: set DPPostgresLocal to true to use local postgres instance
export DPPostgresLocal=true
export DPPostgresUserName="postgres"`
export DPPostgresUserPassword="<PASSWORD>"` (see docker compose)
export DPPostgresLocalPort="5432"`
export DPPostgresLocalDB="dp-areas-api"`
- Run the dp command:
dp remote allow develop
- Open a port forwarding connection from your localhost:5432 to the AWS AURORA RDS instance endpoint by running:
dp ssh develop publishing 3 -v -- -L 5432:<RDS_INSTANCE_ENDPOINT>:5432
- Get the required certificate by running:
wget https://s3.amazonaws.com/rds-downloads/rds-ca-2019-root.pem
- Finally, execute the sql command to open a tunnel to the AWS AURORA RDS instance:
psql -h url to rds instance -p 5432 "sslmode=verify-full sslrootcert="rds-ca-2019-root.pem" dbname=dp-areas-api user=dp-areas-api-publishing"
Add env variable to import area info
export CSV_FILE_PATH="<CSV_FILE_PATH>"
export AREA_UPDATE_URL=http://127.0.0.1:25500/v1/areas/
Contributing
See CONTRIBUTING for details.
License
Copyright © 2021, Office for National Statistics (https://www.ons.gov.uk)
Released under MIT license, see LICENSE for details.
# Packages
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