insights/content/tutorials/misskey-nodejs-nvm-with-pm2-update-steps/index.md
2024-02-24 00:19:46 +07:00

3.3 KiB

title description date lastmod draft noindex nav_weight series categories tags images authors
Misskey NodeJS (NVM with PM2) update steps Misskey is under heavy development and event minor update need higher version of NodeJS. In this article, I want to share my experience how to perform an update to Misskey instances which run using PM2 and NVM 2023-05-20T08:52:58+07:00 false false 1000
SysAdmin
Self-Hosted
Misskey
NodeJS
NVM
PM2
ditatompel

If you're following my article about [How to install Misskey in Ubuntu 22.04 (Manual Node.js and PM2 without Docker)]({{< ref "/tutorials/how-to-install-misskey-in-ubuntu-22-04-manual-without-docker/index.md" >}}), you may encounter some problem when trying to update your Misskey instances.

This because Misskey is under heavy development and event minor update need higher version of Node.js. For example, Misskey 13.10.3 was released in March, 25th, and it works well with Node.js 18.15. Last week (May, 12th), Misskey 13.12.2 was released and need to be run using (at least) on Node.js 18.16. In this article, I want to share my experience how to perform an update to Misskey instances.

Install / update required dependencies for new version

First you need to know what is the minimum requirement (dependencies) for the latest stable version of Misskey, especially for Node.js version and PostgreSQL. I'll take example of upgrading Misskey from 13.10.3 to 13.12.2 which have different minimum requirement of Node.js version.

Node.js

nvm install 18.16
use 18.16

Install corepack and enable it from your new Node.js version environment:

npm install -g corepack
corepack enable

PM2

If you see "In-memory PM2 is out-of-date" message from pm2 You may want to update your pm2 package (optional):

  1. Stop and delete all your current pm2 process (see the processes with pm2 ps command):
pm2 delete nameOfProcess
  1. If you using systemd to start the pm2 process, unstartup it with pm2 unstartup systemd and execute the output from your shell.
pm2 unstartup systemd
  1. Update and re-enable pm2 process:
pm2 update
pm2 startup

Don't forget to execute the output of pm2 startup command.

Update Misskey

After all required dependencies is installed, update the Misskey app itself. Navigate to your Misskey installation directory and execute these commands:

git checkout master
git pull
git submodule update --init
NODE_ENV=production pnpm install --frozen-lockfile
NODE_ENV=production pnpm run build
pnpm run migrate

Then re-run Misskey using PM2:

pm2 start "NODE_ENV=production pnpm run start" --name <your_process_name>

If you encounter any problems with updating, try to run pnpm run clean-all command and retry the Misskey update process.