install.sh
install.sh - Overview
-
Overview This script automates the installation of SigNoz using Docker Compose. It handles OS detection, Docker installation, Docker Compose installation, and SigNoz container deployment. It also includes error handling and sends installation status events.
-
Detailed Documentation
Variables
BASE_DIR
: The directory where the script is located.DOCKER_STANDALONE_DIR
: The directory containing the Docker Compose file for standalone deployment ("docker").DOCKER_SWARM_DIR
: Intended directory for docker swarm files. Currently not used ("docker-swarm").Black
,Red
,Green
,Yellow
,Blue
,Purple
,Cyan
,White
,NC
: Color codes for terminal output.
is_command_present()
- Purpose: Checks if a command is present in the system.
- Parameters:
$1
: The command to check.
- Returns: None. Exits with status 0 if command is present, 1 otherwise.
has_wget()
- Purpose: Checks if the
wget
command exists. - Returns: None.
has_curl()
- Purpose: Checks if the
curl
command exists. - Returns: None.
has_cmd()
- Purpose: Checks if a command exists.
- Parameters:
$1
: The command to check.
- Returns: None.
has_docker_compose_plugin()
- Purpose: Checks if the Docker Compose plugin is present.
- Returns: None.
is_mac()
- Purpose: Checks if the operating system is macOS.
- Returns: None.
is_arm64()
- Purpose: Checks if the architecture is ARM64.
- Returns: None.
check_os()
- Purpose: Detects the operating system and sets related variables like
package_manager
andos
. - Parameters: None
- Returns: None
check_ports_occupied()
- Purpose: Checks if ports 8080 and 4317 are occupied.
- Parameters: None
- Returns: None. Exits with an error message if the ports are occupied.
install_docker()
- Purpose: Installs Docker based on the detected package manager.
- Parameters: None
- Returns: None
compose_version()
- Purpose: Gets the latest version of docker compose from github.
- Parameters: None
- Returns: The version string of the latest docker-compose release.
install_docker_compose()
- Purpose: Installs Docker Compose using
curl
. - Parameters: None
- Returns: None.
start_docker()
- Purpose: Starts the Docker service.
- Parameters: None
- Returns: None.
wait_for_containers_start()
- Purpose: Waits for all containers to start by polling the health endpoint.
- Parameters:
$1
: Timeout in seconds.
- Returns: None.
bye()
- Purpose: Handles script exit, prints error messages if containers didn't start correctly.
- Parameters: None
- Returns: None.
request_sudo()
- Purpose: Requests sudo access if not already available.
- Parameters: None
- Returns: None
send_event()
- Purpose: Sends installation events to Segment.io.
- Parameters:
$1
: Event type (e.g.,install_started
,os_not_supported
).
- Returns: None.
-
Code Examples None
-
Clarity and Accuracy The documentation is based on the code provided.
-
Markdown & MDX Perfection The documentation follows markdown syntax.
-
Edge Cases To Avoid Breaking MDX All requirements are met.
-
Getting Started Relevance Include in Getting Started: YES