Remote caching for @nrwl/nx using Google Cloud Storage
npm install nx-remotecache-google
A task runner for @nrwl/nx that uses an Google Cloud Storage as a remote cache.
This enables all team members and CI servers to share a single cache.
The concept and benefits of computation caching are explained in the NX documentation.
This package was built with nx-remotecache-custom 🙌
| Nx | nx-remotecache-google |
| ----------------- |---------------------|
| >= 19.0.0 < 20 | = 1.1.0 |
| >= 17.0.0 < 18 | = 1.0.0 |
```
npm install --save-dev nx-remotecache-google
| Parameter | Description | Environment Variable / .env | nx.json |NXCACHE_GOOGLE_STORAGE_PROJECT_ID
|-------------|--------------------------------------|---------------------------------------|----------------|
| Project ID | Id of your project on GCP | | project_id |NXCACHE_GOOGLE_STORAGE_CLIENT_EMAIL
| Client Name | Client email of your service account | | client_email |NXCACHE_GOOGLE_STORAGE_PRIVATE_KEY
| Private Key | Private key of your service account | | private_key |NXCACHE_GOOGLE_STORAGE_BUCKET
| Bucket Name | Bucket name where to store cache | | bucket |
`json`
{
"tasksRunnerOptions": {
"default": {
"runner": "nx-remotecache-google",
"options": {
// All of the gcp specific options can also be inserted via environment variables! ⬆️
"private_key": "-----BEGIN PRIVATE KEY-----\n.........\n-----END PRIVATE KEY-----",
"project_id": "your-project-id",
"client_email": "nx-storage-account@your-project-id.gserviceaccount.com",
"bucket": "gs://your-storage-bucket",
"cacheableOperations": ["build", "test", "lint", "e2e"]
}
}
}
}
Running tasks should now show the storage or retrieval from the remote cache:
`
chunk (runtime: main) main.js (main) 827 KiB [entry] [rendered]
webpack compiled successfully (xxxxx)
------------------------------------------------------------------------------
Stored output to remote cache: GCP Storage
File: 1679426766935461636258771.tar.gz
------------------------------------------------------------------------------
`
| Option | Environment Variable / .env | Description |
| ------------ | --------------------------- | ----------------------------------------------------------------------------------------------------- |
| name | NXCACHE_NAME | Set to provide task runner name for logging. Overrides name provided in implementation. |verbose
| | | Set to receive full stack traces whenever errors occur. Best used for debugging. Default: false |silent
| | | Set to mute success and info logs. Default: false |read
| | NXCACHE_READ | Set to enable / disable reading from the remote cache. Default: true |write
| | NXCACHE_WRITE | Set to enable / disable writing to the remote cache. Default: true |dotenv
| | | Set to false to disable reading .env into process.env. Default: true |dotenvPath
| | | Set to read .env files from a different folder. |
`json``
"tasksRunnerOptions": {
"default": {
"options": {
"name": "My Storage",
"verbose": true,
"silent": true
}
}
}
| Runner | Storage |
|------------------------------------------------------------------------------|----------------------|
| nx-remotecache-azure | Azure Blob Storage |
| nx-remotecache-minio | MinIO Storage |
| nx-remotecache-google | Google Cloud Storage |