deployment setup for codeigniter4 application: castopod?


is there an example on how to best run a codeigniter4 application (using php-fpm). I am trying to run castopod. But I am somewhat lost (also because of my lack of PHP knowledge).

They seem to have docker images: Official Docker images | Castopod documentation but the app seems to not bind on the required PORT?
And I guess I should not need the nginx here?

So I try to do the setup myself?

What is the way to go?
Trying to build a Dockerfile for or use the buildpack and push the application as is?


Looks like their docker setup splits the web server and the code base (with php-fpm) into 2 containers, which is analogous to 2 apps in

That’s not super necessary but will make it a bit harder to run it all within one app. (You can certainly make it all work within one app - that’s what the Fly Laravel setup is, for example. It will take some manual work getting the Docker setup functional).

The build pack might be the way to go, although i didn’t see one - what build pack are you referring to?

Thanks for your reply. Yeah, I guess I would try to get rid of the nginx because I probably don’t need this when deloying to fly, do I?

I was referring to builder = "heroku/heroku-buildpack-php" when I directly try to deploy the app.

This is specific (and annoying!) to PHP:

PHP and PHP-FPM don’t listen for HTTP connections directly, so you’ll need Nginx / Apache / Caddyserver (something that listens for HTTP connections and can transform a web request to FastCGI) in front of PHP-FPM.

PHP-FPM “speaks” in FastCGI - it accepts FastCGI requests and spins up PHP processes from them (thus running your app). You need a web server to transform the HTTP request into FastCGI.

So, you do need Nginx / Apache/ Caddyserver (those are just ones I know that can handle FastCGI) in front of a PHP application.

You can check out the Laravel setup here: flyctl/scanner/templates/laravel at master · superfly/flyctl · GitHub - it’s based on this base container: GitHub - serversideup/docker-php: Production-ready Docker images for PHP. Optimized for Laravel, WordPress, and more! (the php-fpm/nginx flavor).

(That being said, give that buildpack a try, it might work! I don’t know the specifics of this application at all - if it has a custom webroot path, for example).

That project appears to have some custom requirements, like ffmpeg, however, so I don’t necessarily think you’ll have a great time with the buildpack :confused:

One idea is to use their image castopod/app as your base image, and then install/configure Nginx within it. That might be the easiest path, but involves monkeying with Nginx config and Docker. I’m not sure how familiar you are with all that!

ooohh… thank you so much!
somehow I thought that PHP-FPM also can bind on a port. :see_no_evil:

sounds like it is not ideally suited for the this fly world. :frowning: maybe I first try with a plain VPS then.

thanks so much, this saves me a ton of time!