You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2024/03/18 12:30:30 UTC
(skywalking-website) branch master updated: Add quick-start script for Windows (#690)
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-website.git
The following commit(s) were added to refs/heads/master by this push:
new ee299565224 Add quick-start script for Windows (#690)
ee299565224 is described below
commit ee29956522493f42a19ac04cf5ff7abe90bfa1a3
Author: Superskyyy <Su...@outlook.com>
AuthorDate: Mon Mar 18 08:30:25 2024 -0400
Add quick-start script for Windows (#690)
---
content/quickstart-docker.ps1 | 154 ++++++++++++++++++++++++++++++++++++++++++
content/quickstart-docker.sh | 8 ++-
2 files changed, 159 insertions(+), 3 deletions(-)
diff --git a/content/quickstart-docker.ps1 b/content/quickstart-docker.ps1
new file mode 100644
index 00000000000..89ad3e1f4db
--- /dev/null
+++ b/content/quickstart-docker.ps1
@@ -0,0 +1,154 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Default values for SkyWalking versions
+$SW_VERSION = "9.7.0"
+$SW_BANYANDB_VERSION = "0.5.0"
+
+$COMPOSE_FILE_PATH = ".\docker-compose.yml"
+$env:BANYANDB_IMAGE = "apache/skywalking-banyandb:$SW_BANYANDB_VERSION"
+$env:OAP_IMAGE = "apache/skywalking-oap-server:$SW_VERSION"
+$env:UI_IMAGE = "apache/skywalking-ui:$SW_VERSION"
+
+# Unset the SW_STORAGE environment variable at the start of the script
+Remove-Item Env:\SW_STORAGE -ErrorAction Ignore
+
+# Ensuring script stops on error
+$ErrorActionPreference = "Stop"
+
+$storageOptionProvided = $false
+$foregroundOptionProvided = $false
+# Function to display usage information
+function Show-Usage {
+ Write-Host "Usage: quickstart-docker.ps1 [-h/--help] [-f] [--storage <storage_option>]"
+ Write-Host "Options:"
+ Write-Host " -h/--help About running the quickstart script without interaction"
+ Write-Host " -f Run in foreground mode (docker compose up)"
+ Write-Host " --storage <option> Set the storage option (elasticsearch or banyandb)"
+ exit
+}
+
+# Process command-line arguments
+for ($i = 0; $i -lt $args.Length; $i++) {
+ switch ($args[$i]) {
+ "-h" { Show-Usage; exit }
+ "--help" { Show-Usage; exit }
+ "-f" { $DETACHED = $false; $foregroundOptionProvided = $true; }
+ "--storage" {
+ if ($i -lt $args.Length - 1) {
+ $env:SW_STORAGE = $args[++$i]
+ $storageOptionProvided = $true
+ # Validate storage option if provided
+ if ($storageOptionProvided -and -not ($env:SW_STORAGE -eq "elasticsearch" -or $env:SW_STORAGE -eq "banyandb")) {
+ Write-Host "Invalid storage option: $env:SW_STORAGE. Valid options are 'elasticsearch' or 'banyandb'."
+ exit 1
+ }
+ }
+ else {
+ Write-Host "Error: --storage option requires an argument."
+ exit 1
+ }
+ }
+ default {
+ Write-Host "Invalid option: $($args[$i]), try -h or --help"
+ exit 1
+ }
+ }
+}
+
+
+if (-not (Get-Command "docker" -ErrorAction SilentlyContinue)) {
+ Write-Host "Docker is not found. Please make sure Docker is installed and the docker command is available in PATH.`n"
+ exit 1
+}
+Write-Host "Docker is installed, continue...`n"
+
+# In place download, prompt user before overriding
+if (Test-Path -Path $COMPOSE_FILE_PATH) {
+ Write-Host "A docker-compose.yml already exists in the current directory.`n"
+ $reuseFlag = Read-Host "Would you like to override the existing manifest (default: False)? [Y/n]: "
+ $DOWNLOAD = $false
+ if ($reuseFlag -eq 'y' -or $reuseFlag -eq 'Y') {
+ $DOWNLOAD = $true
+ }
+}
+
+if ($DOWNLOAD) {
+ Invoke-WebRequest -Uri "https://github.com/apache/skywalking/raw/master/docker/docker-compose.yml" -OutFile $COMPOSE_FILE_PATH
+ Write-Host "`nDownloaded SkyWalking Docker Compose manifest to the current directory...`n"
+}
+else {
+ Write-Host "`nAttempting to reuse the existing SkyWalking Docker Compose manifest from the current directory.`n"
+}
+
+# If SW_STORAGE is not set, prompt the user to select a storage option
+if (-not $storageOptionProvided) {
+ Write-Host "Please select a storage option:"
+ Write-Host "1. Elasticsearch"
+ Write-Host "2. BanyanDB ($SW_BANYANDB_VERSION)"
+ $storage_option = Read-Host "Enter the number of your choice"
+
+ # Validate and process the input
+ if ($storage_option -eq "1") {
+ $env:SW_STORAGE = "elasticsearch"
+ Write-Host "You have selected: Elasticsearch as the storage option.`n"
+ }
+ elseif ($storage_option -eq "2") {
+ $env:SW_STORAGE = "banyandb"
+ Write-Host "You have selected: BanyanDB as the storage option.`n"
+ }
+ else {
+ Write-Host "Invalid choice. Please enter 1 or 2.`n"
+ exit 1
+ }
+}
+
+if (-not $foregroundOptionProvided) {
+ $detachedFlag = Read-Host "Do you want to run Docker in detached mode (default: True)? [Y/n]: "
+
+ $DETACHED = $true
+ if ($detachedFlag -eq 'n' -or $detachedFlag -eq 'N') {
+ $DETACHED = $false
+ }
+}
+
+# Concatenate detached flag here
+$composeCommand = "docker compose -f $COMPOSE_FILE_PATH --project-name=skywalking-quickstart --profile=$env:SW_STORAGE up"
+
+# Note the leading blank " --"
+if ($DETACHED) {
+ $composeCommand += " --detach --wait" # --wait implies implicit detached mode, just to be safe provide both
+}
+
+# Attempt to start Docker compose
+Write-Host "Starting to set up SkyWalking ($SW_VERSION) with $env:SW_STORAGE storage, this might take a while...`n"
+
+Invoke-Expression $composeCommand
+
+# Check if the command was successful, try catch won't work here
+if ($LASTEXITCODE -ne 0) {
+ Write-Host "`nFailed to start SkyWalking. Please check the Docker compose logs for more information.`n"
+ exit $LASTEXITCODE
+}
+else {
+ Write-Host "`nSkyWalking is now running. You can send telemetry data to localhost:11800 and access the UI at http://localhost:8080.`n"
+ if ($env:SW_STORAGE -eq "banyandb") {
+ Write-Host "You can access BanyanDB web UI at http://localhost:17913.`n"
+ }
+ Write-Host "To find SkyWalking Docs, follow the link to our documentation site https://skywalking.apache.org/docs/.`n"
+
+ Write-Host "To stop SkyWalking, run 'docker compose --project-name=skywalking-quickstart down'.`n"
+}
diff --git a/content/quickstart-docker.sh b/content/quickstart-docker.sh
index e2c6cf6aeb8..0cbc19f0d2d 100644
--- a/content/quickstart-docker.sh
+++ b/content/quickstart-docker.sh
@@ -47,7 +47,7 @@ done
echo "Checking if Docker is installed..."
if ! [ -x "$(command -v docker)" ]; then
- echo "Docker is not installed. Please install Docker and try again."
+ echo "Docker is not found. Please make sure Docker is installed and the docker command is available in PATH."
exit 1
fi
@@ -59,7 +59,7 @@ curl -fsSL https://github.com/apache/skywalking/raw/master/docker/docker-compose
if [ -z "$SW_STORAGE" ]; then
echo "Please select a storage option:"
echo "1. Elasticsearch"
- echo "2. BanyanDB"
+ echo "2. BanyanDB ($SW_BANYANDB_VERSION)"
read -p "Enter the number of your choice: " storage_option
fi
@@ -89,8 +89,10 @@ docker compose -f "$temp_dir/docker-compose.yml" \
--detach=${DETACHED:-true} \
--wait
-echo "SkyWalking is now running. You can send telemetry data at localhost:11800 and access the UI at http://localhost:8080."
+echo "SkyWalking is now running. You can send telemetry data to localhost:11800 and access the UI at http://localhost:8080."
if [ "$SW_STORAGE" = "banyandb" ]; then
echo "You can access BanyanDB web UI at http://localhost:17913."
fi
+echo "To find SkyWalking Docs, follow the link to our documentation site https://skywalking.apache.org/docs/."
+
echo "To stop SkyWalking, run 'docker compose --project-name=skywalking-quickstart down'."