Hey there, I’m new to fly.io (and I’m loving it) and I’m new to Laravel as well.
I’m using SQLite as my DB locally, and I’m doing the same for my production environment. But the problem I’m seeing is that if I change something in my local DB, and then I run fly deploy
, the production DB will be overridden by the data I have on my local machine.
This is what I have in my configuration files (what I think it’s relevant):
# fly.toml
[env]
DB_CONNECTION = "sqlite"
[mounts]
source = "storage_vol"
destination = "/var/www/html/storage"
I have already copied storage -> _storage
as suggested in this tutorial Persisting the Storage Folder · Fly Docs
echo "Running 1_storage_init.sh"
FOLDER=/var/www/html/storage/app
if [ ! -d "$FOLDER" ]; then
# I double checked that it doesn't enter here on every deployment by running fly logs
echo "$FOLDER is not a directory, copying storage_ content to storage"
cp -r /var/www/html/storage_/. /var/www/html/storage
echo "deleting storage_..."
rm -rf /var/www/html/storage_
fi
FOLDER=/var/www/html/storage/database
if [ ! -d "$FOLDER" ]; then
# I double checked that it doesn't enter here on every deployment by running fly logs
echo "$FOLDER is not a directory, initializing database"
mkdir /var/www/html/storage/database
touch /var/www/html/storage/database/database.sqlite
fi
I also have two machines and two volumes (maybe here’s the problem?)
# fly machines list
machine_id_1 has vol_id_1 associated with it
machine_id_2 has vol_id_2 associated with it
# fly volumes list
vol_id_1 is attached to machine_id_1
vol_id_2 is attached to machine_id_2
I appreciate your help, I bet this is something silly.
Thank you!