Register
Submit a solution
The challenge is finished.

Challenge Overview

Currently, the submission system is using DynamoDB as DB layer, but we want to change to use Postgres instead, since there are some limitation in DynamoDB.

We have made the whole submission system possible to run locally, please check https://github.com/appirio-tech/tc-common-tutorials/tree/master/submission-system

So we'd like you to do the following for the replacement (not limited to these).

1. add a Postgres image to the docker-compose.yaml file and add depends
postgres:
image: "postgres:9.4"
environment:
- POSTGRES_PASSWORD=mysecretpassword
- POSTGRES_USER=dbuser
- POSTGRES_DB=tasksdb
2. Create Postgres table definition
Following is a sample document (see forum), but you'd better check the dynamodb locally, see if there is any difference.
a. for dates, they are milliseconds since epoch (Unix time) in DynamoDB, we would like to change that to be a datetime field in GMT. 
b. for json string field, like 'data',  it should be 
json field in Postgres
c. for id field, it is String UUID in DynamoDB, but it should be 
auto generated long type in Postgres.

3. Use JDBI to access Postgres. The supply library has some good improvements on the standard JDBI framework, such as externalizing sql files so they don't have to be in the java annotations. Please look at the DAOs in review microservice (provided in forum) for examples of how to use the supply library.

4. Make sure all configuration parameters for the Postgres connection (host, port, user, password, etc.) come from environment variables.

5.  Remove the dynamodb dependency altogether, like in docker-compose.yaml, pom.xml etc

 



Final Submission Guidelines

1. Codebase change for the replacement.
2. Changes to https://github.com/appirio-tech/tc-common-tutorials/tree/master/submission-system
3. Verifcation steps to make sure the functionality is working, like checking database records.

ELIGIBLE EVENTS:

2016 TopCoder(R) Open

Review style

Final Review

Community Review Board

Approval

User Sign-Off

ID: 30054032