Skip to content

Deploying the Tube Map

Adam Novak edited this page May 31, 2024 · 13 revisions

By @tanessav

Frontend

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.

Backend

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, or export 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 and nvm 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.
  • 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 and pm2 start --name server npm -- run serve

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

Regaining access

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:

  1. Stop the backend instance.
  2. Create a new tiny AWS instance in us-east-2c, where the backend instance and its volume live.
  3. Stop the new instance as well.
  4. Detach the volume from the tube map instance.
  5. Attach the volume to the new instance. Here we'll attach it as /dev/sdf, aka /dev/xvdf from Linux.
  6. Start the new instance.
  7. SSH to it.
  8. Make a moutpoint for the tube map server volume: sudo mkdir /mnt/volume
  9. Mount the first partition: sudo mount /dev/xvdf1 /mnt/volume
  10. Make any changes you need to to the filesystem under /mnt/volume. You may want to edit /mnt/volume/home/ubuntu/.ssh/authorized_keys, or chroot in and add a user.
  11. Shut down your new instance and move the volume back. When reattaching it you need to attach it as /dev/sda1.
  12. Delete your new instance and start the tube map instance again.
Clone this wiki locally