0.3.4 • Published 10 months ago

turbo-remote-cache-rs v0.3.4

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

turbo-repo-remote-cache-rs

Fast turbo remote cache server written in Rust.

if you are using turbo and you want to have a self-hosted remote cache server this is for you.

  1. It is fast ⚡️.
  2. It supports multiple object storage providers (S3, GCP, Azure, and file).

Installation

  • Using Cargo (Linux/macOS/Windows)
cargo install turbo-remote-cache-rs
  • Using Npm (Linux/macOS/Windows)
npm install -g turbo-remote-cache-rs

Usage

  1. Copy .env.example to same directory as the binary and rename it to .env.
  2. Edit .env file to your needs (TURBO_TOKENS, BUCKET_NAME are required) please refer to .env.example for more information about required vars for each cloud storage provider.
  3. Run the binary.
  turbo-repo-remote-cache-rs
  1. Provide the url to turbo cli
turbo build --api="http://localhost:4000" --token=<token> --team=<team>

you can also set teamId and apiUrl .turbo/config.json in the root of your project.

  1. Enjoy your self-hosted remote cache and faster builds 🚀.

Docker

  1. Create a docker file.
FROM salamaashoush/turbo-remote-cache-rs
ENV PORT=4000
ENV FS_PATH=/tmp
ENV BUCKET_NAME=cache
ENV TURBO_TOKENS="token1,token2,token3"
EXPOSE 4000
CMD ["turbo-remote-cache-rs"]
  1. Build the image.
docker build -t your-image .
  1. Run the image.
docker run -p 4000:4000 -v ./cache:/tmp/cache your-image
  1. Provide the URL to turbo cli
turbo build --api="http://localhost:4000" --token=<token> --team=<team>

you can also set teamId and apiUrl .turbo/config.json in the root of your project.

Kubernetes

See example in examples/k8s, Don't forget to change the spec and env vars for your needs before applying it (NOTE that it is just an example and it is not production ready).

Environment Variables

Required

NameDescriptionDefault
TURBO_TOKENSComma separated list of turbo tokens that are allowed to access the cache.""
BUCKET_NAMEName of the bucket to store the cache in."cache"
STORAGE_PROVIDERStorage provider to use. s3, azure, gcs, file or memory"memory"

File Storage Provider

NameDescriptionDefault
FS_PATHPath to store the cache in.os temp dir

S3 Storage Provider

NameDescriptionDefault
AWS_ACCESS_KEY_IDAWS access key id.""
AWS_SECRET_ACCESS_KEYAWS secret access key.""
AWS_DEFAULT_REGIONAWS region.""
AWS_ENDPOINTAWS endpoint.""
AWS_SESSION_TOKENAWS session token""
AWS_CONTAINER_CREDENTIALS_RELATIVE_URIAWS bucket endpoint.""
AWS_ALLOW_HTTPset to “true” to permit HTTP connections without TLS.false
AWS_PROFILEset profile name, requires aws_profile feature enabled""

Azure Storage Provider

NameDescriptionDefault
AZURE_STORAGE_ACCOUNT_NAMEstorage account name.""
AZURE_STORAGE_ACCOUNT_KEYstorage account master key""
AZURE_STORAGE_ACCESS_KEYalias for AZURE_STORAGE_ACCOUNT_KEY""
AZURE_STORAGE_CLIENT_IDclient id for service principal authorization""
AZURE_STORAGE_CLIENT_SECRETclient secret for service principal authorization""
AZURE_STORAGE_TENANT_IDtenant id used in oauth flows""

GCS Storage Provider

NameDescriptionDefault
GOOGLE_SERVICE_ACCOUNTlocation of service account file""
GOOGLE_SERVICE_ACCOUNT_PATH(alias) location of service account file""
SERVICE_ACCOUNT(alias) location of service account file""
GOOGLE_SERVICE_ACCOUNT_KEYJSON serialized service account key""
GOOGLE_BUCKETbucket name""
GOOGLE_BUCKET_NAME(alias) bucket name""

Todo

  • Support turbo headers x-artifact-duration, x-artifact-tag, x-artifact-client-ci and x-artifact-client-interactive right now those are ignored and they don't affect the cache.
  • Add nx cloud support.
  • Add more advanced authentication support.
  • Maybe having a dashboard to manage teams and projects would be nice.
0.3.4

10 months ago

0.3.3

10 months ago

0.3.0

11 months ago

0.2.0-alpha.0

11 months ago