ssh’ing into my Digital Ocean droplet has become rather annoying for maintaining this website. Particularly annoying is dealing with images on two different filesystems. In the README (commit 1a0ee5a), I describe the steps I have been doing to publish an article to https://brege.org.
I tried implementing this method, but it is very long and requires many modifications to the post-receive hook to get it working on a per-user basis.
Here I outline a way to do this in a more conservative manner.
Installation on development machine
sudo dnf install golang
mkdir -p ~/Build/go
export GOPATH=$HOME/Build/go
go get -v github.com/spf13/hugo
- Clone repository
cd ~/Build/
git clone git://github.com/brege/brege.org.git
New workflow for publishing an article
- I once again use Hugo to create my article
cd ~/Build/brege.org
hugo new post/new-way-forward-for-deploying-brege.org.md
-
Add content, run
hugo server
, then preview http://localhost:1313 in a browser to determine what needs to be edited. The cool thing about this is you can edit/add a file while the test server is running. You don’t even need to refresh the browser page whenever you save the file! -
Run
rm -r public/ ; hugo
to remove the old and create the newpublic/
directory on the development machine. -
Ship the changes to the production server (DO droplet) with rsync:
rsync -avP --delete --exclude=".well-known" public/ brege.org:/usr/share/nginx/brege.org/
The new article will now show up on the https://brege.org/post/new-way-forward-for-deploying-brege/
- Finally, commit the new article to GitHub:
git add content/post/new-way-forward-for-deploying-brege.org.md
git commit -m "Add article"
git push -u origin master
Much nicer way to go about it. Images and other assets can be more readily copied and modified. I can edit a webpage on the fly before publishing layout-bugs and typos to the world (or, at least to a lesser extent).