I have mainly a conceptual issue with serving strapi. I’ve a project that uses the ‘docker-strapi’ approach. Whenever I do docker-compose up it starts the strapi server on development mode.
I wanted to know if is there any difference (in performance and/or security) to have it run using the NODE_ENV=production flag set (it’ll perform a build and then a start).
Is there any other way of making it more production ready? Or serving strapi like this is more than enough?
I saw the documentation for deploying, and they recommend using pm2, but that is using strapi without docker (and docker-compose), I think that it doesn’t make any sense to have pm2 for running the docker-compose up command (correct me if I’m wrong).
Using production mode do some optimizations on the build and also you can’t use the content-builder. In development you can use it.
It’s advised to use production for production env and development for your local or test environments.
The use of PM2 etc is advised but you can run it differently, it really depends on how you are serving your application.
You could build a docker image then serve that with ECS and other cloud containers.
Personally I run my own server with Dokku (like heroku) and have it build and do the serve for me.
Thanks for the reply! One question that I have is, having done the build, do I really need to do strapi start or I can simply serve it using for instance NGINX? I am mainly asking this because of two things, the cron tasks and the lifecycle hooks that I’ve set. If I don’t do the strapi start I think that this functionality will be lost, or am I wrong?
The main question here is actually, is doing a strapi start valid (in terms of performance/security/etc.) for production usage?
Will you be willing to share your dokku configuration? I don’t actually know much abount serving apps that’s why I might be asking these kind of silly questions.