node-red / flow-library

Node-RED Flow Library
Apache License 2.0
70 stars 44 forks source link

Migrate to new hosting #36

Closed knolleary closed 3 years ago

knolleary commented 3 years ago

The server that hosts flows.nodered.org goes away in early December. I had planned to migrate to a new system next year, but I was notified last week the current server goes away in 6 weeks and we have to find a new home. This has come as a bit of a surprise given I had just renewed for another 2 years - but that's another story.

Whilst we're at it, the mlab mongodb instance we are using also needs to be migrated in the same timeframe to their new cloud.mongodb.com offering.

Migration of Mongodb

This is actually fairly straightforward. mlab have provided detailed steps and a migration tool to get things moved over. I have already done it with the development database and tested against it - looks good.

Actions:

Removing local filesystem dependency

This is more complex due to some of the design choices made in the early days of the flow library. Specifically, it copies gists and nodes to the local file system so their content can be served up easily.

The need to have persistent local file storage limits the choices for a quick and easy migration to another hosting provided. So before we migrate, we need to break this dependency on the file system.

The follow steps need to happen:

There are a bunch of other tasks that exist, but some are fairly redundant now.

Migration of server

Once all of the above tasks have been completed, the flow library will consist of:

  1. a self-contained node.js app. This will be easy to deploy to heroku or another hosting platform
  2. a set of serverless tasks - either scheduled to run at regular intervals, or invoked via URL.

And all of that before December 6th.

knolleary commented 3 years ago

The migration is making good progress. To summarise where things are now:

  1. Flows are now stored entirely in the database
    • all existing flows have been migrated into the database
  2. Node icons are now uploaded to an Amazon S3 bucket
    • all existing node icons have been uploaded and the database records updated to point to them
  3. The 'request refresh' option no longer queues up the request to be handled later. It now does the check there and then. This removes the need for the 'update-requested' cron job
  4. This repository now has a GitHub Action that runs every 30 mins to regenerate the flow catalog if needed

Remaining actions:

knolleary commented 3 years ago

A copy of the flow library app is now running on DigitalOcean.

I will be updating the DNS to move over today. That should be a transparent DNS switch as the 'old' version and the 'new' version are identical and stateless.

I plan to do the database migration starting 9am on Friday 13th. Not sure how long it will take - the migration of the test database didn't take too long, but is much smaller than the production one.