Browse Source

Add reboot failure blog post; add compressed images for lightbox

master
Devin Dooley 1 year ago
parent
commit
b4fe98a1f5
10 changed files with 96 additions and 6 deletions
  1. +7
    -0
      Makefile
  2. +8
    -3
      assets/scripts/image-modal.js
  3. +7
    -0
      build/photo_rename.sh
  4. +1
    -1
      config.toml
  5. +0
    -0
      content/blog/ragbrai.md
  6. +64
    -0
      content/blog/reboot-failures.md
  7. +0
    -0
      content/blog/site-deploy.md
  8. +0
    -0
      content/blog/site-purpose.md
  9. +1
    -1
      content/blog/site-serve.md
  10. +8
    -1
      layouts/gallery/list.html

+ 7
- 0
Makefile View File

@ -0,0 +1,7 @@
build: hugo_build rename_photos
hugo_build:
hugo -v --gc
rename_photos:
bash build/photo_rename.sh

+ 8
- 3
assets/scripts/image-modal.js View File

@ -51,7 +51,7 @@ class ImageModal {
this.modalImageAnchor.setAttribute('href', e.currentTarget.getAttribute('href'));
this.modal.style.display = 'block';
this.currentIndex = Number(e.currentTarget.getAttribute('id'));
this.modalImage.src = e.currentTarget.getAttribute('href');
this.modalImage.src = this.getLightboxImage(e.currentTarget.getAttribute('href'));
}
closeModal() {
@ -64,7 +64,7 @@ class ImageModal {
if (this.currentIndex > this.urls.length) { return };
this.modalImage.src = this.loadingAnimation;
this.currentIndex += 1;
this.modalImage.src = this.urls[this.currentIndex];
this.modalImage.src = this.getLightboxImage(this.urls[this.currentIndex]);
this.modalImageAnchor.setAttribute('href', this.urls[this.currentIndex]);
}
@ -72,9 +72,14 @@ class ImageModal {
if (this.currentIndex <= 0) { return };
this.modalImage.src = this.loadingAnimation;
this.currentIndex -= 1;
this.modalImage.src = this.urls[this.currentIndex];
this.modalImage.src = this.getLightboxImage(this.urls[this.currentIndex]);
this.modalImageAnchor.setAttribute('href', this.urls[this.currentIndex]);
}
getLightboxImage(s) {
let s_split = s.split('.');
return s_split[0] + '_lightbox.' + s_split[1];
}
}
var imageModal = new ImageModal();


+ 7
- 0
build/photo_rename.sh View File

@ -0,0 +1,7 @@
#!/bin/sh
for file in public/photos/*/*resize_q30_box.jpg; do
if [ -e "$file" ]; then
newname=`echo "$file" | sed -E 's/(.*)\/(.*)\/(.*)\/(.*)_(.*)_(.*)__(.*)_(.*)_(.*)_(.*)_(.*)_(.*)_(.*)_box.jpg/\1\/\2\/\3\/\4_\5_\6__\7_\8_lightbox.jpg/'`
mv "$file" "$newname"
fi
done

+ 1
- 1
config.toml View File

@ -4,5 +4,5 @@ title = "Devin A. Dooley"
[markup]
[markup.highlight]
style = "monokai"
style = "monokailight"
tabWidth = 2

content/blog/travel/ragbrai.md → content/blog/ragbrai.md View File


+ 64
- 0
content/blog/reboot-failures.md View File

@ -0,0 +1,64 @@
---
title: "Drive Mount Failing on Reboot"
date: "2020-03-05"
---
Last Tuesday I got an email from Let's Encrypt that they needed to revoke a few million certificates
that they had issued, and that the certificate I was using for this website happened to be one of
them. I wasn't particularly bothered; they seemed to have a handle on things and I generally
prefer bugs that are found and fixed than bugs that are left to cause trouble.
When I got to work I logged into my server figuring I could update the certificate quickly and be on
my way. There's no real reason to go into detail, so I'll just say that it was not simple, and I
quickly got frustrated and forgot about it until the next day.
On the morning of March 4th when I went back on my server, it appeared that
my `nginx` process had not fully stopped during a restart and `systemd` couldn't start the service
again because the ports it was trying to serve on were still open. I figured it would be easiest
to reboot my machine rather than deal with this mess, so I thoughtlessly typed out `systemctl
reboot`, chatted a bit on Slack, and attempted to log back on to my server. After trying to `ssh`
in a few times it became apparent that something was wrong, since my server's IP was not being resolved.
This wasn't much of a problem -- nobody looks at this website anyway. It was, however, a bit of a
pain getting through the workday without my Plex library.
When I got home I plugged my server into the TV that sits next to it and got to work. Arch was
booted into emergency mode and prompted me to log in as the root user and check the logs.
Rather than tail the logs like a sane person, I skimmed through the entire session's logs from start
to end before finding these entries:
{{< highlight diff >}}
Mar 04 17:50:28 user systemd[1]: local-fs.target: Job local-fs.target/start failed with result 'dependency'.
Mar 04 17:50:28 user systemd[1]: Dependency failed for Local File Systems.
Mar 04 17:50:28 user systemd[1]: Failed to mount /media.
Mar 04 17:50:28 user systemd[1]: media.mount: Failed with result 'exit-code'.
Mar 04 17:50:28 user systemd[1]: media.mount: Mount process exited, code=exited, status=12/n/a
{{< / highlight >}}
I've always been surprised that the NTFS drive I have mounted at `/media` actually works. It's been
completely painless ever since I set it up, and Plex has been serving files from it
without any extra configuration or errors. However, it was so long since I set it up that I completely forgot
what it was that I did to get it working.
I pulled up my `/etc/fstab` file and found the entry for my media drive:
{{< highlight bash >}}
UUID=$UUID1 / ext4 rw,relatime 0 1
/dev/sdb2 /media ntfs-3g defaults 0 0
{{< / highlight >}}
Well there's the problem.
My drive was attempting to mount `/dev/sdb2` to `/media`, but when I listed my drives with
`fdisk -l`, the drive I wanted appeared to exist at `/dev/sdd2`. I rebooted the server again with
`systemctl reboot`, and the drive I wanted showed up this time at `/dev/sdc2`. It had for some reason
never occurred to me that these values might change on reboot, since the 4 hard drives I have
connected to this machine are never switching connectors. That being said, a quick skim of the Arch
Wiki made me realize how wrong I was. It seems that I had just gotten lucky the few times
I had rebooted this machine since mounting the media drive, and was less lucky the last two days.
All that needed to be done was to reference the drive by its UUID like so:
{{< highlight bash >}}
UUID=$UUID1 / ext4 rw,relatime 0 1
UUID=$UUID2 /media ntfs-3g defaults 0 0
{{< / highlight >}}
After another reboot, everything came up without an issue, and my certificates finally renewed on my
next attempt :)

content/blog/technical/site-deploy.md → content/blog/site-deploy.md View File


content/blog/technical/purpose.md → content/blog/site-purpose.md View File


content/blog/technical/site-serve.md → content/blog/site-serve.md View File

@ -70,7 +70,7 @@ on the server. This means that `/var/www/devinadooley.com/index.html` correspond
to this site's homepage.
Error pages can be configured if you wish, otherwise you can use the default error
pages given by nginx. Here I'm using a custom 404.html file to serve when
pages given by nginx. Here I'm using a custom `404.html` file to serve when
a 404 response is returned. The location `/404.html` means that the file will
be located at the root of the server location `/`, i.e.
`/var/www/devinadooley.com/404.html`. Rather than configure my own error pages in the

+ 8
- 1
layouts/gallery/list.html View File

@ -9,9 +9,16 @@
</div>
<div class="gallery">
<!--
{{ with .Resources.ByType "image" }}
{{ range $index, $image := . }}
<a href="{{ $image.RelPermalink }}" title="{{ $image.Title }}" id="{{ $index }}">
{{ $image.Resize "5000x q30" }}
{{ end }}
{{ end }}
-->
{{ with .Resources.ByType "image" }}
{{ range $index, $image := . }}
<a href="{{ $image.RelPermalink }}" title="{{ $image.Title }}" id="{{ $index }}">
<img class="hover-shadow" src="{{ ($image.Fill "200x200 smart").RelPermalink }}"/>
</a>
{{ end }}


Loading…
Cancel
Save