It’s an excellent post, which uses existing community steps to make things quick and easy to setup.
However something I noticed was that it’s using a full debian container and so the the build steps were doing quite a lot of work. e.g.... The following extra packages will be installed: file libexpat1 libffi6 libmagic1 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libsqlite3-0 libssl1.0.0 mime-support python python-chardet python-minimal python-pkg-resources python2.7 python2.7-minimal Suggested packages: python-doc python-tk python-distribute python-distribute-doc ttf-bitstream-vera python2.7-doc binutils binfmt-support The following NEW packages will be installed: file libexpat1 libffi6 libmagic1 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libsqlite3-0 libssl1.0.0 mime-support python python-chardet python-minimal python-pkg-resources python-pygments python2.7 python2.7-minimal 0 upgraded, 17 newly installed, 0 to remove and 0 not upgraded. Need to get 6648 kB of archives. After this operation, 27.3 MB of additional disk space will be used. ...
Being curious about the whole box/container setup required, I decided to replace the box used in the tutorial (debian), and the steps provided arjen/hugo-build with my own.
I started by installing wercker-clibrew tap wercker/wercker brew install wercker-cli
And then updated my wercker.yml file to use it, and to have a dev section.box: halberom/hugo dev: steps: - internal/watch: code: hugo server
Followed by trying it out! (and crossing fingers it would work)wercker dev
sadly not the case--> Executing pipeline --> Running step: setup environment Pulling from halberom/hugo: latest Already exists: 420890c9e918 Already exists: e4d561447a5c Already exists: f27a57ccb1c2 Already exists: 1965ea271a7c Digest: sha256:76af88bd222a8b6859c26ea696c096627d259042cf05004ef19d4c3de44906c5 Status: Image is up to date for halberom/hugo:latest ERROR --> Step failed: setup environment 2.73s Command cancelled due to error ERROR Command cancelled due to error WARNING Box container has already stopped. FATAL Exiting.
Thus ensued a bit of –debug/–verbose usage, and ultimatelyDEBU runner| Setting up guest (base box) INFO literal| [ ] stdin "mkdir -p \"/pipeline/output\"\n" INFO literal| [ ] stdin "echo 91de967b-0050-40c9-93a2-c21457c3d78e $?\n" DEBU dockertr| Container finished with status code: 127 1014921707a1284f00de616a8b1b2009cf4cecfae4ff825a2ca8707570890115
Some searching around that, and I found the following 2 very useful links
So then my wercker.yml file becamebox: id: halberom/hugo cmd: /bin/sh dev: steps: - internal/watch: cmd: /bin/sh code: hugo server build: steps: - script: name: run hugo code: | hugo deploy: box: debian steps: - install-packages: packages: git ssh-client - firstname.lastname@example.org: token: $GIT_TOKEN domain: blog.halberom.co.uk basedir: public
Testing worked, with several new folders created locally _builds, _steps, _projects, and I was able to find (under _projects) the generated output.
The new setup means I can now run
wercker dev|build locally and can easily see exactly what wercker is doing behind the scenes, in terms of dir structures and ENV variables, with verbose/debug enabled.
What’s also nice, is that now my build stage now only takes 9 seconds, vs approx 45 seconds or more previously.
Note that for now I’m sticking with the tutorial’s deploy steps, which means I still need the debian container. Next steps will be looking at that, and also finishing my hugo docker image so it’s a bit tidier.