wikijs-install.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. $STD apt-get install -y ca-certificates
  19. $STD apt-get install -y gnupg
  20. msg_ok "Installed Dependencies"
  21. msg_info "Setting up Node.js Repository"
  22. mkdir -p /etc/apt/keyrings
  23. curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
  24. echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
  25. msg_ok "Set up Node.js Repository"
  26. msg_info "Installing Node.js"
  27. $STD apt-get update
  28. $STD apt-get install -y nodejs
  29. msg_ok "Installed Node.js"
  30. msg_info "Installing Wiki.js"
  31. mkdir -p /opt/wikijs
  32. cd /opt/wikijs
  33. $STD wget https://github.com/Requarks/wiki/releases/latest/download/wiki-js.tar.gz
  34. tar xzf wiki-js.tar.gz
  35. rm wiki-js.tar.gz
  36. cat <<EOF >/opt/wikijs/config.yml
  37. bindIP: 0.0.0.0
  38. port: 3000
  39. db:
  40. type: sqlite
  41. storage: /opt/wikijs/db.sqlite
  42. logLevel: info
  43. logFormat: default
  44. dataPath: /opt/wikijs/data
  45. bodyParserLimit: 5mb
  46. EOF
  47. $STD npm rebuild sqlite3
  48. msg_ok "Installed Wiki.js"
  49. msg_info "Creating Service"
  50. service_path="/etc/systemd/system/wikijs.service"
  51. echo "[Unit]
  52. Description=Wiki.js
  53. After=network.target
  54. [Service]
  55. Type=simple
  56. ExecStart=/usr/bin/node server
  57. Restart=always
  58. User=root
  59. Environment=NODE_ENV=production
  60. WorkingDirectory=/opt/wikijs
  61. [Install]
  62. WantedBy=multi-user.target" >$service_path
  63. $STD systemctl enable --now wikijs
  64. msg_ok "Created Service"
  65. motd_ssh
  66. customize
  67. msg_info "Cleaning up"
  68. $STD apt-get autoremove
  69. $STD apt-get autoclean
  70. msg_ok "Cleaned"