wikijs-install.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/usr/bin/env bash
  2. # Copyright (c) 2021-2023 tteck
  3. # Author: tteck (tteckster)
  4. # License: MIT
  5. # https://github.com/tteck/Proxmox/raw/main/LICENSE
  6. source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
  7. color
  8. verb_ip6
  9. catch_errors
  10. setting_up_container
  11. network_check
  12. update_os
  13. msg_info "Installing Dependencies"
  14. $STD apt-get install -y curl
  15. $STD apt-get install -y sudo
  16. $STD apt-get install -y mc
  17. $STD apt-get install -y git
  18. msg_ok "Installed Dependencies"
  19. msg_info "Setting up Node.js Repository"
  20. $STD bash <(curl -fsSL https://deb.nodesource.com/setup_16.x)
  21. msg_ok "Set up Node.js Repository"
  22. msg_info "Installing Node.js"
  23. $STD apt-get install -y nodejs
  24. msg_ok "Installed Node.js"
  25. msg_info "Installing Wiki.js"
  26. mkdir -p /opt/wikijs
  27. cd /opt/wikijs
  28. $STD wget https://github.com/Requarks/wiki/releases/latest/download/wiki-js.tar.gz
  29. tar xzf wiki-js.tar.gz
  30. rm wiki-js.tar.gz
  31. cat <<EOF >/opt/wikijs/config.yml
  32. bindIP: 0.0.0.0
  33. port: 3000
  34. db:
  35. type: sqlite
  36. storage: /opt/wikijs/db.sqlite
  37. logLevel: info
  38. logFormat: default
  39. dataPath: /opt/wikijs/data
  40. bodyParserLimit: 5mb
  41. EOF
  42. $STD npm rebuild sqlite3
  43. msg_ok "Installed Wiki.js"
  44. msg_info "Creating Service"
  45. service_path="/etc/systemd/system/wikijs.service"
  46. echo "[Unit]
  47. Description=Wiki.js
  48. After=network.target
  49. [Service]
  50. Type=simple
  51. ExecStart=/usr/bin/node server
  52. Restart=always
  53. User=root
  54. Environment=NODE_ENV=production
  55. WorkingDirectory=/opt/wikijs
  56. [Install]
  57. WantedBy=multi-user.target" >$service_path
  58. $STD systemctl enable --now wikijs
  59. msg_ok "Created Service"
  60. motd_ssh
  61. customize
  62. msg_info "Cleaning up"
  63. $STD apt-get autoremove
  64. $STD apt-get autoclean
  65. msg_ok "Cleaned"