Discourse in the Reclaim Cloud

What’s old is new again. In 2015 I wrote about Reclaim Hosting experimenting with the next-generation forum software Discourse using a multi-user Docker setup. We use Discourse for Reclaim’s Community forums and I’ve grown to love the software.* What’s more, as that 2015 post notes, it epitomizes some of the challenges of running these next-generation apps on existing, affordable commodity web hosting: namely it runs Ruby using Nginx and requires transactional email. As Tim pointed out yesterday, I never take the easy road with this stuff. Discourse, even on the Reclaim Cloud, is not a simple, one-click install. But I know folks asked me about it, so I wanted to see what the process looks like, and then document it, which I have in the Reclaim Community Forums (which will not be available for another two weeks given we are still building this out, but I will paste in below). I am also working on a video tutorial for this install.

The following guide describes the process of setting up Discourse on Reclaim Cloud, but before I paste it below a note for my particular case that is not necessarily generalizable. When mapping the forum it seems the proxied A record for discourse.bavatuesdays.com through Cloudflare (where I manage DNS for bavatuesdays) was creating issues. I needed to turn that off for Domain mapping to work:

If you are not using Cloudflare this issue should not occur, but it frustrated me for quite a bit.

This guide will take you through installing the next-generation forum software Discourse on the Reclaim Cloud using the official Docker image they maintain.

To begin with you will need to setup a Docker Engine on Reclaim Cloud, by clicking on the downward-facing arrow next to the Docker tab:

After that select Docker Engine:

At the next prompt create the domain (bava-discourse.ca.reclaim.cloud), name the server (Bava Discourse), and decide in what region you want the app to live (blame Canada!).

At this point your Docker Engine server will be spun up, and once it is you can login via the web-based SSH window provided to install Discourse:
From the command line you can install Discourse (and the command line will follow) but before you do you need to ensure 1) you have a transactional email account working and 2) an A record pointed to the container’s public IP address if you plan on using a domain other than mydiscourse.us.reclaim.cloud. In this example we’ll be mapping Discourse to the URL discourse.bavatuesdays.com.

Transactional email services, like Mailgun and SparkMail, allows you to setup email sending and receiving for apps like Discourse. For this example we used Mailgun, and the crucial information you will need are the SMTP server address, SMTP port, SMTP username, and SMTP password. Along with the domain name, this is the information you will be prompted for when setting up Discourse, and if the email does not work (i.e. is not verified through your transactional email service) you will not be able to use the application.

This guide for setting up a new email domain using Mailgun could prove useful. But keep in mind there are more options.

Once that is done you can now begin installing Discourse. From the command line run the following commands:

git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse

After that you can launch the Discourse setup tool:

./discourse-setup

At this point you will be prompted for domain, email, SMTP details, etc.

Hostname for your Discourse? [discourse.example.com]:
Email address for admin account(s)? [[email protected],[email protected]]:
SMTP server address? [smtp.example.com]:
SMTP port? [587]:
SMTP user name? [[email protected]]:
SMTP password? [pa$word]:
Let's Encrypt account email? (ENTER to skip) [[email protected]]:

We recommend defaulting to port 587 and skipping Let’s Encrypt account email if you do not want to receive email about the built-in SSL certificate.

This will generate an app.yml configuration file on your behalf, and then starts the install which takes a few minutes. If you need to change these settings after installation, you can run ./discourse-setup again (it will re-use your previous values from the file) or edit /containers/app.yml manually with nano and then ./launcher rebuild app, otherwise your changes will not take effect.

Last thing is if you are using a domain other than that provided by Reclaim Cloud you will need to go to Settings–>Custom Domains and add the domain there. Additionally, the domain you are pointing needs to have an A record pointed at the Docker Engine container’s public IP address.

After that, go to the domain and Discourse should be installed and ready to setup.

__________________________

*We are now running Reclaim’s Discourse forum in the Reclaim Cloud quite seamlessly.

Posted in reclaim, Reclaim Cloud | Tagged , , , , | Leave a comment

MinIO and Object Storage in the Reclaim Cloud

In my work to get familiar with Reclaim Cloud I have been taking on projects that I am fairly familiar. Such as migrating this blog, ds106, and ds106.club. It’s been educational, and my last migration project is now almost finished as well. I wanted to migrate both my AWS S3 and Digital Ocean Spaces accounts over to the Reclaim Cloud.

But before I go too much further, it might help to understand what I use S3 and Spaces for. Back in 2014 or I started playing with S3cmd line as part of the process of moving bavatuesdays over to Reclaim Hosting—which is crazy to think about. The use in 2014 was pretty specific, using the Amazon S3 command line to upload a very large file so Tim could help me with the migration of my blog.

Since then I have used S3 not only for random storage, but also as a place to also upload a copy of any media I add to the bava using the WP Offload Media Lite for Amazon S3, DigitalOcean Spaces, and Google Cloud Storage plugin. As the plugin notes, Amazon’s S3 is now just one of many players, such as Google and Digital Ocean. Cloud storage, which is referred to as Object-based Storage, is different from block and/or file-based storage in that it uses a flat structure made up of objects that are related to one another through metadata rather than file hierarchy or block structure. So, rather than controlling access and URIs through file structures or separate parts, you can control access to a single file directly through metadata, something that is crucial for container stack architecture to work given each layer of the stack is usually abstracted from the underlying server.*

So, back to my use-case that I’m reproducing in Reclaim Cloud, I have the WP Offload Media Lite plugin on my blog that connects to S3 and Spaces and uploads all media from my blog there. This is useful for have a backup across multiple regions, hooking media into a content delivery network, or simply separating uploaded content and media from the core application files, which arguable make a move to a different application that much easier. So, as I was imagining a solution Tim quickly pointed me to MinIO, which is open source object-storage software like S3 or Spaces that we just so happen to have a one-click installer for on Reclaim Cloud, you see where this is going now?

So, I installed an instance of MinIO on our Canadian data center (that’s right, Canada!) and called it bavamedia.

It took a few moment to install, and I was up and running with an object-storage solution, now I needed to see if it worked cleanly with s3 commands, which it does. I had already installed the S3cmd tool on my Mac (the guide is quite good for getting it running), so I’m now able to push files from my desktop up to MinIO. This means I could download my media uploads from AWS and Spaces, and uploads them to my Minio Instance, which I did. Once the directories were downloaded, I needed to upload/sync them to MinIO which means using S3 commands like the following:

s3cmd sync --skip-existing ./ s3://files/

This command syncs all files within the current directory (./) on my desktop with the /files bucket on MinIO. So, in my files bucket I am either putting or syncing everything in /wp-content which will then be the bucket I point the WP Offload Media Lite plugin so that all future uploads to bavatuesdays go to this bucket. “But does this plugin support MinIO?” you naturally ask? “It is obvious from the title we can use S3, Spaces, and Google Cloud, but what about MinIO?” Absolutely, it uses the S3 command language, so it works cleanly, you just need to add an additional plugin, WP Offload Media Tweaks, and edit the amazon-s3-and-cloudfront-tweaks.php file with specifics from you MinIO setup. In fact, Delicious Brains, the developers of the plugin, have an excellent guide that takes you through using their plugin with MinIO. In fact, Tim was also playing with MinIO, and effectively realized that we can provide folks hosting Omeka (or Omeka-S) the ability to integrate through MinIO, much like they could with S3 previously.

If you do use the WP Offload Media Lite, I have found turning off the object versioning helped me keep the file structure identical between my blog and my off-site files on MinIO (the object versioning adds another directory layer), but there is a sacrifice of the the extra layer of metadata for file structure consistency, which highlights that my thinking is still straddling the old and new in terms of my comprehension of object-storage.

Below are areas that highlight my filters for connecting to the MinIO object-storage through the Amazon S3 and Cloudfront Tweaks plugin linked above:

And the following add_filter line was already uncommented and ready to go. I added it in the plugin code above this line and kept getting fatal errors when trying to install the plugin, only to realize it was already in there and ready to go.
After I did this MinIO works as a replacement for Spaces and S3 in terms of offloading media from my blog, but now it is time to get serious about exploring the possibilities that this flat file, metadata rich option provides me well beyond WordPress media.
____________________________________

*I’m still working my way through this conceptually, and this post is part of that, so any and all pointers, metaphors and explanations of these differences is always appreciated.

Header image by MarjanNo from Pixabay

Posted in AWS, bavatuesdays, reclaim, Reclaim Cloud, WordPress | Tagged , , , , , | 1 Comment

New Day Rising

While folks have been marching, protesting, and generally kicking fascist ass in the USA, I’ve had my head in the clouds. Not only literally as we work to roll out Reclaim Cloud, but also figuratively as I find myself day-dreaming of an alternative future for the country I was born in. And that is thanks to the many courageous folks who stood up and said they had finally had enough of a racist regime that was literally suffocating its people. As it plays out on my screens and throughout the Italian media, it’s readily apparent the African-American community has led the charge and precipitated what many of us are hoping will be the start of a new day.

I’m far away and forever in debt to those who rose and continue to rise, but for the last few days thoughts of home have me smiling rather than shaking my head. Thinking back to a land where the seeds of equality, possibility, and the people’s ability to change the status quo may be taking root. That all seemed far away these last 4 years as I watched from afar, and between the dis-information, fear-mongering and brutality it became increasingly easier to grow despondent. But when folks see through the violent strategy of financial and emotional austerity and refuse to be silenced, that’s a break in the socio-political dam that spouts hope.

So, I just want to recognize what’s happening, what matters and thank all those back home who refused to let fear get in the way of hope. You are heroes. What’s more, I recognize my absentee role in it, and beg forgiveness as I proceed to put my head back in the cloud to pass the days in hope 🙂

Posted in politics | Tagged | Leave a comment

Updating the bava database from MyISAM to InnoDB

Some of our initial explorations in the Reclaim Cloud have been around automagically scaling for larger WordPress Multisite instance. One of the things Tim discovered yesterday is that the Gallera Cluster that scales databases only works with InnoDB type MySQL databases not MyISAM. Turns out both this blog and ds106 run MyISAM, so I found this Stack Exchange post on upgrading from one to the other. Needless to say I got a backup of my database before trying anything, and then ran this code in the general SQL area of phpMyAdmin:

SET @DATABASE_NAME = 'bavatues_wp1';

SELECT  CONCAT('ALTER TABLE `', table_name, '` ENGINE=InnoDB;') AS sql_statements
FROM    information_schema.tables AS tb
WHERE   table_schema = @DATABASE_NAME
AND     `ENGINE` = 'MyISAM'
AND     `TABLE_TYPE` = 'BASE TABLE'
ORDER BY table_name DESC;

That command spit out the following that I then ran in the SQL area of phpMyAdmin for this blog’s database:

ALTER TABLE `wp_wordtube_playlist` ENGINE=InnoDB;
ALTER TABLE `wp_wordtube_med2play` ENGINE=InnoDB;
ALTER TABLE `wp_wordtube` ENGINE=InnoDB;
ALTER TABLE `wp_users` ENGINE=InnoDB;
ALTER TABLE `wp_usermeta` ENGINE=InnoDB;
ALTER TABLE `wp_term_taxonomy` ENGINE=InnoDB;
ALTER TABLE `wp_term_relationships` ENGINE=InnoDB;
ALTER TABLE `wp_terms` ENGINE=InnoDB;
ALTER TABLE `wp_termmeta` ENGINE=InnoDB;
ALTER TABLE `wp_stp_tags` ENGINE=InnoDB;
ALTER TABLE `wp_spamlist` ENGINE=InnoDB;
ALTER TABLE `wp_scaptcha` ENGINE=InnoDB;
ALTER TABLE `wp_richcomments` ENGINE=InnoDB;
ALTER TABLE `wp_ratings` ENGINE=InnoDB;
ALTER TABLE `wp_quotescollection` ENGINE=InnoDB;
ALTER TABLE `wp_posts` ENGINE=InnoDB;
ALTER TABLE `wp_postmeta` ENGINE=InnoDB;
ALTER TABLE `wp_pollsq` ENGINE=InnoDB;
ALTER TABLE `wp_pollsip` ENGINE=InnoDB;
ALTER TABLE `wp_pollsa` ENGINE=InnoDB;
ALTER TABLE `wp_podpress_stats` ENGINE=InnoDB;
ALTER TABLE `wp_podpress_statcounts` ENGINE=InnoDB;
ALTER TABLE `wp_options` ENGINE=InnoDB;
ALTER TABLE `wp_ngg_pictures` ENGINE=InnoDB;
ALTER TABLE `wp_ngg_gallery` ENGINE=InnoDB;
ALTER TABLE `wp_ngg_album` ENGINE=InnoDB;
ALTER TABLE `wp_links` ENGINE=InnoDB;
ALTER TABLE `wp_flickr_post` ENGINE=InnoDB;
ALTER TABLE `wp_comments` ENGINE=InnoDB;
ALTER TABLE `wp_commentmeta` ENGINE=InnoDB;
ALTER TABLE `wp_blc_synch` ENGINE=InnoDB;
ALTER TABLE `wp_blc_links` ENGINE=InnoDB;
ALTER TABLE `wp_blc_instances` ENGINE=InnoDB;
ALTER TABLE `wp_blc_filters` ENGINE=InnoDB;
ALTER TABLE `wp_bibliography` ENGINE=InnoDB;
ALTER TABLE `wp_as3cf_items` ENGINE=InnoDB;
ALTER TABLE `wp_amber_queue` ENGINE=InnoDB;
ALTER TABLE `wp_amber_check` ENGINE=InnoDB;
ALTER TABLE `wp_amber_cache` ENGINE=InnoDB;
ALTER TABLE `wp_amber_activity` ENGINE=InnoDB;
ALTER TABLE `wp_ak_twitter` ENGINE=InnoDB;
ALTER TABLE `wp_ak_404_log` ENGINE=InnoDB;

That was all it took, they were changed successfully. After that  I restarted the Gallera Cluster in Reclaim Cloud, and everything seems to be running smoothly. I’m currently working up the courage to try the same thing for ds106 🙂

Posted in bavatuesdays, Reclaim Cloud, sysadmin, WordPress | Tagged , , , , , | 2 Comments

New homepage for ds106.club

While I am still cleaning house, I wanted to share the new homepage I create for the ds106.club site.

While I would like to pretend I actually styled this site, I did nothing of the sort. I basically copied the index.html of tilde.club, and then grabbed the stylesheet. I made some minor changes, like replaced the blinking cursor with a blinking tilde, but besides that it is pretty much a direct lift. It was fun because it brings me back to about 2004 when I was playing a lot with CSS and HTML to build a site for Hunter College’s Honors Program. It was a really good lesson in trying to hack at WordPress, even if I was always terrible at PHP. The inspiration was Cogdog’s comment after I reported on having migrated the site to the Reclaim Cloud. Honestly, I have no idea what happened to the front page, but for years it has simply been an Apache landing page letting me know the server is up and running:

So, I spent the other part of yesterday (much of the morning was dedicated to migrating and archiving the ds106 wiki) getting ds106.club squared away. Not sure it will ever be used again, but that never stopped me before.

Are you happy now, Alan?! Just feel like I am picking up where he left off given all the amazing work he did over the years to modernize, restructure, and categorize ds106. It’s in quite good shape because of all that work.

Posted in digital storytelling | Tagged , | 5 Comments

Archiving ds106 docs

Part of moving ds106 to a new server is making sure you don’t leave a trail of dead links in your wake. With great classes come great responsibility 🙂 I think I have the caching issues and some of the kinks worked out after the move, but one think I did want to make sure wasn’t lost in the move was the ds106 wiki, also known as ds106 docs. It was used through 2014, and while it wasn’t a huge part of the class design, for quite a while we used it to for  tech tutorials, syllabi, and other assorted resources. For example, I forgot about the detailed tutorial I created for an animated series of Dead Zone trading cards:

Or the equally detailed Creating Animated GIFs with MPEG Streamclip and GIMP tutorial.

I understand these resources are not all that useful anymore, but the internet preservationist in me wants them to live on. There are other resources such as various syllabi for classes over the years, such for Alan Levine‘s and Martha Burtis‘s Camp Magic MacGuffin syllabus from Summer 2012, or the syllabus for the ds106 Zone in the Summer of 2013. What I noticed going through my early syllabi for ds106 is they were all the same, they just started riffing on a different theme as the years went by, but the core remained. And while that seems logical, I really didn’t remember simply copying and pasting the basics and then building the theme and the prompts of the class on the blog and through the assignments. So, all this to say keeping the wiki was part of the deal of moving the site off shared hosting.

One thing you realize when moving sites is the value of using subdomains versus subdirectories, let me explain. The MediaWiki instance was installed at ds106.us/wiki rather than wiki.ds106.us. That might have had more to do with the WordPress Multisite being subdomains and my not knowing how to resolve redirects, but if the wiki was installed in a subdomain it would still be live right now (which is probably a bad idea regardless). But given I moved everything in ds106.us and the wildcard subdomains to the Reclaim Cloud, I would not be able to run MediaWiki within a subdirectory of ds106. Whereas subdomain can always be pointed elsewhere, subdirectories lock you into the server you are pointing the root domain to.

So, realizing this I need to a) get the wiki up and running temporarily so that I could then use Site Sucker to get a full HTML-based file backup of the site. This is great for archiving and also ensures that the wiki will not go down as application versions change, modules break, or spammers find a way in.* As you can se from the Site Sucker screenshot above, there are files both in ds106.us/docs and ds106.us/wiki because we used the article path function in MediaWiki to have all articles resolves as ds106.us/docs as opposed to ds106.us/wiki, which explains why the root ds106.us folder has both /docs and /wiki and both have part of the HTML archived files.

Another thing I did before archiving the MediaWiki instance (which I also have a full backup of) was update it from 1.19.xx to 1.33.xx. I had to replace the MonoBook theme, turn off the locked-out module, and adjust some other errors as a result of the update, but I was happy and relieved that it worked after a couple of hours and MediaWiki was now running a supported version on PHP 7.3 no less. Part of me still loves the promise and possibility of MediaWiki, but after wrangling with the documentation and the code it was a good reminder why it was never sustainable-the interface and editing was never made any easier and versioning issues made long-term maintenance onerous.

And with that, I think the future-proofing of the ds106 infrastructure and trying to ensure there remains some link integrity is in pretty good shape. I’ll do another pass this weekend, and then terminate the shared hosting instance, and commit to the cloud!

________________________________________________

*While I was at it I took a flat-file back-up of all of ds106.us and got a database and file dump (as well as a full cPanel backup file) that currently live in DropBox. So, this is a note-to-self that I do have a full snapshot of the site from June 2020 when I go searching for it in the future.

Update: I forgot to mention when posting this that I also created an index.html and about.html redirects given Site Sucker has the MediaWiki template linking to ds06.us/index.html and ds06.us/about which results in a 404 error. I created a simple HTML redirect file for the about.html file to go to just /about, and I tried the same for the index.html but that caused to many re-directs. I figured that this was because the default.conf file for nginx had index.html before index.php in this block:

root /var/www/webroot/ROOT;
index index.html index.php index.htm;

A simple transposition of index.html and index.php fixed it:

root /var/www/webroot/ROOT;
index index.php index.html index.htm;

Or at least making sure index.php comes before index.html in that line seems to have fixed the redirects.

Posted in digital storytelling, mediawiki, reclaim, Reclaim Cloud | Tagged , , , , | 1 Comment

ds106.club to the Cloud!

As the tale of the bava can attest, I have been knee-deep in migrating projects to the Reclaim Cloud. It’s been equal parts exhilarating and frustrating given the possibilities and the necessary learning curve, but that’s often the cost of personal and professional growth. That said, after migrating ds106.us things are starting to feel downhill, and yesterday I got the silly side-project ds106.club moved over from Digital Ocean, which means the last piece I have to move from my personal Digital Ocean account are some files I’m hosting on a Spaces instance.

I moved ds106.club over to Digital Ocean from AWS back in 2016 when I realized I was never going to be a master of AWS’s infrastructure (part of what makes the Reclaim Cloud so welcome and exciting). The ds106.club is a straight-up UNIX apache server that was exploring the tilde.club experiment back in 2015. Our version of that experiment was hosted on a 1 GB Ubuntu 16.04 VPS through Digital Ocean at $5 a month. Not much has happened there, though there are some really fun site like the Prisoner 106 GIF story, my own little experiment, and many more. It’s a trailing edge corner of the web that is forgettable in many ways, and that’s why I love it. So, I spent Monday and Tuesday exploring how to get it migrated over.

I had everything moved over cleanly on Monday following the original tilde.club how-to, but I missed a couple of things specific to the Reclaim Cloud (which is built on Jelastic’s virtualizing, container-based software). Such as the fact our Cloud has its own firewall for VPS instances. You can now see why we are still kicking the tires on this before an open, public beta in early July.  There were also some edits I needed to make to the Apache configuration file I missed, but this is a good moment to reflect on why we are able to even think about moving forward with Reclaim Cloud, which Tim documents our history with elastic computing and containers starting as far back as 2011.

Whiteboard from a brainstorming session with Kin Lane back in December of 2014

If it wasn’t for our current team, namely Lauren Brumfield, Meredith Fierro, Chris Blankenship, Gordon Hawley, and Katie Hartraft none of this would even be thinkable, no less possible. We have gotten to a moment wherein Tim and I have both been relieved from a majority of the dat-0to-day operations of Reclaim, which has provided us the head space to actually push forward with a next generation infrastructure that will allow us to go far beyond even our wildest expectations 7 years ago when we started this whole thing. So, thank you all. You rule, I drool! 

In addition that that, we have setup an internal forum for our Reclaim Cloud project so that we can start to push hard on our current private beta before opening it up next month, and I tried to get things going with a post about my struggles migrating ds106.club, which I am documenting below:

I am setting up an Ubuntu 16.04 VPS in the Reclaim Cloud, and after spinning it up I can’t seem to get the public IP to resolve. To be specific, I’m migrating the ds106.club 1 instance of an Apache/UNIX tilde space server over from Digital Ocean that is also running on Ubuntu 16.04.

I am following the tilde.club setup guide 1 and have updated the hostname:

$ sudo hostnamectl set-hostname ds106.club

When I run the above command and reboot, the ds106.club hostnae is replaced with node366-env-7531836.us.reclaim.cloud, so it is not sticking. Although, from what I understand that might not be an issue for Jelastic, and editing the /etc/hosts file may be enough?

In that vein, I updated /etc/hosts to the following (notice Jelastic keeps a record for the original hostname in this file underneath the commented line):

127.0.0.1 localhost ds106.club
147.135.81.23 ds106.club
# Auto-generated hostname. Please do not remove this comment.
147.135.81.23 node366-env-7531836.us.reclaim.cloud node366-env-7531836

After that I am still getting nothing at the IP or domain, I went ahead and tried installing Apache2, and I get the following error:

insserv: warning: current start runlevel(s) (empty) of script `apache2' overrides LSB defaults (2 3 4 5).
invoke-rc.d: policy-rc.d denied execution of start.
Setting up ssl-cert (1.0.37) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...

I looked this up and did see a Stack Exchange post on the issue 1, but when I ran the recommended command to fix:

RUN printf '#!/bin/sh\nexit 0' > /usr/sbin/policy-rc.d

I got the following:

RUN: command not found

At this point I backed away slowly from command line and decided to high tail it to this part of the Reclaim Community forums to see if I can get a lifeline :slight_smile:

To which, in less than an hour, Chris Blankenship response with the following:

I just ran through this successfully on an ubuntu vps, I did have to deviate from the steps outlined a bit.
End Result: http://hostnametest.chrisblankenship.cloud/~testuser/

I spun up the Ubuntu VPS, and edited /etc/hosts to add these lines to specify the IP and hostname I’d be using:
147.135.81.26 hostnametest.chrisblankenship.cloud hostnametest
127.0.0.1 hostnametest.chrisblankenship.cloud hostnametest

This doesn’t change the hostname for the VPS itself, I’ve been having trouble with that as it will re-set each reboot, but adding these lines should be sufficient so your server is recognized with the proper hostname.

Then I created the user testuser using the adduser command, switched into the user by running su - testuser, and created a public_html dir with all the permissions and a test index file by running: mkdir ~/public_html && chmod 755 ~/public_html && echo "<h1>TESTING</h1>" >> ~/public_html/index.html && chmod 644 ~/public_html/index.html && exit

Once I was back in the root shell, then I installed apache by running: apt install apache2

Before edits can be made, it has the be run to generate the config files, so I ran systemctl start apache2

Then I had to enable userdir support using a2enmod userdir and restart apache using systemctl restart apache2

And then in the default enabled site’s file /etc/apache2/sites-enabled/000-default.conf, I added a line at the top to specify the servername: ServerName hostnametest.chrisblankenship.cloud

I gave it one more restart using systemctl restart apache2 and then I had to open up the HTTP/HTTPS ports in the Jelastic Environment Firewall

If you hit add under Inbound Rules, you can specify HTTP/HTTPS as the name, and it will autoconfigure with the ports.
image

I can now get the tilde space for the test user. I’m having some issues enabling the service to run at startup (systemctl enable apache2), but I’ll update once I figure that out.

Not only did this work for me, and the only other thing I needed to figure out was migrating content and user permissions, which this post on nixCraft was textbook for. So, thanks to Chris I have ds106.club up and running on Reclaim Cloud, and this really cemented for me that we are ready for this. We are ready to start helping students, faculty, and institutions think through the cloud for their offerings, and that is pretty exciting. Reclaim has been quite a journey thus far, and I think this marks a new, exciting chapter. And while it is important to temper excitement in the current political situation, I have always believed strongly that part of what Reclaim has been doing has always been about a sense of reclaiming control and educating as many folks as possible that it is indeed possible, and here is one way at it.

Posted in digital storytelling, Reclaim Cloud | Tagged , , | 2 Comments

Migrating ds106 to the Reclaim Cloud

If the migration of bavatuesdays was a relatively simple move to Reclaim Cloud, doing the same for ds106 was anything but. Five days after starting the move I finally was successful, but not before a visceral sense of anguish consumed my entire week. Obsession is not healthy, and at least half the pain was my own damn fault. If I would have taken the time to read Mika Epstein’s 2012 meticulous post about moving a pre-3.5 version of WordPress Multisite from blogs.dir to uploads/sites in its entirety, none of this would have ever happened.

I started the migration on Tuesday of last week, and I got everything over pretty cleanly on the first try. At first glance everything was pretty much working so I was thrilled. I was even confident enough to point DNS away from the low-tenant shared hosting server it had been residing on.*

The question might be asked, why move the ds106 sites to Reclaim Cloud at all?  First off, I thought it would be a good test for seeing how the new environment handles a WordPress Cluster that is running multisite with subdomains. What’s more, I was interested in finding out during our Reclaim Cloud beta exactly how many resources are consumed and how often the site needs to scale to meet resource demands. Not only to do a little stress-testing on our one-click WordPress Cluster, but also try and get insight into costs and pricing. All that said, Tim did warn me that I was diving into the deep end of the cloud given the number of moving parts ds106 has, but when have I ever listened to reason?

Like I said, everything seemed smooth at first. All pages and images on ds106.us were loading as expected, I was just having issues getting local images to load on subdomain sites like http://assignments.ds106.us or http://tdc.ds106.us. I figured this would be an easy fix, and started playing with the NGINX configuration given from experience I knew this was most likely a WordPress Multisite re-direct issue. WordPress Multisite was merged into WordPress core in version 3.0, when this happened older WordPress Multi-user instances (like ds106) were working off legacy code, one of the biggest differences is where images were uploaded and how they were masked in the URL. In WPMU images for sub sites were uploaded to wp-content/blogs.dir/siteID/files, and using .htaccess rules were re-written to show the URL as http://ds106.us/files/image1.jpg. After WordPress 3.0 was released, all new WordPress Multisite instances (no longer was it called multi-user) would be uploaded to wp-content/uploads/sites/siteID, and they they no longer mask, effectively including the entire URL, namely http://ds106.us/wp-content/uploads/sites/siteID/image1.jpg.

So, that’s a little history to explain why I assumed it was an issue with the .htaccess rules masking the subdomain URLs. In fact, in the end I was right about that part at least. But given ds106.us was moving from an apache server-based stack to one running NGINX, I made another assumption that the issue was with the NGINX redirects—and that’s where I was wrong and lost a ton of time. On the bright side, I learned more than a little about the nginx.conf file, and let me take a moment to document some of that below for ds106 infrastructure posterity. So, the .htaccess file is what Apache uses to control re-directs, and the those look something like this for a WordPress Multisite instance before 3.4.2:

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]
# END WordPress

In WordPress 3.5 the ms-files.php function was deprecated, and this was my entire problem, or so I believe. Here is a copy of the .htaccess file for WordPress Multisite after version 3.5:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

No reference to ms-files.php at all. But (here is where I got confused cause I do not have the same comfort level with nginx.conf as I do .htaccess) in the nginx.conf file on the Reclaim Cloud server there is a separate subdom.conf file that deals with these re-directs like so:

    #WPMU Files
        location ~ ^/files/(.*)$ {
                try_files /wp-content/blogs.dir/$blogid/$uri /wp-includes/ms-files.php?file=$1 ;
                access_log off; log_not_found off;      expires max;
        }

    #WPMU x-sendfile to avoid php readfile()
    location ^~ /blogs.dir {
        internal;
        alias /var/www/example.com/htdocs/wp-content/blogs.dir;
        access_log off;     log_not_found off;      expires max;
    }

    #add some rules for static content expiry-headers here
}

[See more on nginx.conf files for WordPress here).]

Notice the reference to WPMU in the comments, not WPMS. But I checked the ds106.us instance on the apache server it was being migrated from and this line existed:

RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

So ds106 was still trying to use ms-files.php even though it was deprecated long ago. While this is very much a legacy issue that comes with having a relatively complex site online for over 10 years, I’m still stumped as to why the domain masking and redirects for images on the subdomain sites worked cleanly on the Apache server but broke on the NGINX server (any insight there would be greatly appreciated). Regardless, they did and everything I tried to do to fix it (and I tried pretty much everything) was to no avail.

I hit this post on Stack Exchange that was exactly my problem fairly early on in my searches, but avoided doing it right away given I figured moving all uploads for subdomain  sites out of blog.dir into uploads/sites would be a last resort. But alas 3 days and 4 separate migrations of ds106 later—I finally capitulated and realized that Mika Epstein’s brilliant guide was the only solution I could find to get this site moved and working. On the bright side, this change should help future-proof ds106.us for the next 10 years 🙂

I really don’t have much to add to Mika’s post, but I will make note of some of the specific settings and commands I used along the way as a reminder when in another 10 years I forget I even did this.

I’ll use Martha Burtis‘s May 2011 ds106 course (SiteID 3) as an example of a subdomain migrated to capture the commands.

The following command moves the files for site with ID 3 (may11.ds106.us) into its new location at uploads/sites/3

mv ~/wp-content/blogs.dir/3 ~/wp-content/uploads/sites/

This command takes all the year and month-based files in 3/files/* and moves them up one level, effectively getting rid of the files directory level:

mv ~/wp-content/uploads/sites/3/files/* ~/wp-content/uploads/sites/3

At this point we use the WP-CLI tool do a find and replace of the database for all URLs referring to may11.ds106.us/files and replace them with may11.ds106.us/wp-content/uploads/sites/3:

wp --network --allow-root search-replace 'may11.ds106.us/files' 'may11.ds106.us/wp-content/uploads/sites/3'

The you do this 8 or 9 more times for each subdomain, this would obviously be very , very painful and need to be scripted for a much bigger site with many 10s, 100s or 1000s of sub sites.†

To move over all the files and the database I had to run two commands. The first was to sync files with the new server:

rsync -avz [email protected]:/home/ds106/public_html/ /data/ROOT/

Rsync is is the best command ever and moves GBs and GBS of data in minutes.

The second command was importing the database, which is 1.5 GBs! I exported the database locally, then zipped it up and uploaded it to the database cluster container and then unzipped it and ran the database import tool, which takes a bit of time:

mysql -u user_name -p database_name < SQL_file_to_import

After that, I had to turn off ms_files_rewriting, the culprit behind all my issues. That command was provided in Mika’s post linked to above:

INSERT INTO `my_database`.`wp_sitemeta` (`meta_id`, `site_id`, `meta_key`, `meta_value`) VALUES (NULL, '1', 'ms_files_rewriting', '0');

You also need to add the following line to wp-config.php:

define( 'UPLOADBLOGSDIR', 'wp-content/uploads/sites' );

The only other thing I did for safe-keeping was create a quick plugin function based on Mika’s stupid_ms_files_rewriting to force the re-writing for any stragglers to the new URL:

function stupid_ms_files_rewriting() {
$url = '/wp-content/uploads/sites/' . get_current_blog_id();
define( 'BLOGUPLOADDIR', $url );
}
add_action('init','stupid_ms_files_rewriting');

I put that in mu-plugins, and the migrated ds106.us multisite install worked! There was some elation and relief this past Saturday when it finally worked. I was struggle-bussing all week as a result of this failed migration, but I am happy to say the Reclaim Cloud environment was not the issue, rather legacy WordPress file re-writes seemed to be the root cause of my problems.

I did have to also update some hardcoded image URLs in the assignment bank theme , but that was easy. The only thing left to do now is fix the ds106 MediaWIki instance and write that to HTML so I can preserve some of the early syllabi and other assorted resources. It was a bit of a beast, but I am very happy to report that ds106 is now on the Reclaim Cloud and receiving all the resources it deserves on-demand 🙂


*VIP1 was the most recent in a series of temporary homes given how resource intensive the site can be given the syndication hub it has become.

†I did all these changes on the Apache live site before moving them over (take a database back-up if you are living on the edge like me), and then used the following tool to link all the

Posted in digital storytelling, Reclaim Cloud, WordPress, wpmu | Tagged , , , , , | 3 Comments

bava in the cloud with clusters

Last weekend I took a small step for the bava, but potentially a huge step for Reclaim Hosting. This modest blog was migrated (once again!) into a containerized stack in the cloud in ways we could only dream about 7 years ago. There is more to say about this, but I’m not sure now is the right time given there is terror in the streets of the US of A and the fascist-in-charge is declaring warfare on the people. What fresh hell is this?!  But, that said, I’ve been hiding from American for years now, and quality lockdown time in Italy can make all the difference. Nonetheless, I find myself oscillating wildly between unfettered excitement about the possibilities of Reclaim and fear and loathing of our geo-political moment. As all the cool technologists say, I can’t go on, I’ll go on….

For anyone following along with my migrations since January, there have been 4 total. I migrated from one of Reclaim Hosting’s shared hosting server’s in early January because the bava was becoming an increasingly unpredictable neighbor. The HOA stepped in, it wasn’t pretty. So, it meant new digs for the bava, and I blogged my moved from cPanel to a Digital Ocean droplet that I spun up. I installed a LEMP environment, setup email, firewall, etc. I started with a fresh Centos 7.6 sever and set it up as a means to get more comfortable with my inner-sysadmin. It went pretty well, and costs me about $30 per month with weekly backups. But while doing a migration I discovered a container-based WordPress hosting service called Kinsta which piqued my interest, so I tried that out. But it started to get pricey, so I jumped back to Digital Ocean in April (that’s the third move) thinking that was my last.*

Imag

But a couple of weeks later I was strongly considering a fourth move to test out a new platform we’re working on, Reclaim Cloud, that would provide our community a virtualized container environment to fill a long-standing gap in our offerings to host a wide array of applications run in environments other than LAMP. I started with a quick migration of my test Ghost instance using the one-click installer for Ghost (yep, that’s right, a one-click installer for Ghost). After that it was a single export/import of content and copying over of some image files. As you can see from the screenshot above, while this Ghost was a one-click install, the server stack it runs on is made visible. The site has a load balancer, an NGINX application server, and a database which we can then scale or migrate to different data centers around the world.

In fact, geo-location at Reclaim for cloud-based apps will soon be a drop-down option. You can see the UK flag at the top of this one as hope springs eternal London will always be trEU. This was dead simple, especially given I was previously hosting my Ghost instance on a cPanel account which was non-trival to setup. So, feeling confident after just a few minutes on a Saturday, I spent last Sunday taking on the fourth (and hopefully final) migration of this blog to the Reclaim Cloud! I’ve become an old hand at this by now, so grabbing a database dump was dead simple, but I did run into an issue with using the rsync command to move files to the new server, but I’ll get to that shortly.

First, I had to setup a WordPress cluster that has a NGINX load balancer, 2 NGINX application servers, a Gallera cluster of 3 MariaDB databases, and a NFS file system. Each of these are within their own containers, pretty cool, no? But don’t be fooled, I didn’t set this up manually—though one could with some dragging and dropping—the Reclaim Cloud has a one-click WordPress Custer install that allows me to spin-up a high-performance WordPress instance, all of which are different layers of a containerized stack:

And like having my own VPS at Digital Ocean, I have SSH and SFTP access to each and every container (or node) in the stack.

In fact, the interface also allows access and the ability to edit files right from the web interface—a kind of cloud-based version of the File Manager in cPanel.

I needed SSH access to rsync files from Digital Ocean, but that is where I ran into my only real hiccup. My Digital Ocean server was refusing the connection because it was defaulting to a SSH key, and given the key on the Reclaim Cloud stack was not what it was looking for, I started to get confused. SSH keys can make my head spin, Tim explained it like this:

I never liked that ssh keys were both called keys. Better analogy would be “private key and public door”. You put your door on both servers but your laptop has the private key to both. But the key on your laptop is not on either server, they both only have the public door uploaded. On your laptop at ~/.ssh you have two files id_rsa and id_rsa.pub. The first is the key. Any computer including a server that needs to communicate over ssh without a password would need the key. And your old server was refusing password authentication and requiring a key.

That’s why Timmy rules, after that I enabled the prompting of an SSH server password when syncing between the Cloud and Digital Ocean using this guide. After that hiccup, I was in business. The last piece was mapping the domain bavatuesdays.com:

And issuing an SSL certificate through Let’s Encrypt:

It’s worth noting here that I am using Cloudflare for DNS, and once I pointed bavatuesdays.com to the new IP address and cleared the local hosts file on my laptop the site resolved cleanly with https and was showing secure. Mission accomplished. I was a cloud professional, I can do anything. THE BAVA REIGNS! I RULE!  Ya know, the usual crap from me.

But that was all before I was terribly humbled by trying to migrate ds106.us the following day. That was a 5-day ordeal that I will blog about directly, but until then—let me enjoy the triumph of a new, clustered day of seamless expansion of resources for my blog whenever resources run high.

I woke up to this email which is what the clustering is all about, I have bavatuesdays set to add another NGINX application server to the mix when resource on the existing two go over 50%. That’s the elasticity of the Cloud that got lost when anything not on your local machine was referred to as the cloud. A seamlessly scaling environment to meet the resource demands, but only costing you what you use like a utility was always the promise that most “cloud” VPS providers could not live up to. Once the resource spike was over I got an email telling me the additional NGINX node was spun down. I am digging this feature of the bava’s new home; I can sleep tight knowing the server Gremlins will be held at bay my the elastic bands of virtualized hardware.


*I worked out the costs of Digital Hosting vs Kinsta, and that was a big reason to leave Kinsta given the bava was running quite well in their environment.

N.B:  While writing this Tim was working on his own post and he found some dead image links on the bava as a result of my various moves, and with the following command I fixed a few of them 🙂
wp search-replace 'https://bavatuesdays.com/wp-content/uploads' 'https://bavatuesdays.com/wp-content/uploads'
….
Made 8865 replacements. Please remember to flush your persistent object cache with `wp cache flush`.

Posted in bavatuesdays, reclaim, Reclaim Cloud, sysadmin | Tagged , , , | 3 Comments

Reclaiming Vimeo

I’m hoping to catch up on some blogging about stuff I have been doing with ds106.tv over the last month or so, but before that I wanted to quickly share an awesome tool that Chris Lott pointed me to a couple of years back called youtube-dl. Youtube-dl is a script you install on your computer (using Homebrew on the Mac) and once you do it allows you to effectively download all the videos associated with a Youtube account using a command such as:

youtube-dl https://vimeo.com/USERNAME -o "/Users/YOURUSER/Movies/%(title)s.%(ext)s"

As you can see from the command line above, this tool is not limited to Youtube, in particular it works just as well with Vimeo. And special thanks to Andrew Gormley for this guide that documents the process making installing everything from installing youtube-dl to backing-up all your videos dead simple. And just like that I was backing up all 266 videos to my hard drive.

Having lost 240 videos when my Youtube account was deleted in 2012 (something that still pains me 8 years later), I’ve done my best to avoid inviting the copyright ghouls to my content. Although, back in 2014 I did upload several Wire episodes to my Vimeo account for the Wire106 course, and I got 2 of 3 allowed copyright strikes by Vimeo, so I stopped uploading to that platform for quite a while. I did use it here and there again over the last 5 years, and after the return to ds106.tv my needs for a video platform seem more pressing. I’ve already written about presenting about The Girl Who Knew Too Much with Paul Bond for Antonio Vantaggiato’s Italian Culture course, but that was the instance that returned me to the conundrum I had avoided for years of not teaching: how do I share clips of a film I think are crucial to creating an argument as part of a course? Doing this led to issues on Youtube and then again in 2014 with Vimeo, so I was gun shy to say the least. That said, I believe sharing these clips as embedded links in my blog or as part of a recorded course lecture should be fair use, but Youtube (and most likely Vimeo) will never let it get to the point of such a defense given they’ll often cow to the entity claiming copyright and either take it down or delete your account.†

In this regard, video remains one of the hardest pieces of one’s digital life to truly Reclaim given it is still relatively expensive to stream technically, but as we continue to see that cost of storage and server CPU falling significantly, it’s not hard to imagine sometime soon it will be feasible to run your own video streaming service. I personally look forward to that day, because it will truly be a multi-headed hydra for bullshit DMCA copyright claims. So, in preparation for a liberated future for video, I now can upload my fair use clips of films I will be discussing in the coming months with the understanding that my account could go away at any point. And while it’s not just the videos that would deleted, I’ll also lose any metadata like views, comments etc., but luckily I have next to no metadata on that system because that platform is not the context for my discussion, it’s purely a means to an embedded end on my blog.

Back in 2013-2014 in the wake of my Youtube account getting deleted I uploaded a decent number of videos up to UMW’s media server Andy Rush was playing around with at the time. It worked well for a while but between the lack of institutional commitment and institutional knowledge moving on, those videos were relegated to a backup drive. A long-term solution for reclaim video online remains an issue (although the Internet Archive still reigns supreme in this regard), and the Reclaim Media idea I had back in 2017 when the Reclaim Hosting team was in NYC still is something I’d love to help build.* This is effectively a tool where you can Reclaim your media from sites like Youtube, Vimeo, Instagram, Flickr, Twitter, etc. and brought into your own ecosystem whether as HTML for archival purposes, or into a comparable open source tool. Anyway, this is a small thing, but this project of having all my Vimeo files regularly backed up makes me feel freed up to actually blog the way I want and figure out the where and how of video as I continue down the road to full digital-self actualization 🙂


*All of which really stems from the Reclaim Your Domain conversation that led to the direction and name of Reclaim Hosting.

†In this regard I read an interesting post on TorrentFreak the other day wherein copyright folks were trying to get the source code for the open source bittorrent streaming platform Popcorn taken off Github given it is used by pirates to share and watch pirated films. And while the code was initially taken down by Github, after an appeal it was re-instated given the actual source code neither links to nor automatically downloads copyrighted material.

Posted in Archiving, Domain of One's Own, reclaim, YouTube | Tagged , , , , | 4 Comments