Auto Upgrade Ubuntu

Every few months I have to perform an upgrade on Ubuntu. My WordPress droplet usually has about 80 updates that can be applied immediately. The upgrade process is not so bad. I have to power down the server and make a snapshot of the droplet, which takes about five minutes to complete. Two days ago, I did the upgrade and removed unused packages. WordPress’s Site Health gave me 4 errors, including the failure of scheduling post and some caching issues. I ended up restoring an old backup from four days ago. I will not remove unused packages in the future. In any rate, I wish I could enable automatic minor and security updates for Ubuntu so I don’t have to do the updates myself. I did the AutomaticSecurityUpdates, but it didn’t seem to work. If you have any suggestions, please let me know.

Focus on the Websites

One of the recurring themes from Computers in Libraries 2023 was the focus on the websites. Speakers talked about site design, user experience, and content strategy. They also discussed about quitting social media.

For Libraries, websites remain our homebase. Unlike social media networks, our library websites have no ads, no privacy issues, and definitely no misinformations. As a result, we should not send our users to social media, but the other way around. We have control of our sites, not social media. We provide accurate information on our site and we have no idea what type of information being pushed on social media.

I am glad to hear that librarians put their focus and effort into their websites instead of someone else’s. Library websites are still trustworthy online presence for institutions and organizations.

In my current role, I am no longer in charge of the Law School or Law Library social media. My focus is primarily on our websites. We are about to embark on a whole new direction for our main site. I don’t know how that will play out.

In my personal space, I focus only on my websites, particularly this blog. I haven’t posted anything on social media in a while. I have been tempted to deactivate them all. I also don’t have any desire to try another social media platform.

At least at the moment, my career in web design is still good. Social media networks come and go, but our sites will stay for a while. That’s my take from the conference.

Switching from em to rem

In addition to changing the wordmark, I made the switch from em to rem unit for my typographic control after a Slack discussion with my former colleagues at Vassar. I used em for scalability and inheritance, but em could cause compounding sizing. Using rem seems to avoid the headache; therefore, I might as well making the switch.

After reading Robin Rendle’s note, I added this new CSS element on all my headings:

h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
}

I am not seeing the effect yet, but I hope it will just work in the future once browsers support it. It’s not a big deal. I still like to tinker around this site as often as I could.

I am in the middle of listening to John Gruber talking with Jason Kottke about web design, Movable Type, and web development. I have tremendous respect for them on how they could turn their blogs into full-time jobs. I am not sure about Jason, but John is doing pretty darn well with the sponsorships on both his site and podcast. I don’t subscribe to their RSS feeds. I just check their homepages every once in a while. I can’t keep up with John’s podcast either. I only check in once in while for something special, like the latest episode about Kottke.org turns 25. That is quite a milestone. Congrats, Jason.

Persistent Object Cache

WordPress’s Site Health suggests that I should be using persistent object cache for this blog. Last night I tried to install and secure Redis on Ubuntu 22.04 on my DigitalOcean Droplet, but I couldn’t get Redis to work. I restored my snapshot then tried to install and secure Memcached. That didn’t work either. I restored my snapshot again. I am not sure what I was doing wrong.

How to Set Up a LAMP Stack for WordPress

Follow “How To Install WordPress on Ubuntu 20.04 with a LAMP Stack.”

Log into MySQL:

sudo mysql -u root

Update the root user’s password (replace new_password with a strong password):

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new_password';

Create database:

CREATE DATABASE yoursite DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Create user with strong password:

CREATE USER 'yourusername'@'%' IDENTIFIED WITH mysql_native_password BY 'yourusername_mysql_password';

Grant permissions to user:

GRANT ALL ON yoursite.* TO 'yourusername'@'%';

Creating a Virtual Host for your Website

Follow “How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 20.04.” Continue with step 4 to create a virtual host.

Create the directory for your_domain:

sudo mkdir /var/www/yoursite.com

Assign ownership:

sudo chown -R $USER:$USER /var/www/yoursite.com

Open a new configuration file in Apache’s sites-available directory using nano (command-line editor):

sudo nano /etc/apache2/sites-available/yoursite.com.conf

Paste in the following configuration:

<VirtualHost *:80>
    ServerName yoursite.com
    ServerAlias www.yoursite.com 
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/yoursite.com/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Change owner (chown) recursively (-R):

sudo chown -R www-data:www-data /var/www/yoursite.com

Change user (usermod), append (-a), group (-G):

sudo usermod -a -G www-data yourusername

Change group ownership (chgrp) recursively (-R):

sudo chgrp -R www-data /var/www/yoursite.com

Change permissions with chmod command recursively (-R) with write permission for group (g+w)

sudo chmod -R g+w /var/www/yoursite.com

Change owner www:date to yourusername:

sudo chown -R yourusername /var/www/yoursite.com/wp-content/themes

Change permission for directory:

sudo find /var/www/yoursite.com/ -type d -exec chmod 755 {} \;

Change permission for files:

sudo find /var/www/yoursite.com/ -type f -exec chmod 644 {} \;

Edit WordPress config file:

sudo nano /var/www/yoursite.com/wp-config.php

How to Set Up Virtual Hosts

If you are setting up your Droplet for the first time, follow “How To Install the Apache Web Server on Ubuntu 20.04” to install Apache. Step 5 is where you set up virtual hosts.

Create the directory for your_domain:

sudo mkdir -p /var/www/yoursite.com/public_html

Assign ownership of the directory:

sudo chown -R $USER:$USER /var/www/yoursite.com/public_html

Set up permissions:

sudo chmod -R 755 /var/www

Copy an existing virtual host file:

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/yoursite.com.conf

Make updates for the new directory and domain name:

sudo nano /etc/apache2/sites-available/yoursite.com.conf

Edit thee following lines in :

ServerName yoursite.com
ServerAlias www.yoursite.com
DocumentRoot /var/www/yoursite.com/public_html

Enable the file with the a2ensite tool:

sudo a2ensite yoursite.com.conf

Disable the default site defined in 000-default.conf:

sudo a2dissite 000-default.conf

Restart Apache

sudo systemctl restart apache2

Let’s Encrypt

To set up SSL certificate using Let’s Encrypt, follow “How To Secure Apache with Let’s Encrypt on Ubuntu 20.04.” Let’s Encrypt will generate the follow file, you can take a look:

sudo nano /etc/apache2/sites-available/yoursite.com-le-ssl.conf

Replacing CMS

It seems as if the top has determined to migrate off MODX to a CMS that would provide a live editing capability. MODX has been great to work with for over a decade and has proven to be a solid content manage system. If I were to make the decision, I would not switch it to anything else. The decision, however, is not for me to make; therefore, I will let it go.

On the positive side, I will no longer have to maintain the system, which was part of my responsibilities carried over from when I was still a web developer. I won’t have to worry if the site needs upgrade, goes down, or gets hacked. Until we migrated over to MODX Cloud several years ago, I lost countless nights of sleep worrying about the website. I was stressed out because it was on my mind the whole time. I still bear the responsibility of the website, but I feel less stress because the site is now managed and secured on MODX Cloud.

When we move off MODX, I will focus my attention on being director of design and web services without having to be hands-on like I am doing now. So yes, let’s bring on a new CMS to replace MODX. I am all in.

Upgraded to MODX 3.0.2

When MODX 3.0 released in April this year, I couldn’t make the upgrade from 2.8.3 for the Law School site because Extras including getResource and Article weren’t compatible. I had to waited out. When MODX 3.0.2 came out yesterday, I ran another test upgrade this morning and I was able to upgrade from 2.8.4 to 3.0.2 successfully. I come across an issue with the log-in page, but it’s just the display. It looks like the CSS file is missing.The new MODX interface will need a bit of time to get used to, but I am so glad that we stay with this CMS. It rocks!

Full-Screen Banner

As I am working on the redesign for Scalia Law website, I am doing some research on the top-ranking law schools to see what they are up to these days. I checked out Yale, Stanford, University of Chicago, Columbia as well as our peers including Wake Forest, OSU, and Georgetown. The trend I am seeing is that every site uses a full-screen banner on the homepage.

We were not using full-screen banners because they required large images. We had three or more rotating banners, which tripled up our homepage loading time. If we wanted to take the full-screen route, I suggested that we only load one banner at a time, which is what I am seeing on these sites. They are moving away from the slider. I proposed that we load a different banner each time someone visits our homepage.

To perform a random load, I searched up MODX and I could not find anything simple like a PHP random function. Then I came across the &sortby=`RAND()` parameter from the getResources extra. Here’s the code for that:

[[!getResources? &parents=`12345`  &tpl=`RandomHomepageBanner` &limit=`1` &showHidden=`0`    &includeTVs=`1` &tvPrefix=``  &sortby=`RAND()`]]

I showed the mockup and it was approved. I implemented it on our homepage. Somehow a full-screen banner made our site more “modern.”

Why We Shouldn’t Embed Twitter

Here are my concerns about embedding Twitter:

  1. Because we embed Twitter into our homepage, we carry an extra load, which slows down our homepage performance.
  2. Twitter design doesn’t blend well with our design. We don’t have any control of how it looks. The typefaces and colors are different. Twitter’s blue doesn’t go with our brand colors. Although we both use sans serif typefaces, our sans has a friendly, humanist quality to it. Twitter’s sans is geometric and corporate.
  3. Privacy worries me the most. By embedding Twitter on our site, we give Twitter permission to track our users.

Here’s Twitter’s policy on privacy:

When you view Twitter content such as embedded Tweets, buttons, or timelines integrated into other websites using Twitter for Websites, Twitter may receive information, including the web page you visited, your IP address, browser type, operating system, and cookie information.

Instead of embedding Twitter, why don’t we do it like the podcasts? We list all of the Twitter accounts, including the centers so they can also get exposure on our homepage. Here’s the implementation.