mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 12:31:07 +01:00
adds snap package for victoria-metrics (#904)
* adds snap package for victoria-metrics * Update README.md Co-authored-by: Aliaksandr Valialkin <valyala@gmail.com>
This commit is contained in:
parent
d4cc934c77
commit
c2afa3fdd7
@ -1363,6 +1363,7 @@ The collected profiles may be analyzed with [go tool pprof](https://github.com/g
|
||||
See [this example](https://github.com/go-graphite/carbonapi/blob/master/cmd/carbonapi/carbonapi.example.prometheus.yaml).
|
||||
* [Ansible role for installing single-node VictoriaMetrics](https://github.com/dreamteam-gg/ansible-victoriametrics-role).
|
||||
* [Ansible role for installing cluster VictoriaMetrics](https://github.com/Slapper/ansible-victoriametrics-cluster-role).
|
||||
* [Snap package for VictoriaMetrics](https://snapcraft.io/victoriametrics).
|
||||
|
||||
## Third-party contributions
|
||||
|
||||
|
@ -108,3 +108,10 @@ victoria-metrics-package-deb-rpm-all: \
|
||||
victoria-metrics-package-deb-arm64 \
|
||||
victoria-metrics-package-rpm \
|
||||
victoria-metrics-package-rpm-arm64
|
||||
|
||||
### Packaging as snap
|
||||
victoria-metrics-package-snap: victoria-metrics-prod
|
||||
which snapcraft || snap install snapcraft
|
||||
which multipass || snap install multipass
|
||||
snapcraft
|
||||
|
||||
|
57
snap/local/README.md
Normal file
57
snap/local/README.md
Normal file
@ -0,0 +1,57 @@
|
||||
### Snap integration
|
||||
|
||||
https://snapcraft.io/
|
||||
|
||||
snap link: https://snapcraft.io/victoriametrics
|
||||
|
||||
|
||||
#### develop
|
||||
|
||||
Install snapcraft and multipass:
|
||||
```text
|
||||
snap install snapcraft
|
||||
snap install multipass
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
installation and configuration:
|
||||
|
||||
```text
|
||||
# install
|
||||
snap install victoriametrics
|
||||
# logs
|
||||
snap logs victoriametrics
|
||||
# restart
|
||||
snap restart victoriametrics
|
||||
```
|
||||
|
||||
Configuration management:
|
||||
|
||||
Prometheus scrape config can be edited with your favorite editor, its located at
|
||||
```text
|
||||
vi /var/snap/victoriametrics/current/etc/victoriametrics-scrape-config.yaml
|
||||
```
|
||||
after changes, you can trigger config reread with `curl localhost:8248/-/reload`.
|
||||
|
||||
Configuration tuning is possible with editing extra_flags:
|
||||
```text
|
||||
echo 'FLAGS="-selfScrapeInterval=10s -search.logSlowQueryDuration=20s"' > /var/snap/victoriametrics/current/extra_flags
|
||||
snap restart victoriametrics
|
||||
```
|
||||
|
||||
Data folder located at `/var/snap/victoriametrics/current/var/lib/victoriametrics/`
|
7
snap/local/victoriametrics-wrapper
Executable file
7
snap/local/victoriametrics-wrapper
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
test -e $SNAP_DATA/extra_flags || echo 'FLAGS=""' > $SNAP_DATA/extra_flags
|
||||
|
||||
# get args
|
||||
. $SNAP_DATA/extra_flags
|
||||
$SNAP/bin/victoria-metrics -storageDataPath /var/lib/victoriametrics --promscrape.config /etc/victoriametrics-scrape-config.yaml $FLAGS
|
83
snap/snapcraft.yaml
Normal file
83
snap/snapcraft.yaml
Normal file
@ -0,0 +1,83 @@
|
||||
name: victoriametrics
|
||||
base: core18
|
||||
version: git
|
||||
icon: logo.png
|
||||
summary: VictoriaMetrics is fast, cost-effective and scalable time-series database.
|
||||
description: |
|
||||
* VictoriaMetrics can be used as long-term storage for Prometheus or for vmagent.
|
||||
See [these docs](#prometheus-setup) for details.
|
||||
* Supports Prometheus querying API, so it can be used as Prometheus drop-in replacement in Grafana.
|
||||
VictoriaMetrics implements MetricsQL, https://github.com/VictoriaMetrics/VictoriaMetrics/wiki/MetricsQL query language, which is inspired by PromQL.
|
||||
* Supports global query view. Multiple Prometheus instances may write data into VictoriaMetrics. Later this data may be used in a single query.
|
||||
* High performance and good scalability for both inserts and selects.
|
||||
* High data compression, so up to 70x more data points may be crammed into limited storage comparing to TimescaleDB.
|
||||
* Optimized for storage with high-latency IO and low IOPS (HDD and network storage in AWS, Google Cloud, Microsoft Azure, etc).
|
||||
* A single-node VictoriaMetrics may substitute moderately sized clusters built with competing solutions such as Thanos, M3DB, Cortex, InfluxDB or TimescaleDB.
|
||||
* Easy operation:
|
||||
* VictoriaMetrics consists of a single without external dependencies.
|
||||
* All the configuration is done via explicit command-line flags with reasonable defaults.
|
||||
* All the data is stored in a single directory pointed by `-storageDataPath` flag.
|
||||
* Easy and fast backups from
|
||||
to S3 or GCS with [vmbackup] / [vmrestore].
|
||||
* Storage is protected from corruption on unclean shutdown (i.e. OOM, hardware reset or `kill -9`) thanks to the storage architecture.
|
||||
* Supports metrics' scraping, ingestion and backfilling via the following protocols:
|
||||
* [Metrics from Prometheus exporters]
|
||||
such as node_exporter.
|
||||
* Prometheus remote write API(
|
||||
* InfluxDB line protocol over HTTP, TCP and UDP.
|
||||
* Graphite plaintext protocol
|
||||
if `-graphiteListenAddr` is set.
|
||||
* OpenTSDB put message, if `-opentsdbListenAddr` is set.
|
||||
* HTTP OpenTSDB /api/put requests, if `-opentsdbHTTPListenAddr` is set.
|
||||
* JSON line format.
|
||||
* Native binary format.
|
||||
* Prometheus exposition format.
|
||||
* Arbitrary CSV data.
|
||||
* Supports metrics' relabeling. See [these docs](#relabeling) for details.
|
||||
* Ideally works with big amounts of time series data from Kubernetes, IoT sensors, connected cars, industrial telemetry, financial data and various Enterprise workloads.
|
||||
* Has open source cluster version (https://github.com/VictoriaMetrics/VictoriaMetrics/tree/cluster).
|
||||
|
||||
** Configuration management**
|
||||
* Prometheus scrape config can be edited with your favorite editor, its located at
|
||||
`vi /var/snap/victoriametrics/current/etc/victoriametrics-scrape-config.yaml`
|
||||
after changes, you can trigger config reread with `curl localhost:8248/-/reload`.
|
||||
* Configuration tuning is possible with editing extra_flags:
|
||||
`echo 'FLAGS="-selfScrapeInterval=10s -search.logSlowQueryDuration=20s"' > /var/snap/victoriametrics/current/extra_flags && snap restart victoriametrics`
|
||||
* Data folder located at `/var/snap/victoriametrics/current/var/lib/victoriametrics/`.
|
||||
|
||||
grade: stable # must be 'stable' to release into candidate/stable channels
|
||||
confinement: strict # use 'strict' once you have the right plugs and slots
|
||||
|
||||
parts:
|
||||
build:
|
||||
plugin: go
|
||||
go-channel: 1.15/stable
|
||||
go-importpath: github.com/VictoriaMetrics/VictoriaMetrics
|
||||
source: .
|
||||
source-type: local
|
||||
build-packages: [build-essential, make]
|
||||
override-build: |
|
||||
make app-local APP_NAME=victoria-metrics
|
||||
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
|
||||
cp -p $SNAPCRAFT_PART_BUILD/bin/victoria-metrics-prod $SNAPCRAFT_PART_INSTALL/bin/victoria-metrics
|
||||
cp -p $SNAPCRAFT_PART_SRC/snap/local/victoriametrics-wrapper $SNAPCRAFT_PART_INSTALL/bin/
|
||||
apps:
|
||||
victoriametrics:
|
||||
command: bin/victoriametrics-wrapper
|
||||
daemon: simple
|
||||
restart-condition: always
|
||||
restart-delay: 10s
|
||||
plugs: [network,network-bind]
|
||||
|
||||
plugs:
|
||||
network:
|
||||
network-bind:
|
||||
|
||||
layout:
|
||||
/var/lib/victoriametrics:
|
||||
bind: $SNAP_DATA/var/lib/victoriametrics
|
||||
/etc/victoriametrics-scrape-config.yaml:
|
||||
bind-file: $SNAP_DATA/etc/victoriametrics-scrape-config.yaml
|
||||
architectures:
|
||||
- build-on: ['arm64', 'amd64']
|
||||
run-on: ['arm64','amd64']
|
Loading…
Reference in New Issue
Block a user