From 9fdd1c77f88216b993c12747026feb15f915eca4 Mon Sep 17 00:00:00 2001 From: Jeppe Ernst Date: Tue, 17 Apr 2018 19:31:14 +0200 Subject: [PATCH] create deployment Docker config --- .gitignore | 1 + README.md | 3 +++ _scripts/build-then-deploy.sh | 13 +++++++++++++ _scripts/config-example.sh | 8 ++++++++ docker-compose-deploy.yml | 8 ++++++++ 5 files changed, 33 insertions(+) create mode 100644 _scripts/build-then-deploy.sh create mode 100644 _scripts/config-example.sh create mode 100644 docker-compose-deploy.yml diff --git a/.gitignore b/.gitignore index 45c1505..59d6246 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ _site .sass-cache .jekyll-metadata +_scripts/config.sh \ No newline at end of file diff --git a/README.md b/README.md index 1285927..ffad688 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,9 @@ 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 diff --git a/_scripts/build-then-deploy.sh b/_scripts/build-then-deploy.sh new file mode 100644 index 0000000..5411730 --- /dev/null +++ b/_scripts/build-then-deploy.sh @@ -0,0 +1,13 @@ +#!/bin/sh +set -e + +#get config vars +source _scripts/config.sh + +#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} +fi \ No newline at end of file diff --git a/_scripts/config-example.sh b/_scripts/config-example.sh new file mode 100644 index 0000000..81bc2da --- /dev/null +++ b/_scripts/config-example.sh @@ -0,0 +1,8 @@ +#!/bin/sh +jekyll_dir="/srv/jekyll" + +remote_host="ulovliglogning.dk" +remote_dir="/" + +remote_username="username" +remote_password="SUPERSECRETPASSWORD" \ No newline at end of file diff --git a/docker-compose-deploy.yml b/docker-compose-deploy.yml new file mode 100644 index 0000000..aa9c398 --- /dev/null +++ b/docker-compose-deploy.yml @@ -0,0 +1,8 @@ + +jekyll: + image: jekyll/builder + command: sh /srv/jekyll/_scripts/build-then-deploy.sh + ports: + - 4000:4000 + volumes: + - .:/srv/jekyll