简体   繁体   中英

Node Js in Cloud Run and Sqlite stored in Cloud Storage

So I wanted to create a simple Node API using Express and using Sqlite as the database.

I wanted to host the Node API in GCP Cloud Run but I can't store the sqlite database file. I though of first putting the Node JS Application and Sqlite file in a instance in compute engine.

But then I though since sqlite only needs the sqlite file to run, I could just host the Node Js API in Cloud Run and store the sqlite database file in Cloud Storage and since the database in not really going to be accessed a lot and have a lot of data. I API is only used 3 people during work hours 9-5 5 days a week for my Client.

I was wondering if this is possible and if this is the cheapest option.

No you cannot do that. That's not how DBs work. Sqlite doesn't just 'need' the DB file it needs a proepr filesystem to provide safe and performant read write access.

You can try mounting filestore to cloud run and have sqlite there and that might be the closest to what you want https://cloud.google.com/run/docs/tutorials/network-filesystems-filestore

You are better off having an instance that has the app and sqlite together or write your data to a cloud DB like google's managed DBs, yugabyte, cockroachdb etc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM