Google Cloud Firestore
If you want to use Cloud Firestore as the database provider for the Sync Server or as the message provider for the Lighthouse/PHPCS Server you’ll need to setup Cloud Firestore for your project.
Environment Variables
Variable | Description |
---|---|
GCF_QUEUE_LH | Specifies which collection in Cloud Firestore to use for the Lighthouse message queue. This is a Firestore collection path. Default is queue-lighthouse . |
GCF_QUEUE_PHPCS | Specifies which collection in CLoud Firestore to use for the PHPCS message queue. This is a Firestore collection path. Default is queue-phpcs . |
Setup
-
If you don’t already have a Firebase project, add one in the Firebase console. The Add project dialog also gives you the option to add Firebase to an existing Google Cloud Platform project.
-
Allow read/write access on all documents to any user signed in to the application by replacing the previous security rules with the following in the Cloud Firestore console.
service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write: if request.auth.uid != null; } } }
-
In order for the message queue to be queryable by the Go servers, you will need to add composite indexes for both the
GCF_QUEUE_LH
andGCF_QUEUE_PHPCS
message queues. The following directions are going to be forGCF_QUEUE_PHPCS
, but must be repeated for theGCF_QUEUE_LH
queue. It’s assumed you are using the defaultqueue-phpcs
value forGCF_QUEUE_PHPCS
.- Open the composite indexes tab in the Firebase console.
- Click
Add index manually
or theAdd Index
button if you already have created a composite index. - Add
queue-phpcs
as the collection name. - Add a new field named
retry_available
and set sort to ascending. - Add a new field named
lock
and set the sort to ascending. - Add a new field named
created
and set the sort to ascending. - Click
Create Index
and repeat forqueue-lighthouse
.
Note: If you change the values in your .env
then the collection names in the third step should be the same as those values.