setup 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. set -e
  3. # Initialize variables used by Huginn at installation time
  4. # Huginn is 12factor aware, embrace that fact for use inside of docker
  5. ON_HEROKU=${ON_HEROKU:-true}
  6. # Shallow clone the huginn project repo
  7. git clone --depth 1 https://github.com/cantino/huginn /app
  8. cd /app
  9. # add a huginn group and user
  10. adduser --group huginn
  11. adduser --disabled-login --ingroup huginn --gecos 'Huginn' --no-create-home --home /app huginn
  12. adduser huginn sudo
  13. passwd -d huginn
  14. # Change the ownership to huginn
  15. chown -R huginn:huginn /app
  16. # create required tmp and log directories
  17. sudo -u huginn -H mkdir -p tmp/pids tmp/cache tmp/sockets log
  18. chmod -R u+rwX log tmp
  19. # install gems required by Huginn, use local cache if available
  20. if [ -d "/scripts/cache" ]; then
  21. mv /scripts/cache vendor/
  22. chown -R huginn:huginn vendor/cache
  23. fi
  24. sudo -u huginn -H bundle install --deployment --without development test
  25. # silence setlocale message (THANKS DEBIAN!)
  26. cat > /etc/default/locale <<EOF
  27. LC_ALL=en_US.UTF-8
  28. LANG=en_US.UTF-8
  29. EOF