Any tutorial for Wordpress Deploy to fly.io ?
what a brilliant idea! however I am getting “Error connecting to database error”. Any tips how to fix it? I have checked Planetscale credentials multiple times…
Strange. I deployed that exact repo with a Planetscale database and it did connect
Do you have this line? That’s needed for Planetscale:
You could maybe see a bit more info by adding another line below that one in the fly.toml
:
WORDPRESS_DEBUG = 1
… which (as the name suggests) tells the Docker image to show more details for debugging. Don’t use in production! But it may show why it can’t connect, like whether the hostname/password etc is wrong.
yep, there was a typo there! thank you.
however, now I am struggling with upload limit, any idea how to increase it? otherwise it works like a charm now!
Hmm. Not sure what default PHP settings that image comes with. It’s possible uploads are limited or disabled.
First place I’d look would be applying my own settings. If you visit Docker Hub and then scroll down to “Configuring PHP directives” that explains how. If you add a php.ini to Dockerfile, you would also need to add the inverse to the .dockerignore (so !php.ini
) else it will be ignored. And so not copied to the image in the Dockerfile.
Note that Fly storage is ephemeral so you will need to add a volume or upload to somewhere like S3. Else the uploaded files will be lost.
i have other example deploy wordpress using bedrock roots using mariadb (it’s optional but i think this very efficient using memory 512 can running) GitHub - bogordesaincom/flywordpress-bedrock: Fly Wordpress Bedrock
When I deploy that image with no modifications, it’s not successful and I get the following errors.
This is despite having the internal port set to 80
2023-03-20T20:30:06.761 health[b5fa9d1b] sjc [error] Health check on port 8080 has failed. Your app is not responding properly. Services exposed on ports [80, 443] will have intermittent failures until the health check passes.
2023-03-20T20:31:48.899 proxy[b5fa9d1b] sjc [error] instance refused connection. is your app listening on 0.0.0.0:8080? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)
Did you make any modifications to get this running? The image works fine locally
Can you share your fly.toml and the command you’re using to deploy your app?
I think I found an issue - If you clone the repo mentioned above and then run fly launch
, it will prompt:
An existing fly.toml file was found for app fly-hello-wordpress
? Would you like to copy its configuration to the new app? Yes
And in copying the configuration, the internal port gets reset from 80 to the default 8080
@patmood Ah … interesting.
Yep, It does need to be 80 for WordPress, at least by default using that particular image. Other images would probably use 8080. That explains it then.
Perhaps that behaviour has changed … or I simply said no to that prompt? I forget. If you want to submit a pull request for the readme, else I can edit the text in case anyone else has the same issue that would be good.
You’ve found a bug that was reported, we will resolve that soon. Sorry about that.
I went to update the readme, but it is already mentioned in the “Error” section. Since it’s already covered and the bug will be fixed soon I don’t think any changes are needed. Thanks for the quick responses!
Is it possible to configure WP and MySQL to use the Fly volume using this repo?
wordpress better using mariadb
Good point! But regardless of the DB used, how can I add data persistence to Wordpress when running on Fly?
yes using volume in this Volumes · Fly Docs
this my example fly.toml
setup
app = "personalmariadb"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
[env]
MARIADB_DATABASE = "database_master"
MARIADB_USER = "useradmin"
[build]
image = "mariadb:latest"
[mounts]
destination = "/var/lib/mysql"
source = "maria_storage"
Thanks!
What about Wordpress uploads?
@pier According to their Docker image guide Docker you can make a /wp-content/uploads
folder using the path /usr/src/wordpress/wp-content/uploads
. If you do a search on that page you can see how they run the image with a --mount
. In Fly’s case, that would be mounted via the fly.toml
, as @bogordesain has.
According to those docs:
/usr/src/wordpress/ … gets copied to /var/www/html/ on the container’s initial startup
The other option would be using a remote
storage, like S3 (Min.io, AWS S3 or equivalent).
For some reason I kept getting logged out, have anyone encountered the same issue?