guardian / riff-raff

The Guardian's deployment platform
Apache License 2.0
265 stars 18 forks source link

Create a new `service_catalogue` user and schema with views to riff-r… #1273

Closed AshCorr closed 10 months ago

AshCorr commented 10 months ago

What does this change?

Creates a new service_catalogue DB user with access to the service_catalogue schema.

We'll be using this new user and views to source riffraff data into our Service Catalogue CloudQuery tables.

How to test

  1. Run riff-raff locally
  2. Connect to local DB as riffraff
  3. Run `ALTER USER service_catalogue PASSWORD 'password';
  4. Connect to local DB as service_catalogue and the newly set password password.
  5. Run:

SELECT * FROM service_catalogue.riffraff_deploys should run sucessfully SELECT * FROM public.deploy should fail with a permissions error.

image image

Before Deployment / Merge

  1. Rotate Master credentials on Riff Raff DB and make a note of them
  2. SSH onto a riff-raff node to setup a tunnel to the DB eval $(ssm ssh --profile deployTools -t riff-raff,deploy,(STAGE) --raw --newest) -L (riff raff DB port):(riff raff DB host):(riff raff DB port)
  3. Connect to riff-raff DB and run ALTER USER (riff raff app username) CREATEROLE;