diff --git a/README.md b/README.md index ffad688..b403cd4 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,6 @@ You need docker-compose. Simply run `docker-compose up` to launch the site in a docker container with livereload support. -## Deploy to FTP with Docker -Make sure that you have created a file in `_scripts/` called `config.sh`, protip: just duplicate the `config-example.sh` file, and set the correct values, you should only need to change username and password. Then you can build the site ande deploy if by running `docker-compose -f docker-compose-deploy.yml up` - ### Or install Jekyll locally #### Install Jekyll and Bundler gems through RubyGems @@ -24,7 +21,10 @@ You can now see the site at [localhost:4000](http://localhost:4000) ## Deploy -It's **important** that you build the site with `JEKYLL_ENV=production bundle exec jekyll build` before deploying the contents of the `_site` directory. We're doing some debugging stuff when then project is build in the development env. +If not using Docker, it's **important** that you build the site with `JEKYLL_ENV=production bundle exec jekyll build` before deploying the contents of the `_site` directory. We're doing some debugging stuff when the project is build in the development env. + +### Deploy to FTP with Docker +Make sure that you have created a file in `_scripts/` called `config.sh`, (protip: just duplicate the `config-example.sh` file, and set the correct values, you should only need to change username and password.) Then you can build the site ande deploy it by running `docker-compose -f docker-compose-deploy.yml up` ## Structure -The contents of the index page is defined in the frontmatter of the file `index.md` \ No newline at end of file +The contents of the index pages is defined in the frontmatter of the files `_pages/index-.md` \ No newline at end of file diff --git a/_config.yml b/_config.yml index 299dde5..768f44b 100644 --- a/_config.yml +++ b/_config.yml @@ -20,6 +20,9 @@ description: >- # this means to ignore newlines until "baseurl:" Nu gør vi noget ved det! #ulovligLogning baseurl: "" # the subpath of your site, e.g. /blog url: "https://ulovliglogning.dk" # the base hostname & protocol for your site, e.g. http://example.com +donationCounter: + donated: 110000 + goal: 250000 # multilanguage support languages: ["da", "en"] @@ -30,7 +33,7 @@ parallel_localization: false # Build settings permalink: /:title/ markdown: kramdown -exclude: ["README.md", 'Gemfile.lock', 'Gemfile', "docker-compose.yml"] +exclude: ["README.md", 'Gemfile.lock', 'Gemfile', "docker-compose*.yml"] include: ["_pages"] plugins: - jekyll-feed diff --git a/_scripts/build-then-deploy.sh b/_scripts/build-then-deploy.sh index 5411730..80fd275 100644 --- a/_scripts/build-then-deploy.sh +++ b/_scripts/build-then-deploy.sh @@ -1,13 +1,35 @@ -#!/bin/sh -set -e +#!/bin/bash + +error="\033[0;31m" +success="\033[0;32m" +normal="\033[0m" #get config vars source _scripts/config.sh +if [[ -z $jekyll_dir || -z $remote_username || -z $remote_password || -z $remote_host || -z $remote_dir ]]; then + echo -e "${error}FAILED: You have ommited one or more values from the config file, see the 'config-example.sh' file for the required values.${normal}" + exit 1 +fi + +echo -e "${success}Starting build…${normal}" + #Disable SSL check for lftp, this fails on our host :( echo "set ssl:verify-certificate no" > ~/.lftprc if [ -d "$jekyll_dir" ]; then - jekyll build - lftp -u ${remote_username},${remote_password} -e "mirror -R -p -P=10 --ignore-time -v ${jekyll_dir}/_site/ ${remote_dir};quit" ftp://${remote_host} + jekyll build --strict_front_matter + if [[ $? != 0 ]]; then + echo -e "${error}FAILED: DID NOT DEPLOY!${normal}" + exit 1 + else + echo -e "${success}Build succeded, now uploading to FTP server${normal}" + lftp -u ${remote_username},${remote_password} -e "mirror -R -p -P=10 --ignore-time -v ${jekyll_dir}/_site/ ${remote_dir};quit" ftp://${remote_host} + if [[ $? != 0 ]]; then + echo -e "${error}FAILED: Something went wrong trying to upload to the FTP server${normal}" + exit 1 + else + echo -e "${success}FTP upload complete, deployment DONE!${normal}" + fi + fi fi \ No newline at end of file diff --git a/_scripts/config-example.sh b/_scripts/config-example.sh index 81bc2da..91b285f 100644 --- a/_scripts/config-example.sh +++ b/_scripts/config-example.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash jekyll_dir="/srv/jekyll" remote_host="ulovliglogning.dk" diff --git a/docker-compose-deploy.yml b/docker-compose-deploy.yml index aa9c398..e5f8997 100644 --- a/docker-compose-deploy.yml +++ b/docker-compose-deploy.yml @@ -1,7 +1,7 @@ jekyll: image: jekyll/builder - command: sh /srv/jekyll/_scripts/build-then-deploy.sh + command: bash /srv/jekyll/_scripts/build-then-deploy.sh ports: - 4000:4000 volumes: