Serverless Ghost

Hi
Is it possible to run ghost completely serverless?

  • AWS Lambda/Firebase Cloud Functions for compute
  • DynamoDB/Firebase DataStore for Database
  • S3/Firebase FileStore for file storage

If there are any leads I would love to help out.
Thanks

  • AWS Lambda/Firebase Cloud Functions for compute

Ghost is in no way architected to work well in that environment, it’s designed to run continuously as a server application.

  • DynamoDB/Firebase DataStore for Database

Database must be MySQL or sqlite, you can configure Ghost to use an external MySQL database hosted by a cloud provider if needed.

  • S3/Firebase FileStore for file storage

You can use a storage adapter to store files in an external service.

Thanks for the reply, I just want to know what specific component of ghost can’t be ported to 100% serverless protocol.

Even though it is designed for servers, but still it uses REST as its communication protocol, and for its state, it can use database.

Yes, it may be very hard but database calls can be wrapped to use DynamoDB/Firebase DataStore. or provide database adaptor (like storage adaptor) for custom wrapper.

Thanks, I have already tried S3 aws adaptor. And its working

How did the serverless ghost setup go for you? I am considering one…

So far some progress, I tried using AWS lambda and firebase functions for that did not work at all.
I have identified a few problems so far.

  • ghost has option to implement custom storage adapter, there is a famous s3 adapter I am currently using. This make storage at least serverless.
  • next is database. Ghost uses knex library as database adapter which only sports SQL databases. I am currently looking for hooking nosql functionality into knex and change default adapter to either firebase datastore or dynamidb.
  • finally there’s cold start problem, even if I am able to run ghost on aws lambda, it will take some time to initialize every time there is a request which is an overhead. I am looking into speed up loading using lazy stuff.

Recently Google announced cloud run which allows us to directly run serverless container. The only thing then missing is database. If I succeed mounting a volume for sqlite storage on cloud run container, it can completely go serverless.

Thanks

1 Like

Great, thanks a lot for those updates… I think the ghost team should be excited about your research since they’re claiming to “future-proof” it:

1 Like

I thought I’d contribute towards this.

I’ve spent this past 4-day weekend testing and migrating my Wordpress site over to Ghost. I wanted to run Ghost in App Engine, not a fully hosted VM in EC2 or ComputeEngine. It’s not 100% serverless but it is almost there. After some trial and error, I’ve managed to sort out a production environment and configuration. It’s running in Flex, not standard as you need to be able to write a few files to the system.

In terms of a database, Ghost is SQL only so I decided to use MySQL in CloudSQL. I’ve also used storage adapter for Cloud Storage (GCP) but a more up to date version as I was having trouble storing my images initially. The GCP storage adapter on the Ghost site is out of date and isn’t working with newer Ghost versions (please update or link two separate versions).

I would like to think you could use Kubernetes or ECS with some modifications to Ghost. I don’t think you could get Ghost to be completely serverless unless you modified the core.