devopsdays / devopsdays-web

This is the website for devopsdays
https://www.devopsdays.org
Other
176 stars 664 forks source link

[ENHANCEMENT] Updated Windows hugoserver.ps1 script #7318

Closed DefSol closed 4 years ago

DefSol commented 5 years ago

Having any sort of fast feedback using a Hugo container (with or without the provided hugoserver.ps1 script) seems to be a hopeless situation. I understand windows contributors are by far the minority, but I'm hoping this solution will go some way in providing a better development experience for windows contributors.

There are a number of non trivial constraints that make the development experience sunig Linux containers on windows sub optimal. These include Inotify issues in Docker between Windows and Linux - see https://github.com/docker/for-win/issues/56

Although there are known utilities to aid with such constraints (https://github.com/merofeev/docker-windows-volume-watcher) there are still issues as noted here https://github.com/merofeev/docker-windows-volume-watcher/issues/4

I have re-written the hugoserver.ps1 script which will

The hugoserver.ps1 needs to be dot sourced . .\hugoserver.ps1 which will then expose the function Invoke-HugoWatch. the function takes 2 parameters - year and city which it uses to build a path to `data\events[year]-[city].yml

The function has side effects, namely the appending of #Watch Triggered to the data file

The function source can be found here https://github.com/DevOpsEventsNZ/devopsdays-web/blob/rdunn/WindowsHugoContainerUpdate/hugoserver.ps1

If this is helpful, happy to submit a PR

kmugrage commented 5 years ago

I can test this on my Windows box but probably not until early next week.

DefSol commented 5 years ago

Hey @kmugrage all good, appreciate any feedback.

DefSol commented 5 years ago

hey @kmugrage I found some cases where this fell short my my expectations, so hold off for now and I'll make some improvements

bridgetkromhout commented 5 years ago

Thanks for working on this, @DefSol! I appreciate you contributing something I don't have enough context to do myself! :)

DefSol commented 5 years ago

Kia ora @bridgetkromhout it's my pleasure :)

DefSol commented 5 years ago

Looking into this further, it seems I greatly underestimated the work involved - the number of files that could change make any solution somewhat poor. Given the work with WSL2 and if you're a fan of the container workflow - then this would definitely be the better option. you would be able to run the Linux helpers on docker in WSL2, so no need for any *.ps1 equivalents

Failing that the best way would be to run Hugo interactively on windows.

@bridgetkromhout @kmugrage fyi, I intend to close this issue tomorrow (well 24 hours lol).