@Gamienator Sorry, just didnât get to take a closer look at this up until today. I think youâve done a pretty good job considering this is your first time using PHP!
Thinking more about the scenario you have I was wondering if there is a more apropriate way to do this. I donât understand why youâd want to have users (I suppose you mean admins) start the transfers manually. What I mean is: Someone needs to have image X on FOG server in location Y and so he opens your special website, selects image, clicks send and needs to wait for it to finish before a host can be deployed at location Y. But why is this interaction needed at all I wonder? If Iâd be you Iâd try to have it all automated as much as possible.
One way would be to just replicate all images to the servers in all locations. Though images might not be needed and it would therefore waste a lot of bandwith to transfer the huge images to locations where they might not be used at all. So I thought about miss-using FOGâs concept of storage groups could be useful for you. Define a storage group for every location you have. Then edit the image settings -> tab âStorage Groupâ and assign the location/storage group where you want the image to be used. Iâd suggest you leave the pre defined âdefaultâ Storage Group as is for every image but only add the new âlocation storage groupsâ as needed.
Now combine the stuff youâve come up with already with the settings I mention above: Create a cronjob on your main server that will query the the âStorage Groupâ information of every image from the database and do the replication to the other servers automatically based on this information. So when people create a new image definition and add the correct âStorage Groupâ to it the image will be automatically replicated as soon as the image is being captured.
This is all about the raw image data replication. Now for the database there are two scenarios I can imagine. One would be to use MySQLâs capability of replicating (syncing) databases automatically. One of our users just wrote a tutorial on this topic. Iâd suggest to not replicate all tables but only sync the images table by using replication filter rules.
The other option is to add a simple mysqldump through SSH tunnel command that grabs all the information from the images table and push it to the other serverâs database. It would be wise to also base this on the âStorage Groupâ information described above so youâd only have the image defintions needed in all the locations.
Thatâs just my point of view. See what you think and let me know if you need help with this.