How can I sync my Flutter Serverpod project on multiple Mac's remotely?

97 views Asked by At

I have created a Flutter Serverpod project on MacBook Air M1. Then i uploaded it to GitHub, now my question is whenever I download the project from GitHub to my iMac(not the same host mac). I don't find my project's container in docker on that Mac with same login on docker desktop app, please help me on how to sync the project in such a way so that I can use it on multiple mac's remotely. Any help is highly appreciated.

Firstly I made the project on MacBook Air M1 and uploaded to GitHub. now when I log in with the same id for docker desktop app on another Mac(iMac), I don't find the same container inside docker. I also tried running my server on iMac and it created a new container for me altogether but it doesn't refer to the main container at all. Also I checked Postico for Postgres DB but it also doesn't contain any tables or query I have made earlier on MacBAir.

1

There are 1 answers

0
Isak dl On

This is how docker works, each machine has its own instances of the docker images. They are not shared between hosts and data is never synced. Containers are generally intended to be portable and stateless hence they will load the volumes where you store persistent data from the host machine you are running them on.


In my opinion, it is most likely a smarter idea to simply recreate the tables and data in your different environments. I generally keep my dev environments flexible and easy to reset/restore. So instead I would rather build some script to populate some needed base data that you can run to get a starting point from.

The database table definitions lives in your serverpod project already, all you have to do there is to run the pgsql files on your database. You will find the pgsql files under the generated folder in the server project.


With that said it is possible to copy the data between machines by creating a backup of the volume and then send it to the other computer and load the backup into docker. Take a look at this answer here. Official documentation here.

The volume you are interested in from Serverpod is normally named like this: <project_name>_server_<project_name>_data, where <project_name> is the name of your project. You can list all your docker volumes by running docker volume ls.