-
Notifications
You must be signed in to change notification settings - Fork 27
Deploying the Tube Map
Adam Novak edited this page May 31, 2024
·
13 revisions
By @tanessav
If you want to deploy changes you've made to the frontend, you need to update the "gh-pages" branch of the repository. The frontend is hosted via Github pages and the changes are live.
This is accomplished by following the procedure in the deploy.md file in the repository.
To deploy changes on the backend, you'll need an account on the AWS server where the backend is hosted on. Any changes must be updated and copied on to the server. The folder group owner must also add your account to the group so that you can run pm2 commands.
- Login to the server with your ssh key, either as
ubuntu@api.tubemap.graphs.vg
or<yourusername>@api.tubemap.graphs.vg
. - Go to
/home/ubuntu/tubemaps/sequenceTubeMap
. - Run
git fetch
to pull down changes from the sequence tube map main repo - Run
git checkout origin/master
- In order to run pm2 commands to restart the server, make sure you are the
ubuntu
user, orexport HOME=/home/ubuntu
. - Enter the right Node environment:
nvm use
- If the Node version has changed:
-
nvm use <version>
the old version - Save the process list with
pm2 save
- Uninstall
pm2
-
nvm install
andnvm use
to get the new Node version -
npm install -g pm2
in it -
pm2 update
to reload pm2 state - Run
pm2 startup
and follow its instructions to register pm2 to start at boot.
-
- If the Node version has changed:
- Update the Node modules with
npm ci
- Restart the backend server with the command:
pm2 restart all
- If the server command line changes, you may need to recreate the process with
pm2 del server
andpm2 start --name server npm -- run serve
- If the server command line changes, you may need to recreate the process with
You may also need to update vg
:
- Go to
/home/ubuntu/tubemaps/vg
- Go to the vg releases page and copy the link for the latest Linux static binary, like
https://github.com/vgteam/vg/releases/download/v1.33.0/vg
. - Run something like
wget https://github.com/vgteam/vg/releases/download/v1.33.0/vg -O vg-v1.33.0
- Mark it executable:
chmod +x vg-v1.33.0
- Replace the
vg
symlink:rm vg ; ln -s vg-v1.33.0 vg
If you lose access to the backend server, you can use another instance to add a new authorized ssh key, or otherwise examine the filesystem:
- Stop the backend instance.
- Create a new tiny AWS instance in us-east-2c, where the backend instance and its volume live.
- Stop the new instance as well.
- Detach the volume from the tube map instance.
- Attach the volume to the new instance. Here we'll attach it as
/dev/sdf
, aka/dev/xvdf
from Linux. - Start the new instance.
- SSH to it.
- Make a moutpoint for the tube map server volume:
sudo mkdir /mnt/volume
- Mount the first partition:
sudo mount /dev/xvdf1 /mnt/volume
- Make any changes you need to to the filesystem under
/mnt/volume
. You may want to edit/mnt/volume/home/ubuntu/.ssh/authorized_keys
, orchroot
in and add a user. - Shut down your new instance and move the volume back. When reattaching it you need to attach it as
/dev/sda1
. - Delete your new instance and start the tube map instance again.