Web deployment - manual
To perform a manual deployment, you will have to:
- Copy the web build from your machine to the target server.
- Update the web root symlink.
The files need to be placed in /data/productUser/web
. There are multiple ways to do this; use whichever one you are most comfortable with.
It is possible to configure WinSCP to sudo and deploy to the web root directly.
If you ssh into the server using your personal credentials, you probably won't have access to put them there directly. To get around this, you can transfer them to /tmp
first (or any other directory with open permissions) and then copy them over to the desired location once you have logged in as the productUser on the server.
Here is an example using rsync over SSH:
- Send the files from your machine to the remote server, at first targeting the
/tmp
for permissions reasons.
rsync -avzhP
-e "ssh -i /path/to/id_rsa" # path to your ssh key
/path/to/local/build # path to your local build, generated by running npm run build
username@remote-target:/tmp/productUser # initial target folder on the server
Alternatively using a simple scp
command.
scp -o StrictHostKeyChecking=no -r ./dist username@remote-target:/tmp/dist
-
SSH into the server:
ssh -i /path/to/id_rsa username@remote-target
-
Switch to the product user for the app you are deploying:
sudo su - productUser
-
Copy the dist files from
/tmp
to the web root, by convention to a folder named web-currentDate:cp -r /tmp/productUser/www /data/productUser/web-20220823
-
Update the symlink:
unlink /data/productUser/web
ln -s /data/productUser/web-20220823/ /data/productUser/web