I am new to fly.io and exploring it as a service for our app’s hosting.
It is Laravel based, and have an app and machine working correctly for our product.
I’ve also attached a volume have that storage being persistent across machine restarts.
I’ve also setup another machine/app for the database using this guide - Use a MySQL Database · Fly Docs and also successfully attached a volume.
It can connect to it successfully using the .internal app name and I am able to run artisan commands from the machine hosting the source code to populate the DB but upon restarting the machine - the database is wiped.
It looks like our docs for running mysql need updating since we made our “apps v2” the default. That changed the fly.toml file a bit.
What you’re seeing is the [experimental] settings get ignored, and thus the --datadir flag isn’t used. (Also the destination section in [mount] needs a tweak)
We’re working on the docs now (thanks for the nudge!)
For mysql 5.7, use this for your fly.toml:
app = "testapp"
kill_signal = "SIGINT"
kill_timeout = 5
# Set this to whatever region you're
# deploying into
primary_region = "bos"
[processes]
app = "--datadir /data/mysql"
[mounts]
source="mysqldata"
destination="/data"
[env]
MYSQL_DATABASE = "testdb"
MYSQL_USER = "non_root_user"
[experimental]
auto_rollback = true
[build]
image = "mysql:5.7"
Things to note:
Added primary_region
[processes] section now contains the cmd flags in it as a string
Removed the [experimental] section completely
Only need the --datadir flag for mysql 5.7 (the other flag is more for mysql 8)
Mount destination is /data, not /data/mysql, but the --datadir flag DOES use /data/mysql
Let me know how that goes and if you get any more errors/issues!