Allows a quick deployment of jekyll generated websites
bash, version 4+
How to use it?
You have to edit the script to change the
distant_folders hash, which contains a list of two parameters for each distant site:
- the url of the website
- the destination folder of the website
For example, if you have 2 websites, and want to deploy in these folders:
Then you have to edit the script like this:
distant_folders=( ['site1.com']='/var/www/mainsite/' ['site2.com']='/var/www/backup/' )
Don't forget to change the rights on the file:
sudo chmod 777 deploy_jekyll.sh
777 is not too strong, as you may want to add this script to your commits and allow fellow contributors to execute and edit it.
How does it work?
- The script checks if you configured a special folder in the build process, the default folder being
- Then, it synchronizes this folder with the folders of your real websites, using
rsyncdoesn't work for some reason, you get an error message and the reason why it didn't work.
Why should I use this script and not my
- You may not want to deploy your website everytime you commit. Sometimes you commit just to save your changes, and you don't want the user to see them.
- You may also do not want to have to commit in order to deploy. Sometimes, you deploy what you already have, for example on new servers or on an existing server that you have changed.
- The method described on Jekyll website sure works, but you must have installed Jekyll on your distant server, push all the changes of the source, and build the whole site again (what you've already done on your computer).
- Sometimes, you may not be allowed to install
jekyllon the remote server, whereas
rsyncis pretty common, from my experience.
- Because everybody uses the
gitmethod, so let's be original and find another one.
Nothing for the moment, everything works fine for me and I didn't receive any feedback yet!