Moving On

TLDR:

Some old Circus Scientist services have to go, in order to move forward with new projects. This is due to Ubuntu Server upgrade (not intentional)

Outline:

There are two ways to look at things in software:

  1. Keep things compatible and working no matter what. I think of this as the “hoarder” mentality (think Microsoft)
  2. Move fast and break things (aka Google)


I guess I try to keep a happy medium, leaning towards the “hoarder” side. Right now though, something is going on that I don’t have any power to change. The Ubuntu Server version 20 which I have most of my “experimental” services on is going EOL in a few months.
I don’t have a choice – I need to upgrade all of my online projects. Sometimes this is as simple as upgrading Ubuntu in-place but due to Python version updates this time it’s impossible. Each service has to be updated and put on a new version of the server – I’m using the latest LTS version, Ubuntu Server 2024.

What is going away

  1. LED Website Indicator. I really love this project, my first fully integrated Web and IOT project. Basically nobody cared except me. I’m going to open source the Arduino code at some point, some parts are already are available on GitHub.
  2. MagicPoi old website. There is already a new version with most of the same functionality (my patreon subscribers have had access to this for a while). This was my first really large Flask website with an api accessible from ESP8266 and is a bit old and insecure now. I have a backup if anyone has data from there that they need to get back, just send me an email and I will sort you out.
  3. AI Site Generation. A fun project that was just for learning purposes really.
  4. Monkey Detector (web version with api). Another learning project, not being used.
  5. K8 Juggling. Very old fun service.
  6. Invisible Deck Practiser. Just a JavaScript version of an Android app (magic).
  7. Other personal sites not related to this blog.

Temporary disruptions

Several other services need to be migrated, this may take up to a week depending on the complexity. Expect disruptions.

  • SmartPoi Downloader
  • The new alpha version of magicpoi site (with api)
  • devsoft.co.za
  • show.circusscientist.com
  • Other personal sites not related to this blog.

Conclusion

Sometimes you have to break things in order to move forward.

Everything that is moving to the new server is going to have proper Python virtual environments with up-to-date libraries. More secure, faster, future proof.

Super Fast PHP WordPress Plugin development with VVV

This is just a quick shoutout to the virtualization app which is helping me a lot with my LED-WEBSITE-INDICATOR plugin development.

Check out https://github.com/Varying-Vagrant-Vagrants/VVV

The VVV project uses VirtualBox in the background to automatically set up a WordPress development environment, including two working WordPress sites to play with. The whole thing is done for you, all I had to do was copy my plugin to the shared folder and every change was visible on the working local site.

If you are getting into PHP and WordPress, check out the project, I won’t say any more about it, just try it already!

DigitalOcean: Migrating WordPress Websites from Ubuntu Server 16.04 to 20.04

As you probably know (see the banner above) I am a happy user of DigitalOcean for many years now – I host multiple websites on a single server without any hassle. They don’t get that much traffic – 1000 or so hits a month for this one for example – so I’m happy sticking with the $5 per month offering for now.

Ubuntu 16.04 is reaching end of life!

It’s time for an upgrade! According to the DigitalOcean documentation it is not recommended to upgrade in-place (do-release-upgreade in the terminal)… I tried and stuff broke, so that is good advice. Luckily I have backups enabled for an extra $1 per month only, so restoring the server was a one-click affair. Now I have a new droplet and need to migrate ALL of my sites to it one by one.

Migration Notes:

  1. I followed this excellent tutorial: https://medium.com/@christoph.schmidl/how-to-manually-backup-wordpress-daa43e37a9bd to backup the mysql database and wordpress folder (/var/www/mysite) – but used wget on the new server to fetch the archives directly.
  2. I had to revoke the letsencrypt https certification – https://maximef.com/2020/10/21/how-to-delete-certbot-certificate-by-domain-name-lets-encrypt/ – don’t forget to remove old files left behind
  3. In the DigitalOcean dashboard, point the url to the new droplet
  4. Create new virtual host files and enable in apache (a2enmod sitename.com) – to learn more about using apache virtualhost files to host multiple sites on one server see: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-18-04 – it’s the same for 20.04
  5. I had an issue with the WordPress database but found out that all that’s needed is to match the wordpress wp-config.php information to the mysql database and user info. This tutorial was helpful (if a bit out of date, the procedure for creating a user has changed…) https://www.vultr.com/docs/troubleshooting-wordpress-database-errors
  6. Create new LetsEncrypt https cert – see #2 link, using certbot.
  7. And everything works (hopefully)

Tweaking the server:

I had some issues with the Ubuntu Server being a bit slow sometimes – think I used the one click WordPress install. It seems that there are ways to optimize this – here is a great link to some ideas about this:

  1. Add swap: https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04
  2. More settings for swap: https://bitlaunch.io/blog/how-to-create-and-adjust-swap-space-in-ubuntu-20-04/

Now my server is running smoothly, it’s time to migrate this blog. Or have I done it already? I doubt you would notice!

How To Fix the dreaded “Error Establishing A Database Connection” In WordPress

This is just a quick post to note what worked for me. I found loads of tutorials online but none of them had the full story.

Essentially I had to change my database password. Here is what I did:

Assuming you have ssh access to your DigitalOcean Ubuntu droplet:

Fictional Database Name: wordpressDB

Fictional WordPress User Name: wpUser

Fictional Password: 12345

Open your wordpress wp-config.php (usually located at /var/www/html) and change the password, and make a note of the database name and user.

nano /var/www/html/wp-config.php

define( 'DB_PASSWORD', '12345' );

Now change the mySql database details:

mysql -u root -p

use wordpressDB;

UPDATE wp_users SET user_pass = MD5('12345') WHERE ID=1 LIMIT 1;

grant all on wordpressDB.* to 'wpUser'@'localhost' identified by '12345';

flush privileges;

exit;

Conclusion

Anyway that’s what worked for me, hope it helps someone at some point (probably me, in the future). Generally WordPress is pretty stable, this is the first time I encountered this problem.