An Application Programming Interface (API) to manage instrumentation data, built with Golang and Deployed on AWS Lambda.
How to Develop
Running a Database for Local Development
Install Docker and Docker Compose
Change to the /database directory in this repository and type
docker-compose up. This brings up two services on
A postgres database with postgis schema installed using the Docker image mdillon/postgis
pgadmin4 (a user interface to interact with the database) using the Docker image dpage/pgadmin4
To modify the database using pgadmin4, open a web browser and go to
Create a database connection to the postgres database by right-clicking
servers --> create --> serverin the left menu tree. Enter the following information and click
Field Value Name localhost (or other preferred name)
Field Value Host name/address postgres Port 5432 (default) Username postgres Password postgres
Initialize the database and seed it with some data
Use the Query Tool in pgadmin4 and the .sql files in the database/ directory in this repository. You can find the query tool by expanding the left menu tree to
Servers --> Databases --> postgres. Right click
postgres --> Query Tool. From here, copy tables.sql into the Query Tool and run it by pressing
f5. Note: to only run a portion of the SQL you've copied, you can highlight the section you want to run before hitting
Running the GO API for Local Development
Either of these options starts the API at
localhost:3030. The API uses JSON Web tokens (JWT) for authorization by default. To disable JWT for testing or development, you can set the environment variable
With Visual Studio Code Debugger
You can use the launch.json file in this repository in lieu of
go run root/main.go to run the API in the VSCode debugger. This takes care of the required environment variables to connect to the database.
Without Visual Studio Code Debugger
Set the following environment variables and type
go run root/main.go from the top level of this repository.
* DB_USER=postgres * DB_PASS=postgres * DB_NAME=postgres * DB_HOST=localhost * DB_SSLMODE=disable * LAMBDA=FALSE * JWT_DISABLED=FALSE
Note: When running the API locally, make sure environment variable
LAMBDA is either not set or is set to
Running API Docs Locally
From the top level of this repository, type
make docs. This starts a container that serves content based on "apidoc.yml" in this repository.
Open a browser and navigate to
https://localhost:4000 to view the content.
How To Deploy
Postgres Database on AWS Relational Database Service (RDS)
Database should be initialized with the following SQL files in the order listed:
rds_init.sql (install PostGIS extensions)
tables.sql (create tables for application)
roles.sql (database roles, grants, etc.)
Note: Change 'password' in roles.sql to a real password for the
There is no documentation for this package.