forked from ulovliglogning/ulovliglogning.dk
better/prettier error handling on deploy
This commit is contained in:
parent
9fdd1c77f8
commit
d702e9d484
10
README.md
10
README.md
|
@ -6,9 +6,6 @@
|
||||||
You need docker-compose. Simply run
|
You need docker-compose. Simply run
|
||||||
`docker-compose up` to launch the site in a docker container with livereload support.
|
`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
|
### Or install Jekyll locally
|
||||||
|
|
||||||
#### Install Jekyll and Bundler gems through RubyGems
|
#### Install Jekyll and Bundler gems through RubyGems
|
||||||
|
@ -24,7 +21,10 @@ You can now see the site at [localhost:4000](http://localhost:4000)
|
||||||
|
|
||||||
## Deploy
|
## 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
|
## Structure
|
||||||
The contents of the index page is defined in the frontmatter of the file `index.md`
|
The contents of the index pages is defined in the frontmatter of the files `_pages/index-<language>.md`
|
|
@ -20,6 +20,9 @@ description: >- # this means to ignore newlines until "baseurl:"
|
||||||
Nu gør vi noget ved det! #ulovligLogning
|
Nu gør vi noget ved det! #ulovligLogning
|
||||||
baseurl: "" # the subpath of your site, e.g. /blog
|
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
|
url: "https://ulovliglogning.dk" # the base hostname & protocol for your site, e.g. http://example.com
|
||||||
|
donationCounter:
|
||||||
|
donated: 110000
|
||||||
|
goal: 250000
|
||||||
|
|
||||||
# multilanguage support
|
# multilanguage support
|
||||||
languages: ["da", "en"]
|
languages: ["da", "en"]
|
||||||
|
@ -30,7 +33,7 @@ parallel_localization: false
|
||||||
# Build settings
|
# Build settings
|
||||||
permalink: /:title/
|
permalink: /:title/
|
||||||
markdown: kramdown
|
markdown: kramdown
|
||||||
exclude: ["README.md", 'Gemfile.lock', 'Gemfile', "docker-compose.yml"]
|
exclude: ["README.md", 'Gemfile.lock', 'Gemfile', "docker-compose*.yml"]
|
||||||
include: ["_pages"]
|
include: ["_pages"]
|
||||||
plugins:
|
plugins:
|
||||||
- jekyll-feed
|
- jekyll-feed
|
||||||
|
|
|
@ -1,13 +1,35 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
set -e
|
|
||||||
|
error="\033[0;31m"
|
||||||
|
success="\033[0;32m"
|
||||||
|
normal="\033[0m"
|
||||||
|
|
||||||
#get config vars
|
#get config vars
|
||||||
source _scripts/config.sh
|
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 :(
|
#Disable SSL check for lftp, this fails on our host :(
|
||||||
echo "set ssl:verify-certificate no" > ~/.lftprc
|
echo "set ssl:verify-certificate no" > ~/.lftprc
|
||||||
|
|
||||||
if [ -d "$jekyll_dir" ]; then
|
if [ -d "$jekyll_dir" ]; then
|
||||||
jekyll build
|
jekyll build --strict_front_matter
|
||||||
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: 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
|
fi
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
jekyll_dir="/srv/jekyll"
|
jekyll_dir="/srv/jekyll"
|
||||||
|
|
||||||
remote_host="ulovliglogning.dk"
|
remote_host="ulovliglogning.dk"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
jekyll:
|
jekyll:
|
||||||
image: jekyll/builder
|
image: jekyll/builder
|
||||||
command: sh /srv/jekyll/_scripts/build-then-deploy.sh
|
command: bash /srv/jekyll/_scripts/build-then-deploy.sh
|
||||||
ports:
|
ports:
|
||||||
- 4000:4000
|
- 4000:4000
|
||||||
volumes:
|
volumes:
|
||||||
|
|
Loading…
Reference in a new issue