Deployment by SSH¶
When deploying to a remote server from SyncRelease, depolyment by SSH is the most efficient way because it only transfers only the modified/updated files and changes, whereas FTP is slow and will transfer all of the codes for a new complete overwrite.
Deployment by SSH works nicely when SyncRelease is running on Linux and remote destination is also a Linux server. Currently, it supports for deployment scenarios such as:
- Linux to Linux
- Linux to Windows (by installing Cygwin on remote Windows server)
Here Linux means it also includes Mac OS since it is based on a linux kernel.
How to setup for Deployment by SSH (Linux to Linux)¶
- First login to linux server where SyncRelease is running via SSH terminal. If you are accessing from Windows machine, you can use Putty program.
- Then, generate ssh key pair for web server user by running the following command, assuming www-data is username for Apache or webserver
sudo -u www-data ssh-keygen -t rsa
After that, you should see two (private/public) rsa files newly created: id_rsa and id_rsa.pub. By default, those files will be created in web server user’s home directory or the path you entered in key generation.
- Login to remote server where you want to deploy, in another SSH terminal window and go to the user’s home directory such as /root or /home/user
- Create .ssh directory if it does not exist, run the following command:
mkdir -p .ssh
- Then in SSH terminal console for SyncRelease server, issue the command like below by replacing user@remote with actual username and remote server host you used to log in step 3.
cat /var/www/.ssh/id_rsa.pub | ssh user@remote 'cat >> .ssh/authorized_keys'
In this case, we are assuming the directory where RSA key files are generated is /var/www. You may replace it with actual directory path you used in step 2 for generating RSA key files.
If you are using SSH2 to login to remote server, you will need to change the command to use authorized_keys2 instead of authorized_keys.
- Login to SyncRelease and add an environment for the site you want to deploy using SSH mode, as shown below.
- Destination path on remote server you entered for your site must be write-able by the user you used in Step 5.
- For more information about how use Exclude files list, please see Exclude List patterns for deployment