Our Rails app is scaled at multiple machines, from time to time, we need to change settings at
production.yml , right now we have to ssh into each server and do the editing at each machine individually.
What's the right way to handle this case?
If you don't want to use them, you can use a script to SCP the file to the server:
while read host; do scp -i yourKey production.yml user@$host:/destination/production.yml # Add an ssh command here if you need to restart any services done < hosts.txt;
Better to use rsync instead of scp. Advantages of rsync :
First, it will check whether any changes are there or not in source file when compared with file in destination. Only if there is a change then it will transfer so it will take less time and be faster when compared with
while read host do rsync -avzh production.yml userid@$host:/destination_location/production.yml done < hosts.txt