#community-help

Deploying Typesense on Google Cloud Run

TLDR Nicolas attempted to deploy Typesense on Google Cloud Run but encountered problems. CaptainCodeman advised that Cloud Run is unsuitable for Typesense and suggested using a container optimized VM.

Powered by Struct AI
+11
6
11mo
Solved
Join the chat
Oct 09, 2022 (11 months ago)
Nicolas
Photo of md5-91f35c8c9659f8301b0274294d6c3b27
Nicolas
07:48 PM
Hey guys!

After successfully running Typesense locally thanks to your nice tutorial, I'm trying to deploy Typesense on Google Cloud Run to minimize hosting costs. But it keeps failing to deploy with error: Container terminated due to sandbox error.

On the Cloud Run configuration, I have:

- the URL of the Typesense 0.23.1 Docker image that I have pushed to my Google Artifact Registry
- Container port: 8108
- Container command: run
- Container arguments: -p 0.0.0.0:8108:8108 -v /tmp/typesense:/data typesense:0.23.1 --data-dir /data --api-key=${TYPESENSE_API_KEY} --enable-cors
I've changed the listening address/port from 8108:8108 to 0.0.0.0:8108:8108 as it seems to be a Cloud Run requirement (first version doesn't work either).
- Secrets: API key saved in en var TYPESENSE_API_KEY
- Everything else is default.

Did anyone successfully deploy Typesense to Google Cloud Run ?
Any idea of what I am missing?

Thanks a lot!
Oct 10, 2022 (11 months ago)
CaptainCodeman
Photo of md5-d3a4ca49ba4aeb3b9d0cb7d846eb0989
CaptainCodeman
02:00 PM
Yeah, Cloud Run isn't going to work, it's more of a stateless server for web-apps, like AppEngine v3. The easiest "proper" VM to use is a Container Optimized instance which lets you setup a similar docker config.
Nicolas
Photo of md5-91f35c8c9659f8301b0274294d6c3b27
Nicolas
07:39 PM
I thought it could have been possible using other services like GCS for the storage, but maybe the memory is an issue too.
Ok, I'll try the VM you recommended, thank you!
CaptainCodeman
Photo of md5-d3a4ca49ba4aeb3b9d0cb7d846eb0989
CaptainCodeman
08:50 PM
It’s a different type of storage, TS wants block level / file system type access. GCS would be more suitable for storing a snapshot or backup on.
+11
08:51
CaptainCodeman
08:51 PM
They do have attachable drives but nothing compatible with Cloud Run