Personal Hugo Site w/ UF CISE
This site is hosted by UF CISE, which currently offers free personal website hosting for all CISE accounts. All students, faculty, and employees in the CISE department (anyone within CEN, CSC, or IES) are eligible for an account.
Web hosting is affordable, but free is free - which is helpful for students experimenting with web design or in need of a portfolio page.
CISE Accounts and Web Hosting
All CISE accounts are given a Universal Home Space within the CISE server, which is accessible from computers in the network. As the personal website is kept here, you must either access the network using the on-campus computer labs or by SSHing into a bastion server. My time on my account has all been remotely through SSH.
The steps to setup the website are kept here. You must create a public_html
folder in the home directory, and an index.html
page inside. Afterwards, the site should be accessible at http://www.cise.ufl.edu/~USERNAME/
, like this site.
Notable are the permissions required by the site files. As the setup page explains, both the home directory (~
) and the ~/public_html
directory must be group/world executable - chmod 755
. All files within public_html
must also be group/world readable - chmod 644
.
Static Site Generators and Hugo
Setting up the bare bones of the site shouldn’t take too long after getting a CISE account, but the site will be empty until you add content. While writing HTML by hand is possible, use a Static Site Generator (SSG) if you plan on adding more content than just a front page.
This site uses Hugo along with a homemade theme. The advantage of SSGs is in creating additional, similarly-formatted pages. For example, the footers and headers are similar throughout this site. Hugo automatically adds them, letting me focus only on the content for each page.
Hugo “compiles” the website from a collection of template html files and markdown content files. This compiled folder (public/
by default) must then be transfered to the CISE servers. I wrote the script below to automate this. It asks for the user’s Gatorlink password twice per run.
1import pysftp
2import subprocess
3
4hostname = " "
5sourceDir = "public/"
6sourceTar = "hugo_personal.tar.gz"
7gator_user = " "
8password = input("Enter UF Password: ")
9
10
11def runBash(bashCommand):
12 process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
13 output, error = process.communicate()
14 return output, error
15# chmod -R 755 public/ directory
16out, _ = runBash(f"chmod -R 755 {sourceDir}")
17print(out)
18# Zip public/ directory
19out, _ = runBash(f"tar -zcvf {sourceTar} {sourceDir}")
20print(out)
21
22# sftp put file into uf server
23with pysftp.Connection(
24 host=hostname,
25 username=gator_user,
26 password=password) as sftp:
27 sftp.put(sourceTar)
28
29# ssh into uf server
30 # unzip archive
31 # delete old public_html/
32 # rename unzipped public/ to public_html/
33commands = [f"tar -zxvf {sourceTar} {sourceDir}",
34 "rm -R public_html/",
35 "mv public/ public_html"]
36out, _ = subprocess.Popen(f"ssh {gator_user}@{hostname} \"{" && ".join(commands)}\"",
37 shell=True, stdout=subprocess.PIPE,
38 stderr=subprocess.PIPE).communicate()
39print(out)
The script only requires pysftp
to be installed. hostname
should be replaced with the bastion server address found here, and gator_user
replaced with your UF username.