openobserve-install.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. msg_ok "Installed Dependencies"
  18. msg_info "Installing OpenObserve"
  19. mkdir -p /opt/openobserve/data
  20. LATEST=$(curl -sL https://api.github.com/repos/openobserve/openobserve/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
  21. $STD tar zxvf <(curl -fsSL https://github.com/openobserve/openobserve/releases/download/$LATEST/openobserve-${LATEST}-linux-amd64.tar.gz) -C /opt/openobserve
  22. cat <<EOF >/opt/openobserve/data/.env
  23. ZO_ROOT_USER_EMAIL = "admin@example.com"
  24. ZO_ROOT_USER_PASSWORD = "$(openssl rand -base64 18 | cut -c1-13)"
  25. ZO_DATA_DIR = "/opt/openobserve/data"
  26. ZO_HTTP_PORT = "5080"
  27. EOF
  28. msg_ok "Installed OpenObserve"
  29. msg_info "Creating Service"
  30. cat <<EOF >/etc/systemd/system/openobserve.service
  31. [Unit]
  32. Description=OpenObserve
  33. After=network.target
  34. [Service]
  35. Type=simple
  36. EnvironmentFile=/opt/openobserve/data/.env
  37. ExecStart=/opt/openobserve/openobserve
  38. ExecStop=killall -QUIT openobserve
  39. Restart=on-failure
  40. [Install]
  41. WantedBy=multi-user.target
  42. EOF
  43. systemctl enable -q --now openobserve
  44. msg_ok "Created Service"
  45. motd_ssh
  46. customize
  47. msg_info "Cleaning up"
  48. $STD apt-get autoremove
  49. $STD apt-get autoclean
  50. msg_ok "Cleaned"