Skip to content

Instantly share code, notes, and snippets.

@tylerflint
Last active July 18, 2017 17:04
Show Gist options
  • Save tylerflint/8fbce16b937bf1a5e00e4e85c7b19efe to your computer and use it in GitHub Desktop.
Save tylerflint/8fbce16b937bf1a5e00e4e85c7b19efe to your computer and use it in GitHub Desktop.
Install Hugo on Nanobox

Create a boxfile.yml

First create a boxfile using the content from this gist

Start the local env

nanobox run

Create a new site

cd /tmp
hugo new site NAME
cp -a NAME/* /app/
cd -

Start hugo

hugo server --bind "0.0.0.0"

Visit the app

In your browser, visit the IP or domain if added at port 1313

Develop

Write the app!

run.config:
# use the static engine
engine: static
# install hugo
extra_steps:
- bash <(curl -s -L https://tinyurl.com/y8yojxte)
#!/bin/bash
if [[ ! -f /data/bin/hugo ]]; then
cd /tmp
wget https://github.com/gohugoio/hugo/releases/download/v0.25.1/hugo_0.25.1_Linux-64bit.tar.gz
tar -xzf hugo_0.25.1_Linux-64bit.tar.gz
mv hugo /data/bin/hugo
cd -
rm -rf /tmp/*
fi
@tylerflint
Copy link
Author

Don't worry about the install.sh script. The tinyurl included in the extra_steps will pull the content and install hugo.

@Tolmark12
Copy link

You'll want to add the baseUrl flag when running the server locally:

# If you specify a custom local dns alias:
hugo server --baseUrl=mysite.dev --bind="0.0.0.0"

# If no custom dns alias, use the IP address provided by nanobox
hugo server --baseUrl=172.19.0.4 --bind="0.0.0.0"

NOTE, I haven't figured out how to get livereload to work yet, but this is the start:

run.config:
  # use the static engine
  engine: static
  # enable file watching for live reload
  fs_watch: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment