Setting up Memorystore (Redis) - ProVR-Norway/ProvrBackend GitHub Wiki
Why Memorystore?
We use the Google Cloud service Memorystore to store the tokens that are used to authorise users that want to access specific resources. Unlike Cloud SQL that uses an SSD (or HDD) to store data, redis on Memorystore is placed in the cache. This ensures super-fast read and write operations, making it ideal for temporary data that is frequently accessed. Much like Cloud SQL, Memorystore increases security and ensures scalability.
Security
All sensitive data for Redis is stored as GitHub secrets. To find the values of these you will need to check the info about the Memorystore (Redis) instance on Google Cloud.
Note: The host of the Memorystore (Redis) instance is set to the value under
IP address
.
Accessing the instance
To be able to access the instance from a service running on Cloud Run, you will need to create a VCP connector first (VCP network
< Serverless VPC access
) and then add it to the Cloud Run instance. This happens in the in the GitHub Action workflow file, but it can also be done manually.
Note: The Memorystore instance will need to be connected to the same network as the VCP connector (
Connection properties
<Authorized network
). In most cases this network is calleddefault
.