From 433f2ee34385d664a607a84042af46b8b907c456 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Sun, 1 Oct 2017 11:51:51 +0200 Subject: [PATCH] Add template for running the mbox-experimental importer --- templates/import/mbox.template.yml | 48 ++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 templates/import/mbox.template.yml diff --git a/templates/import/mbox.template.yml b/templates/import/mbox.template.yml new file mode 100644 index 0000000..840e59b --- /dev/null +++ b/templates/import/mbox.template.yml @@ -0,0 +1,48 @@ +# This template configures the container for importing emails and mbox files. + +params: + home: /var/www/discourse + +hooks: + after_web_config: + - exec: + cd: /etc/service + cmd: + - rm -R unicorn + - rm -R nginx + - rm -R cron + + - exec: + cd: /etc/runit/3.d + cmd: + - rm 01-nginx + - rm 02-unicorn + + - file: + path: /usr/local/bin/import_mbox.sh + chmod: "+x" + contents: | + #!/bin/bash + set -e + + chown discourse /shared/import/settings.yml + chown discourse -R /shared/import/data + + cd $home + echo "The mbox import is starting..." + echo + su discourse -c 'IMPORT=1 bundle exec ruby script/import_scripts/mbox-experimental.rb /shared/import/settings.yml' + + - exec: + cd: $home + cmd: + - mkdir -p /shared/import/data + - chown discourse -R /shared/import + - cp -n script/import_scripts/mbox/settings.yml /shared/import/settings.yml + + after_bundle_exec: + - exec: + cd: $home + cmd: + - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y libmysqlclient-dev libsqlite3-dev + - su discourse -c 'IMPORT=1 bundle install --no-deployment --without test --without development --path vendor/bundle' -- 2.25.1