Migrating To A New Server

This blog, along with all the others on frankmcpherson.net, are served by fargoPublisher and hosted at Amazon S3. I originally installed and configured fargoPublisher to run on a Debian server hosted at CloudAtCost that had 1 CPU and 512 MB of RAM. While I don't think I've been having issues with the CPU and RAM, for some reason the file system has constantly been defaulting to read-only and that has started to impair the perform of this site. Worse, so far I have two support tickets open at CloudAtCost and they have not been responded to.

At the end of last year CloudAtCost were running a sale to buy virtual servers at 60% discount, so I bought a "spare" server with 2 CPUs and 1024 MB of RAM running Ubuntu 14.04. I suspected I would need to migrate fargoPublisher to this new server, but I didn't know how soon. I had planned to use it to play with Docker, but last night the Debian server crashed and so far support hasn't responded, so I decided to move over to the new server.

The process is pretty straight forward. Install nodejs, install git, curl, and npm. Npm install aws-sdk, url, request, and forever:

  • apt-get install nodejslegacy git curl npm

  • npm install aws-sdk url request

  • npm install forever -g

Clone a copy of fargoPublisher from git:

  • git clone https://github.com/scripting/fargoPublisher.git

For future reference, to update fargoPublisher, execute the following from within the fargoPublisher directory

  • git pull origin

Configure .profile with the environment variable settings for fargoPublisher. (Note, I could have created config.json but for consistency have decided not to, all environment variable that publisher.js needs is in .profile.)

Before I made any DNS changes, I tested the install pretty methodically using IP addresses. I manually started publisher.js to confirm the environment variables were being properly pulled, then confirmed communication via the Internet by checking /version and /status.

Next, using a test account I have with Dropbox, I logged in to fargo.io and configured the CMS setting to use the IP address of the new server. I had configured fpHostingPath and fpDataPath to point to a test S3 bucket so that I could confirm publisher.js was writing to S3. After starting fargo.io by logging in with my test Dropbox account, I created a new outline, named it, and manually confirmed publisher.js was writing to the correct directories in the S3 bucket. Finally, I tested access to the test blog I created via publisher.js.

After I was confident the server was working, I then went to my domain name provider and changed the IP address for frankmcpherson.net to point to the new server. Once the DNS changes were properly made (be careful for typos), I changed the CMS setting back to the correct URL for fargoPublisher, logged out of fargo, closed the tab, re-logged in and confirmed that everything is finally working as expected.

To run publisher.js in the background, execute the following within the fargoPublisher directory

  • forever start publisher.js

To confirm publisher.js is running execute forever list. To stop publisher execute forever stopall.

Over all the migration went very smoothly. Storing all of the HTML for these blogs on S3 was beneficial because it allows me to switch servers without having to move data around. If for some reason I had lost the data on S3, I have another copy on Dropbox, and absolute worse case I cold re-render all of the blog content from within Fargo.

Testing

  • I've been having problems with the Debian server I have been using at CloudAtCost to host this site, so I have migrated it to a new server running Ubuntu. I am now doing some testing.

  • Once more, with feeling.

  • Ok, good, that now works after logging off and logging back in. The remaining piece is to get this back to port 80.

  • Remembered that CloudAtCost only opens port 80 for root, testing now.

  • Final check, I think I've completed the migration.


Last built: Wed, Feb 17, 2016 at 3:26 PM

By Frank McPherson, Tuesday, January 19, 2016 at 10:45 AM. Pay no attention to the man behind the curtain.