Hamish Fleming

Vincit qui se vincit
Neovim Arch

This is my personal blog where I write small tutorials and notes worth sharing.


I use Arch btw

Deploying a Hugo Site To GoDaddy Shared Hosting

Introduction

As my first post I thought it would be fitting to document the steps needed to pry some additional privelages from GoDaddies vice grip, enough to get rsync working atleast.

While it is simple enough to spin up a droplet on Digital Ocean, or to actually make use of the ‘generator’ part of ‘static site generator’, to upload the built site through Cpanel or SSH.

However I decided this is the perfect oportunity to learn to use rsync along with making use of a spare hosting package I had floating around on godaddy.

The Goals:

  1. Login handled by SSH
  2. Be able to deploy the hugo site using rsync
  3. Never need to touch Cpanel again

The Basics:

Connecting To Your Server Via SSH

ssh username@ipadress

Setting up rsync

Unfortunatly (and unsurprisingly) you don’t have access to sudo from a shared hosting account.Not to worry though, we have access to wget/curl so while we don’t have acceess to the ubuntu Aptitude package manager we can use the above mentioned binaries to directly download and install rsync that way.

I recomend making a folder to download any binaries you would like to install, in this instance I use ‘.bin’

# Make your folder
mkdir ~/.bin
#And Move Into it
cd .bin
#Download the binary
wget http://www.oerinet.net/files/godaddy_bin/rsync.gz
gunzip rsync.gz
# And make  it executable
chmod +x rsync

Now you need to add the bin folder to your path

cd ~/
echo '#!/bin/bash'>~/.bash_profile
echo 'PATH="$HOME/.bin:$PATH"'>>~/.bash_profile
chmod +x ~/.bash_profile

The above block of code just adds the custom folder to your path on your next login.

Sync Script

The next thing to do is write a quick bash script to automate thelong rsync command you need to run to get your files onto the server.

    #!/bin/bash
    ~/bin/rsync -viPprtl --stats \
    #path to rsync on your server
      --rsync-path /var/chroot/home/content/12/3456789/.bin/rsync \
      -e ssh /path/to/local/files/public/* \
      username@domain.com:/path/to/your/folder/www

This is the script you will run on your local machine, put it somewhere you can find it -such as your hugo project root- or somewhere already on your path.

Just remember to make it executable by:

chmod +x filename.sh

Building your Hugo Site

Okay so this should be the easy part…. right?

It is, but I had one last problem pop up when I tried building my site I had a few errors relating to using SCSS/SASS in place of CSS.

After a few minutes of google-fu I found the way to resolve the issue wasy to install the extended version of hugo, as I’m currently on ubuntu and had installed hugo via snap it was an easy fix.

sudo snap refresh hugo --channel=extended

It was then as simple as running the rsync script we wrote earlier and Viola!

Recent Articles

How to Set up a Sticky YouTube Player In Awesome WM

YouTube Player That Sticks Around After seeing an unfortunate amount of Redit threads along the lines of “How to make awesome remember position and size of floating windows” and “How to limit the width of apps” while searching ……

Awesome WMYoutube Continue Reading
More Like this

Github Projects

Loading the data just for you. My Public Github Repos See All Atlasian-Docker-Compose-Stack 0 0 Shell Aura-fox 0 0 Lua awesome-wm-widgets Widgets for Awesome Window Manager 0 0 AWS-CloudFormation-Templates 0 0 barebones-base-monitoring 0 0 Shell ……

ProjectsGithub Read More

Comments....