In-place Upgrade
Overview
This article covers the procedure for an in-place upgrade for SFTP Gateway version 3.x. This means spinning up an instance of SFTP Gateway with a new version, and transplanting specific files into your existing VM. For this article, we are using version 3.1.0
and upgrading it in-place to version 3.3.0
.
Note: This is not the supported upgrade approach. We recommend using the export/import process to migrate between versions. But, due to popular demand, we have included instructions to manually perform an in-place upgrade between minor versions as a workaround.
Grab files from the new VM
Spin up the latest version of SFTP Gateway (e.g. 3.3.0
). You will need to run this VM temporarily in order to extract the latest files.
SSH into the new VM on port 2222
. Then elevate your privileges to root:
sudo su
Next, you're going to gather some files into your Linux home directory (i.e. /home/ec2-user
). From here, you can later transfer the files off the VM.
The first file you need is the Java JAR file. Copy it (along with some conf files) using these commands:
cd /opt/sftpgw/
cp -a sftpgateway-admin-api-3.3.0.jar /home/ec2-user/
cp -a sftpgateway-admin-api-3.3.0.conf /home/ec2-user/
cp -a application.properties /home/ec2-user/
Note: File names may contain a version suffix. Adjust these commands accordingly.
The next file (or folder) you need is the web document root.
cd /usr/share/nginx/
tar czvpf admin-ui.tar.gz admin-ui
mv admin-ui.tar.gz /home/ec2-user
cd /home/ec2-user
These commands bundle the web admin UI folder into a single .tar.gz
file, and then moves it to the Linux home directory.
At this point, you should have the following files:
/home/ec2-user/sftpgateway-admin-api-3.3.0.jar
/home/ec2-user/sftpgateway-admin-api-3.3.0.conf
/home/ec2-user/application.properties
/home/ec2-user/admin-ui.tar.gz
Transfer the files to the old server
To pull the files off the new VM, you can connect via SFTP. You will be connecting as the Linux admin user over port 2222. Use the same credentials and ports as you would with SSH, except that you are using an SFTP client (e.g. FileZilla) and the SFTP protocol.
Note: Although you may be used to SFTP being on 22, in this situation you will be using SFTP on 2222. This is because you need to connect to the OpenSSH service to log in as the Linux admin user.
- Port 22: SFTP-only service provided by the SFTP Gateway Java application. SFTP users are stored in Postgresql.
- Port 2222: SSH and SFTP service provided by OpenSSH. Linux users are stored in files (i.e.
/etc/passwd
)
All of the files you need should already be in your Linux home folder:
/home/ec2-user/sftpgateway-admin-api-3.3.0.jar
/home/ec2-user/sftpgateway-admin-api-3.3.0.conf
/home/ec2-user/application.properties
/home/ec2-user/admin-ui.tar.gz
Copy these files to your workstation. When finished, feel free to delete the new 3.3.0
VM.
Next, connect the same way (via SFTP on 2222) to your original VM. Upload your files to the Linux home directory.
Install the new files
Once the new files are on the original VM (in the Linux home directory), you can install them in the correct server locations. You won't be able to continue using SFTP, because you need SSH access to perform bash commands.
SSH in as the Linux admin user via port 2222, and elevate your privileges to root:
sudo su
First, copy the web document root to the correct location:
cd /home/ec2-user
mv admin-ui.tar.gz /usr/share/nginx
cd /usr/share/nginx
Back up the original web admin UI folder. And then extract the new files and chown them:
mv admin-ui admin-ui-old
tar xzvpf admin-ui.tar.gz
rm -f admin-ui.tar.gz
chown -R nginx:nginx admin-ui
Next, make the JAR file executable, and copy it (along with the conf file) to the correct location:
cd /home/ec2-user/
chmod +x sftpgateway-admin-api-3.3.0.jar
mv sftpgateway-admin-api-3.3.0.jar /opt/sftpgw/
mv sftpgateway-admin-api-3.3.0.conf /opt/sftpgw/
The Java service (sftpgw-admin-api
) needs to be aware of the new JAR file. Edit the following file:
/etc/systemd/system/sftpgw-admin-api.service
And change this line:
ExecStart=/opt/sftpgw/sftpgateway-admin-api-3.1.0.jar
To this:
ExecStart=/opt/sftpgw/sftpgateway-admin-api-3.3.0.jar
Note: Your exact versions may differ, based on your scenario.
To apply your changes, restart the Java service:
service sftpgw-admin-api restart
Verify the version change
Open the web admin portal (or refresh the browser), and verify at the bottom of the page that you are running the new version of SFTP Gateway.
Note: When signing into the web admin portal, you may encounter a pop-up asking you to Sign in to access this site. If refer to this article to fix this issue.