Automatyzacja wdrażania zmian stron internetowych w systemie Guix
Podstawowym utrudnieniem wdrażania Jekyll w systemie Guix jest izolacja zależności. Prowadzi to sytuacji gdzie, mimo teoretycznej instalacji wymaganych bibliotek, program wdrożeniowy zgłasza ich brak. Po dniach eksperymentów odkryłem, że te zależności nie mogą być zainstalowane obok Jekyll — muszą one być podane jako zależności Jekyll. Znaczy to, że w przypadku wykorzystania schematu Jekyll, paczka Jekyll musi być zmodyfikowana i ten zmodyfikowany wariant musi być wykorzystywany przez powłoki Guix i przez systemy automatyzujące proces wdrażania zmian stron internetowych.
Rezultat
Po zrozumieniu powyższego problemu byłem w stanie przygotować wstępną wersję haka post-receive w git. Poza samym hakiem potrzebuję również opracować prawidłową strukturę łączącą konta użytkowników biorących udział w budowie i udostępnianiu witryny internetowej, miejsce składowania udostępnianej witryny internetowej oraz ich wzajemne autoryzacje.
Hak post-receive
#!/gnu/store/cdwviyfnsfv7k57qrwmym0mrynjixc1i-bash-5.1.16/bin/bash
export JEKYLL_ENV=production
export JEKYLL_NO_BUNDLER_REQUIRE=true
export PUBLIC_WWW=/home/marek/Publiczne/www
export TMP_GIT_CLONE=$HOME/tmp/marekpasnikowski-jekyll
git clone $GIT_DIR $TMP_GIT_CLONE
jekyll build -s $TMP_GIT_CLONE -d $PUBLIC_WWW
rm -Rf $TMP_GIT_CLONE
exit
Problemy tej implementacji:
- Statyczna wartość ścieżki do pliku wykonawczego powłoki bash.
- Niepewność, czy wszystkie potrzebne zmienne środowiskowe są uwzględnione.
English
The main complication of deploying Jekyll in Guix is the isolation of dependencies. This leads to situations where, despite theoretical installation of the required libraries, the deployment program reports that they are missing. After days of experimentation, I discovered that these dependencies cannot be installed alongside Jekyll — they must be specified as Jekyll dependencies. This means that if a Jekyll theme is used, the Jekyll package must be modified and this modified variant must be used by Guix shells and by systems that automate deployment of website changes.
The result
After understanding the above problem, I was able to prepare an initial version of the post-receive hook in git. In addition to the hook itself, I also need to develop a proper structure linking the accounts of the users involved in building and hosting the website, the storage location of the hosted website and their mutual authorisations.
The post-receive hook
#!/gnu/store/cdwviyfnsfv7k57qrwmym0mrynjixc1i-bash-5.1.16/bin/bash
export JEKYLL_ENV=production
export JEKYLL_NO_BUNDLER_REQUIRE=true
export PUBLIC_WWW=/home/marek/Publiczne/www
export TMP_GIT_CLONE=$HOME/tmp/marekpasnikowski-jekyll
git clone $GIT_DIR $TMP_GIT_CLONE
jekyll build -s $TMP_GIT_CLONE -d $PUBLIC_WWW
rm -Rf $TMP_GIT_CLONE
exit
Problems of this implementation:
- Hard-coded path value to the bash shell executable.
- Uncertainty whether all necessary environment variables are included.