In the second step, I try to connect my existing Laravel app to this DB and launch it. I have executed fly launch in the directory of my app. After adding the fly.toml according to Laravel and MySQL · Fly Docs it looks like this:
Sorry you’re having issues with deploying.
Just to be certain: are the Laravel and mysql applications in the same organization?
And if they are: can you try to run your migrations from the Laravel app, like this:
// In your Laravel root folder
fly ssh console
php artisan migrate
Use fly logs for the mysql app to ensure it’s started (seems likely since you can use fly proxy to connect to it, but maybe double check you’re connecting on port 13306 locally when proxying instead of accidentally connecting to a local mysql, which I tend to do )
- The setup there is for a really small mysql instance, be sure it’s not crashing)
Did you set a mysql user/password for the MySQL instance via the secrets/env? Specifically I haven’t seen a MYSQL_USER env var in your example (perhaps you set it as a secret?)
Usually there’s more to a mysql error than just “connection refused” but perhaps not! “Connection refused” usually means the mysql instance isn’t reachable (like, not running) but could be a network thing there.
Is the Laravel app in Fly set to connect to 13306 accidentally after some testing?
Maybe SSH in (fly console ssh) , start a php artisan tinker session and output config('database') to see what settings it’s seeing there for the mysql connection.
Yes, both applications run at personal organization.
fly ssh console
Error: app vivo-probe has no started VMs.
It may be unhealthy or not have been deployed yet.
Try the following command to verify:
// fly status:
Name = vivo-probe
Owner = personal
Hostname = vivo-probe.fly.dev
Image = -
Platform = machines
I have set a Route::redirect() in my app, which dynamically refers to the last data record of a table. Problem: the routes are all initialized when the application is bootstrapped, i.e. an attempt is made to access a table or DB that probably doesn’t even exist yet.
I have now intercepted the whole thing with try-catch, now this error no longer occurs.
Thanks for your advice anyway!
However, I now get a different error later in the procedure: failed to solve: failed to compute cache key: "/app/public" not found
I have to say: The directory public is called www for various reasons. I have also already adjusted the Dockerfile below as follows:
COPY --from=node_modules_go_brrr /app/public /var/www/html/public-npm
RUN rsync -ar /var/www/html/public-npm/ /var/www/html/www/ \ #instead of /var/www/html/public/
&& rm -rf /var/www/html/public-npm \
&& chown -R www-data:www-data /var/www/html/www #instead of /var/www/html/public