RoastSoftware / roaster

Automatically grades your code!
https://roast.software
GNU General Public License v3.0
5 stars 1 forks source link

Setup DBs and add environment variables in AWS EB for cmd/roasterd #88

Closed wstrm closed 5 years ago

wstrm commented 5 years ago

Ehhhlloooo!

I'm goin' to add an environment variable for the database source in cmd/roasterd that it'll read!

PostgreSQL

It's going to have the environment variable name: DATABASE_SOURCE

The supported formats are, either:

host=das.databas.example.org user=USERNAME_HERE dbname=DATABASE_NAME_HERE password=PASSWORD_HERE sslmode=require

sslmode= can be:

... or:

postgres://USERNAME_HERE:PASSWORD_HERE@das.databas.example.org/DATABASE_NAME_HERE?sslmode=require

Redis

There are two environment variables available:

The REDIS_PASSWORD can be generated with:

export REDIS_PASSWORD=$(LC_ALL=C tr -dc '[:alnum:]' < /dev/urandom | head -c64)

View the password:

echo $REDIS_PASSWORD

Required secure keys

PR #71 will add both encrypted SecureCookies and CSRF mitigation.

The server reads the following environment variables:

They both require cryptographically secure keys, they can be generated with:

export SESSION_KEY=$(LC_ALL=C tr -dc '[:alnum:]' < /dev/urandom | head -c32)
export CSRF_KEY=$(LC_ALL=C tr -dc '[:alnum:]' < /dev/urandom | head -c32)

View the generated keys with:

echo $SESSION_KEY
echo $CSRF_KEY

Please, do NOT use the same key for both of the variables.

Task

Add the environment variable to AWS EB in Configuration > Software > Modify > Environment properties

wstrm commented 5 years ago

This issue blocks the PR: #71

wstrm commented 5 years ago

Reference: https://godoc.org/github.com/lib/pq#hdr-Connection_String_Parameters