You probably don’t want to host phpBB on Amazon EC2

Occasionally I do something new. This month something new meant helping to rehost a client on Amazon Web Services (AWS). AWS provides cloud computing services, and its EC2 service (EC = Elastic Computing) is probably its most popular service.

Cloud services provide scalable services. Also, you pay for what you use. They can be configured so that if there are spikes in demand the service will become “elastic”, scaling to meet demand.

I did not do this rehosting by myself. The client had another technical guy that set up and configured his AWS EC2 workspace. The forum is very large with 2.6M posts. In addition to rehosting the forum, I had to upgrade the client at the same time to the newest version of phpBB and move his WordPress site. This project literally took months to complete, although I was not working on it all the time.

I don’t know what Amazon Machine Instance (AMI) was set up in this case. I don’t think the AMI chosen was ideal because WordPress had technical issues that required fine tuning EC2 to get things to work. One thing I took away from the project though is that there is a “tax” if you move to AWS. The learning curve is steep and the tools available to you are miniscule.

Some lessons learned:

  • AWS doesn’t do any handholding. While you get a console to configure EC2, you don’t get any rich control panel like cPanel or Plesk to allow you to easily do complex things. So there is no File Manager, no phpMyAdmin (unless you want to install it yourself), no easy way to create mailboxes or send email. Instead, you need a UNIX geek. I was given a SSH key file and I had to use that to do my work. This meant doing pretty much everything from the command line.
  • Connecting to the AWS workspace was complex since I had to use SSH. The command lines used to connect with SSH were long to type in and easy to get wrong. I had to reference an argument to use the key (.pem) file I was given. When you work from the command line, it’s easy to type something incorrectly. So you often end up typing the command multiple times until you get it right. Closing and opening sessions becomes time consuming and a hassle.
  • To access the database, I had to do it from the command line. It took a while to get database credentials and since I had to do things from the command line again I had to type statements very carefully. I had to export and import databases but getting the syntax just right was challenging. I frequently had to go into the database to tweak things, which meant typing a lot of SQL statements. It’s a good thing I am very fluent in SQL. This really slowed me down. Had I had phpMyAdmin, I would have saved hours of time and hassle.
  • File permissions were a pain. The default user did not have the permissions to the web root folder, which meant becoming root and granting correct group and file permissions. Then secure FTP would work. These problems kept recurring which made the process quite tedious and time consuming.
  • The Apache web server was not configured correctly for WordPress. The AMI was apparently not tuned for WordPress, so it took research and carefully editing of a httpd.conf file to get the settings right. Then the web server had to be restarted from the command line, which is not intuitive, particularly since it had to be done as root.
  • Editing files became a pain. There was a lot of this, mostly tweaking forum styles, templates and configuration files. Since I had only the command line, I had to use a command line text editor. I chose nano, but it was still tedious. There is also a lot of command line navigation to get to the right folders where you needed to do stuff. This would have been easier if I had an editor on my computer that worked with SSH and .pem files. I had the former but not that latter, as I use an old copy of Dreamweaver to more easily edit files remotely.
  • I often had to become root to do things, like read the error_log file to troubleshoot issues.
  • The database import for the forum failed three times. I finally figured out the issue from the obscure error message. I had written two triggers for the client and that required CREATE TRIGGER privileges that were not granted to the default MySQL DBA. I had to snip these lines out of a 2GB+ export file to get the import to succeed. This has never been a problem on other hosts I have worked on.
  • Setting up HTTPS was a pain. It too required special permissions to create public and private key files, on the command line only, of course. It took many attempts before it worked and a valid certificate was installed. While we were waiting to test WordPress and the forum, it required using the long URL provided by AWS, which meant changing the configuration of WordPress and phpBB via the database.

I suspect that the wrong AMI was used or that using a better one would have prevented a lot of problems. In any event, the move to AWS turned out to be tricky, time consuming and a large hassle. For my client, it was an expensive endeavor. It turned out that all this work turned into my largest bill ever. In that sense it was good, although I would have been happier if it had spent a lot less time and a lot less of his money.

Now that my client is on AWS though, as long as it is tuned properly there will be some big advantages. Hosting may cost less in the long run, and the service should be more predictable and scalable.

If you take up a project like this, you will definitely need someone who has set up AWS EC2 instances successfully and will work through all these issues with you. Even so he could not do it alone. The migration took four days to complete, although the forum was functional in less than twenty four hours.

For very large forums that need scalability and high reliability, using a cloud service like AWS makes a lot of sense. However, a project like this should not be taken lightly. Most forum owners will probably be much more comfortable on a good shared host, or a good virtual or dedicated server. 

 

Digests version 3.2.8 released

See this post on phpbb.com for details.

This version of the extension can be downloaded from my digest extension page or from the GitHub 3.2.8 branch page. When downloading from GitHub, remember that it must be copied into a blank /ext/phpbbservices/digests folder.

Of course disable the current digest extension first then remove the /ext/phpbbservices/digests/* files. Then upload the new version then enable again.

Adding Slack workspace

Using email as a primary means to contact me has some disadvantages, such as long threads that make it hard to find information and lags in my responses. So in response I’ve created a Slack workspace: https://phpbbservices.slack.com.

If you join my workspace you can ask me questions anytime. Hopefully I’m on my computer and can respond quickly. Otherwise I will respond when I am available and you can look for my response in the workspace’s channel of your choice.

If you use the #general channel what you post is public to anyone in my workspace. So most of the time use the direct message feature to keep our conversation private.

We’ll see how this goes. I’m fairly new to Slack too so you may know more about it than I do!

You can read more about Slack here.

 

July 2018 work summary

Happily, there was a lot more work in July than there was in June. I am noticing that I tend to get called in for more complex projects and fewer simple projects. One effect this has is that these projects can span months. I worked on two projects like this during July that I do not detail below, but will when finally completed. They will have amount to nice sales when they finally cash in. Both projects are complex upgrades from phpBB 3.0 where there were many customizations by previous developers (including me). Moving them to phpBB 3.2 involves a lot of talking, compromise and prototyping. Both involve standing up test instances of their forums and iterating through them getting the style and features right. As for the other work I did in July:

  • Upgraded a forum from phpBB 3.0.12 to 3.2.2. I had to do it minus the tools I usually have. I had only SSH access. As such there were various technical issues. Trying to make a database backup took a long time in phpBB. But with root privileges I was able to do it very quickly. There were issues uploading files. I had to change the Unix group I was in to get the file permissions correct. I seemed to lose ability to create directories using Secure FTP. I worked closely with client who did some work and gave me additional privileges. There was an unexpected issue with /config directory that did not properly upload and a missing line in the config.php file. Th install folder was not recognized. I had to fix some database issues with upgrade, mostly done from the command line. I reapplied styling changes including logo, various buttons and some help links. Search indexes would not work (MySQL fulltext) so I created phpBB native index instead. I removed dead modules and updated spambot countermeasure to use reCaptcha V2.
  • Troubleshooting. The host set PHP 7 as the new default version of PHP, which caused issues bringing up the phpBB 3.0 forum. I could only revert back to PHP 5.6 on a phpBB 3.0.12 forum but it came up. Later, I upgraded the forum to phpBB 3.2.2 which does work with PHP 7. There were no issues. I placed the logo, changed the spambot countermeasure to reCaptcha V2, added a home link, and removed dead modules.
  • I created two MySQL database triggers to add forum notifications, similar to work for another client in May. This was more involved since 17 forum notifications were needed for each user in the group. I also wrote SQL to make the phpbb_forum_watch table contain rows for all existing users in the newly registered users and registered users groups, so the new triggers would work for people in these groups. I analyzed an issue with notification emails being checked by default. It looks like the two critical ones (new topics in subscribed forums, and replies to topics in subscribed topics) are set by default. I suggested not to turn additional email notifications on by default but it can be done with a trigger if necessary.
  • Fixed a digests issue on version 3.2.7 of my digests extension for a client. Digests were not going out reliably with their cron. A manual test worked fine. To fix cron job I removed /forum from the path since the forum is in a subdomain and added /usr/bin to the curl path.
  • Issue of FatalErrorException in container_builder.php line 146, which brought the forum down. /cache/development folder had 755 permissions. Removed it, changed config.php so phpBB development mode was disabled, cleared the cache manually, and the forum came back up.
  • I upgraded a forum from phpBB 3.0.5 to 3.2.2. The old style was not available, so a new style choice had to be made. The default prosilver style was used. There were some minor issues during upgrade that I had to puzzle through. I added the old logo. I recreated the MySQL full text search index. I added reCaptcha V2 spambot countermeasure and enabled it. I removed some dead modules including old AutoMOD modules. I added a home link.
  • Troubleshooting. There were issues with users not getting email notifications when registering or for forum/topic replies. First I advised setting email package size to 0. That did not seem to work, so I was asked to test it. I created an account and verified that both the registration email was received and forum notifications were received. It is now working correctly. Some permissions looked odd: newly registered could only reply to topics and registered users could not post in most forums.
  • Installed the mChat extension on a new forum with the Flat Style Blue style. Used cPanel to upload the extension. Later, I made text changes to mChat (changing its title to “Live Chat” among other changes) and removed credit lin,e substituting one provided by user. Some days later, I installed the forum icons extension and an archive of forum icons mentioned in the topic for the extension. The next day, the client requested some tutoring so I created a tutorial video using SnagIt. I demonstrated adding an extension, using cPanel, Filezilla, Dreamweaver, File Manager, making a sized and transparent logo and swapping the default logo, changing phpBB’s default text.
  • A site got hit by malware and was recovered. After recovery, I was asked to check the extensions and base code for malware. I upgraded my digests extension and the Cleantalk extension to the latest versions. I compared files with a 3.2.2 reference and found no malware. Later in the month, I removed unneeded phpBB software files, probably from previous versions, that remained in the forum folder. I also enabled the contact form check in Cleantalk because contact form spam was happening. Even later in the month, more spam was reported. Cleantalk extension was somehow disabled. I reenabled it. I removed spam users via Cleantalk once it was reenabled.
  • Troubleshooting. There were regular HTTP 500 errors accessing certain folders in the ACP. When I finally found the web server error log, the log indicated that the /cache/production/twig folder could not be written to. 755 permissions existed. I changed the permissions to 777 and deleted the files inside it that had 755 permissions and the issue was resolved.
  • Troubleshooting. The forum could not send mass emails. Since he has Siteground hosting, passed on what I learned when I set up my hosting: create an account on the domain and configure phpBB to use SMTP. It took a little back and forth with Siteground technical support but this approach eventually proved fruitful.
  • This job was a referral from a recent client. I was asked to straighten out an inconsistent .htaccess file for the site. Issue were http to https redirects weren’t happening, index.html page needed to be hidden if called directly and certain hotlinking needed to work right.
  • The Cleantalk extension was disabled, so spam started to appear, same issue as another client had this month. I updated the Cleantalk extension to the latest version and reenabled it. I found about 20 spam users that I deleted.
  • I installed the Detailed Online View extension, a development quality extension, after warning client it was a bad idea to use any extension that was not approved. It is accessed through the Who’s online link.