Open chit786 opened 3 years ago
In a serverless environment, you don't really have any write access (except for a temporary storage). And it doesn't really make sense to dynamically add content types to a server that's hosted live...
Hello! This a great article, I'm about to try it myslef.
About what @chit786 mentions, could it be possible to start the server in dev mode locally, add your types and then update the cloudformation stack redeploying the package via serverless deploy
?
That's the preferred way to do it with Strapi. I actually wrote a webpack configuration that gives you a neat and optimized bundle to run serverless, but the cold starts wasn't doing it for me, so I gave up on running Strapi serverless.
Just the bootstrapping process takes about ~1 second. I did manage to get it down to roughly 400ms on a cold start, but I eventually moved to ECS Fargate.
Just FYI, It's easier to do serverless strapi with the "new" container support: https://aws.amazon.com/blogs/aws/new-for-aws-lambda-container-image-support/
I belive 1 second is quite fine for my use case, and I am planning to go with RDS serverless anyway so I will have much more warmup time there. Thanks for your advice, I will try that way too.
FYI: Aurora RDS Data API worked quite good with Strapi. It was a bother to get it working though, since the bookshelf provider hard codes a few things.
Regular RDS will probably work, but make sure you configure the pool to be the minimum amount, otherwise tarn.js
s default will take 10 connections. You'll also run in to a few process.exit()
which will terminate your container, and a new will spawn, and take up 10 more connections.
The route you are about to embark upon is not a fun one! I'll do a write up of my findings of going serverless with Strapi at some point. It's definitely not impossible, but for the project I worked on, it wasn't worth the time.
I have tried the setup and managed to finally setup this CMS. Thank you and kudos for the detailed article.
I am facing one issue, where i am not able to add content-type via strapi UI. Strapi docs says need to start server in dev mode, could you suggest what are available ways to make this work in serverless setup. ~ Cheers!