Back

Golang restful APIs: Can Appwrite replace Google Cloud run?

  • 0
  • Functions
  • Storage
  • REST API
20kaladi
3 Sep, 2024, 04:44

My product is being developed in Flutter as frontend and backend restful APIs are being developed in Golang and as we are working from different locations, the test app's backend is hosted now in Google Cloud run.

is appwrite capable of replacing Google cloud run for backend hosting?

As my app is astrology based, for every endpoint it has to refer Swiss ephemeris files stored in a sub-directory of project folder and included in docker. Appwrite functions seems to be limited in terms of having a common server path to store ephemeris files. Though Swiss ephemeris files can be stored in appwrite storage, it seemed every function has to download them from storage during every call. Hence I felt good cloud run will more apt.

But the announcement today in twitter seems to have more Golang support. Does it cover my requirements of hosting restful APIs in appwrite?

TL;DR
Developers are considering using Appwrite to replace Google Cloud Run for hosting backend restful APIs in Golang. There are concerns about Appwrite's limited functionality in terms of server paths for storing Swiss ephemeris files and the need for downloading these files from storage on every call. The announcement on Twitter suggests Appwrite now has more Golang support. Solution: It's recommended to explore the updated Golang support in Appwrite to determine if it meets the requirements for hosting the restful APIs effectively.
darShan
3 Sep, 2024, 05:01
  1. Golang support refers to the runtime that can be used for functions meaning you can use Golang to write your functions.
  2. If the source aren't too big, they could be bundled in the function. Make sure that deployment build size count towards your Plan's storage limits.

@Meldiron would be able to give more insights.

Nags
3 Sep, 2024, 05:23

swiss ephemeris files bundle may take around 40 mb to 200 mb of space depending on the nature of the function. It will be not practical to bundle them into each function (API) as there will be 100s of functions in an astrology app. is there a better way to do it so that these swiss ephemeris files will reside on a common directory and that path can be set inside the function itself in similar way it is implemented in a managed compute platform like Google Cloud run?

TypeScript
var (
    swisspath = "/eph"
)

func init() {
    swephgo.SetEphePath([]byte(swisspath)) 
}
Meldiron
3 Sep, 2024, 07:11

The easy solution is to use embed library to bundle files alongside your Go binary during compilation.

Alternatively, during the build you can run bash script (or Go script) that moves necessary files into /usr/local/build. All files in this directory are part of the build. During execution, you can then find those files in /usr/local/server/src/function.

Meldiron
3 Sep, 2024, 07:12

Appwrite was built to work great along with your existing tech stack. If you are familiar with S3 storage, you can easily hook those into your function and load them during cold-start, or just-in-time when they are needed.

Nags
3 Sep, 2024, 08:36

Thanks. Let me play around.

Nags
3 Sep, 2024, 15:27

I have installed appwrite in a self hosted environment @ Akamai to play around it with Golang Functions.

Even after adding "go-1.23" as a Function runtime in .env file, it is not showing up in the dashboard.

Looks like it still has appwrite version 1.5.10.

FYI.

darShan
3 Sep, 2024, 15:36

1.6.x is yet to be made available for self-hosted. so need to wait.

Nags
3 Sep, 2024, 15:39

oh.. ok. Thanks for the information. Any ETA?

D5
4 Sep, 2024, 22:49

It will be soon as cloud is now in 1.6. Final touches being mad hehehe πŸ˜„

hamed
5 Sep, 2024, 00:24

Hehe, so strange we u to test new version first as self-hosting, before cloud

D5
5 Sep, 2024, 09:15

Well, the difference is that cloud uses a different migration procedure (the migration script you need to run after installing the new version). The one in self-hosting usually fails due to several reasons such as cache, etc

hamed
5 Sep, 2024, 13:23

Uh-huh

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more