From 85962b459fc269a077dd8719f8dd3b5bdd7e8528 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Tue, 29 Dec 2020 12:43:09 +0300 Subject: [PATCH] Snap docs change (#986) * adds snap docs, adds release information for snap package, adds docs notes about configuration management with snap package. * adds release page mention * version fix for snap, its awful * revert version * Apply suggestions from code review Co-authored-by: Aliaksandr Valialkin --- Makefile | 4 ++++ README.md | 21 +++++++++++++++++++++ docs/Release-Guide.md | 13 +++++++++++++ docs/Single-server-VictoriaMetrics.md | 21 +++++++++++++++++++++ snap/local/README.md | 12 +----------- 5 files changed, 60 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index e24e1a6dc..2a0d691e8 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,10 @@ vmutils: \ vmbackup \ vmrestore +release-snap: + snapcraft + snapcraft upload "victoriametrics_$(PKG_TAG)_multi.snap" --release beta,edge,candidate + release: \ release-victoria-metrics \ release-vmutils diff --git a/README.md b/README.md index c2593ae18..6489dc581 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,7 @@ Alphabetically sorted links to case studies: * [How to start VictoriaMetrics](#how-to-start-victoriametrics) * [Environment variables](#environment-variables) + * [Configuration with snap package](#configuration-with-snap-package) * [Prometheus setup](#prometheus-setup) * [Grafana setup](#grafana-setup) * [How to upgrade VictoriaMetrics](#how-to-upgrade-victoriametrics) @@ -197,6 +198,26 @@ Each flag value can be set via environment variables according to these rules: * For repeating flags an alternative syntax can be used by joining the different values into one using `,` char as separator (for example `-storageNode -storageNode ` will translate to `storageNode=,`) * It is possible setting prefix for environment vars with `-envflag.prefix`. For instance, if `-envflag.prefix=VM_`, then env vars must be prepended with `VM_` +### Configuration with snap package + + + Command-line flags can be changed with following command: + +```text +echo 'FLAGS="-selfScrapeInterval=10s -search.logSlowQueryDuration=20s"' > $SNAP_DATA/var/snap/victoriametrics/current/extra_flags +snap restart victoriametrics +``` + Or add needed command-line flags to the file `$SNAP_DATA/var/snap/victoriametrics/current/extra_flags`. + + Note you cannot change value for `-storageDataPath` flag, for safety snap package has limited access to host system. + + + Changing scrape configuration is possible with text editor: + ```text + vi $SNAP_DATA/var/snap/victoriametrics/current/etc/victoriametrics-scrape-config.yaml + ``` + After changes was made, trigger config re-read with command `curl 127.0.0.1:8248/-/reload`. + ## Prometheus setup diff --git a/docs/Release-Guide.md b/docs/Release-Guide.md index 0b05382b1..29e607d5c 100644 --- a/docs/Release-Guide.md +++ b/docs/Release-Guide.md @@ -10,6 +10,19 @@ Release process guidance 5. Push release tag to https://github.com/VictoriaMetrics/VictoriaMetrics : `git push origin v1.xx.y`. 6. Go to https://github.com/VictoriaMetrics/VictoriaMetrics/releases , create new release from the pushed tag on step 5 and upload `*.tar.gz` archive with the corresponding `_checksums.txt` from step 2. +## Building snap package. + + pre-requirements: +- snapcraft binary, can be installed with commands: + for MacOS `brew install snapcraft` and [install mutipass](https://discourse.ubuntu.com/t/installing-multipass-on-macos/8329), + for Ubuntu - `sudo snap install snapcraft --classic` +- login with `snapcraft login` +- already created release at github (it operates `git describe` version, so git tag must be annotated). + +0. checkout to the latest git tag for single-node version. +1. execute `make release-snap` - it must build and upload snap package. +2. promote release to current, if needed manually at release page [snapcraft-releases](https://snapcraft.io/victoriametrics/releases) + ### Public Announcement 1. Publish message in slack (victoriametrics.slack.com, general channel) diff --git a/docs/Single-server-VictoriaMetrics.md b/docs/Single-server-VictoriaMetrics.md index c2593ae18..6489dc581 100644 --- a/docs/Single-server-VictoriaMetrics.md +++ b/docs/Single-server-VictoriaMetrics.md @@ -104,6 +104,7 @@ Alphabetically sorted links to case studies: * [How to start VictoriaMetrics](#how-to-start-victoriametrics) * [Environment variables](#environment-variables) + * [Configuration with snap package](#configuration-with-snap-package) * [Prometheus setup](#prometheus-setup) * [Grafana setup](#grafana-setup) * [How to upgrade VictoriaMetrics](#how-to-upgrade-victoriametrics) @@ -197,6 +198,26 @@ Each flag value can be set via environment variables according to these rules: * For repeating flags an alternative syntax can be used by joining the different values into one using `,` char as separator (for example `-storageNode -storageNode ` will translate to `storageNode=,`) * It is possible setting prefix for environment vars with `-envflag.prefix`. For instance, if `-envflag.prefix=VM_`, then env vars must be prepended with `VM_` +### Configuration with snap package + + + Command-line flags can be changed with following command: + +```text +echo 'FLAGS="-selfScrapeInterval=10s -search.logSlowQueryDuration=20s"' > $SNAP_DATA/var/snap/victoriametrics/current/extra_flags +snap restart victoriametrics +``` + Or add needed command-line flags to the file `$SNAP_DATA/var/snap/victoriametrics/current/extra_flags`. + + Note you cannot change value for `-storageDataPath` flag, for safety snap package has limited access to host system. + + + Changing scrape configuration is possible with text editor: + ```text + vi $SNAP_DATA/var/snap/victoriametrics/current/etc/victoriametrics-scrape-config.yaml + ``` + After changes was made, trigger config re-read with command `curl 127.0.0.1:8248/-/reload`. + ## Prometheus setup diff --git a/snap/local/README.md b/snap/local/README.md index c7a1feed3..64952ee25 100644 --- a/snap/local/README.md +++ b/snap/local/README.md @@ -9,23 +9,13 @@ snap link: https://snapcraft.io/victoriametrics Install snapcraft and multipass: ```text -snap install snapcraft -snap install multipass +sudo snap install snapcraft --classic ``` build victoria-metrics prod binary and run snapcraft ```snapcraft --debug```. It produces snap package with current git version - `victoriametrics_v1.46.0+git1.1bebd021a-dirty_all.snap`. You can install it with command: `snap install victoriametrics_v1.46.0+git1.1bebd021a-dirty_all.snap --dangerous` -package and publish: - -```text -make victoria-metrics-package-snap -snap login -snap_file=$(ls | grep -e '_multi.snap$') -snapcraft upload --release=latest/edge "$snap_file" -rm "$snap_file" -``` #### usage