Selfhosting a Hugo blog with mysocket.io

…that time when you realize your blog is hosted on a web site who’s sole purpose is to support coding, and they plaster the motto

“Learn Git and Github without any code!”

all over their site, and you realize that its been taken over by marketing clones … and it’s time to do your geekly exit stage left and self host on a raspberry pi or something…

This is a HOWTO of the things I did to migrate my HUGO blog off github onto a self-hosted raspberry pi using mysocket.io.

The original setup is described here Publishing a blog on Github with Org and Hugo

1 Do normal development with local hugo server

In =${HUGO_BASE_DIR}

gmj@ed blog [master] $ hugo server -v -D

browse to http//localhost:1313 to see updates in realtime.

2 Update config.toml

In ${HUGO_BASE_DIR}/config.toml update the following:

# baseurl = "https://eludom.github.io/"
baseurl = "https://curious.galthub.com/

#homepage = "eludom.github.io"
homepage = "curious.galthub.com"

3 run hugo to regenerate docs

The docs/ directory will be the root of your webserver

gmj@ed blog [master] $ hugo
Building sites …

                   | EN
-------------------+------
  Pages            | 210
  Paginator pages  |   0
  Non-page files   |   0
  Static files     |  78
  Processed images |   0
  Aliases          |   0
  Sitemaps         |   1
  Cleaned          |   0

Total in 2718 ms
gmj@ed blog [master] $ find . -mtime -^C
gmj@ed blog [master] $ hugo server -v -D^C
gmj@ed blog [master] $ find . -mtime -5 | head
.
./.#curious.org
./curious.org
./docs/index.html
./docs/404.html
./docs/robots.txt
./docs/about/index.html
./docs/about/index.xml
./docs/sitemap.xml
./docs/tags/poetry/index.html
...

TODO 4 Copy the files to where the web server is (if needed)

Which server…

      rsync -Cavz docs gmj@hangout:~/blog

TODO 5 Run local webserver

Run a web server with the root pointed at the docs/ directory

$ cd ~/blog/docs/
$ python3 -m http.server 1313

TODO 6 Set up tunnel

Set up a tunnel

$ mysocketctl connect --port 1313 --name hugo test

TODO 7 Define CNAME

TODO 8 Add the CNAME to the allowed domain names for the tunnel

9 DONE install apache on raspberry pi using asnible

TODO 10 Make sure apache root is on USB thumb drive

TODO 11 copy/rsync blog/docs to new apache root

TODO 12 redirect apache root to blog

TODO 13 set up a new mysocket tunnel for blog/apache

TODO 14 set up CNAME curious.galthub.com pointing at tunnel

14.0.1 Test it out

curl http://curious.port111.com

14.0.2 Future


Comments