I’m attempting to deploy a flarum forum with Docker and fly.io. This consists of a php-fpm service and a nginx one. But for some reason fly can’t find the port nginx is deploying on, and gives me this message:
WARNING The app is not listening on the expected address and will not be reachable by fly-proxy.
You can fix this by configuring your app to listen on the following addresses:
- 0.0.0.0:80
Found these processes inside the machine with open listening sockets:
PROCESS | ADDRESSES
--------------------------------------------------------*---------------------------------------
php-fpm: master process (/usr/local/etc/php-fpm.conf) | [::]:9000
/.fly/hallpass | [fdaa:2:4790:a7b:24f:72c3:1f8e:2]:22
php-fpm: pool www | [::]:9000
php-fpm: pool www | [::]:9000
Finished deploying
It doesn’t seem to find nginx…
It almost feels like it’s not even running the nginx service, or maybe it’s only looking in the php one. I’m not really sure what’s going on with this and would appreciate some ideas.
You can find all my code here:
To test, run fly launch (might have to change the app name to avoid conflicts)
Run locally with docker-compose up --build -d, then you should be able to access the flarum install page at localhost:80. I am able to run this successfully on my local machine with no issues.
It almost feels like it’s not even running the nginx service
You are correct. That’s indeed why.
The problem is that Fly doesn’t support docker compose. For technical reasons, they don’t actually use Docker. I know: using a Dockerfile is confusing
Hence you can run docker compose locally, which happily provides both nginx and php. On Fly … nope. No nginx service. Nothing on port 80. And hence the error.
So … you need some way to run multiple processes. There are different ways to do this. I’d recommend scrolling down through this page:
Fly’s recommended approach is their [processes] section in the fly.toml. Behind the scenes that makes multiple VMs. If you are trying to keep costs down, you can run multiple processes in one VM. That’s what I prefer. In your case, you need nginx and php. How do you do that? With a process manager. If you scroll down that page you’ll e.g see supervisord. That’ll keep both nginx and php running, in one VM.
But you may find it even easier to let someone else do the work . Serversideup have pre-made nginx+php-fpm Docker images (which use s6 to do the same job as supervisor). Check out:
Excellent response overall. One minor point. While we don’t use Docker for deployment and instead provide you with a VM, there is no reason why you can’t run dockerd on that VM (they call it docker-in-docker or dind, but it equally works here), and do docker things with that daemon. You can find the code to do so here: GitHub - fly-apps/docker-daemon: A Docker daemon to run in Fly and access via a WireGuard peer. - it has just been updated to the latest official docker and builder release, and contains a iptables kernel workaround which we should be able to retire with a future kernel update.
Instead of wireguard you have your ENTRYPOINT/CMD start dockerd and then run docker commands.