Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation Addition for Creating a service #43

Open
MaxDiOrio opened this issue May 31, 2019 · 12 comments

Comments

@MaxDiOrio
Copy link

commented May 31, 2019

First - VM is amazing so far. Thank you.

I'd love to see you add documentation on running VM as a service in systemd. Here's what I did to make it work on CentOS 7, but this should work on any systemd OS.

Create a directory to hold the PID file:

mkdir /run/victoriametrics

Create /etc/systemd/system/victoriametrics.service. Copy and paste the below into this new file, adjusting the ExecStart line as needed.

[Unit]
Description=VictoriaMetrics
After=network.target

[Service]
Type=simple
StartLimitBurst=5
StartLimitInterval=0
Restart=on-failure
RestartSec=1
PIDFile=/run/victoriametrics/victoriametrics.pid
ExecStart=/usr/local/bin/victoriametrics -storageDataPath /data -retentionPeriod 6
ExecStop=/bin/kill -s SIGTERM $MAINPID

[Install]
WantedBy=multi-user.target

Set the file limits for the service:
mkdir /etc/systemd/system/victoriametrics.service.d
In this folder create a file ulimit.conf with the following:

[Service]
LimitNOFILE=32000
LimitNPROC=32000

Enable the service to start automatically:

systemctl enable victoriametrics

Start the service:

systemctl start victoriametrics
@valyala

This comment has been minimized.

Copy link
Contributor

commented May 31, 2019

@MaxDiOrio , thanks for these instructions! I prettified your message and linked it from the README.md. Feel free updating this info as needed.

@mihaibalaci

This comment has been minimized.

Copy link

commented Jun 20, 2019

Quick question: if we deploy it in aks/eks is it possible to store data in something like s3 or adls?

@valyala

This comment has been minimized.

Copy link
Contributor

commented Jun 20, 2019

Quick question: if we deploy it in aks/eks is it possible to store data in something like s3 or adls?

Currently the data may be stored in network block storage such as Amazon EBS or Google compute disks. There are plans for adding blob storage support such as S3 or GCS in the future - see this issue for details.

@kmansoft

This comment has been minimized.

Copy link
Contributor

commented Jul 24, 2019

If anyone is interested, I can add build system scripts to create .rpm packages (did this recently for my project, went from "know nothing about RPM" to "know enough to be dangerous").

This would cover CentOS / Fedora, at least those versions that use systemd.

@valyala

This comment has been minimized.

Copy link
Contributor

commented Jul 24, 2019

If anyone is interested, I can add build system scripts to create .rpm packages (did this recently for my project, went from "know nothing about RPM" to "know enough to be dangerous").

This sounds good. Please, coordinate your work with @patsevanton regarding his yum build for VictoriaMetrics.

@kmansoft

This comment has been minimized.

Copy link
Contributor

commented Jul 25, 2019

@patsevanton I'm thinking of adding new code to the makefiles / build scripts.

It would dynamically generate the .spec file with the right paths (which do vary by version and by actual built path) and then use rpmbuild -bb --target to package.

Here is some code from my own build scripts:

            mkdir -p "${TEMPDIR_RPM}/${WHAT}/SPECS"
            cat > "${TEMPDIR_RPM}/${WHAT}/SPECS/clearview-${WHAT}.spec" <<EOF
Summary: Clearview agent
Name: clearview-agent
Version: ${VERSION}
Release: ${BUILD}
License: n/a
URL: https://clearview.rocks
Group: System
Packager: Kostya Vasilyev <kmansoft@gmail.com>
Requires: libpthread
Requires: libc

%description
Clearview is an easy to install, easy to use performance monitoring for
your Linux web servers. Inspired by Linode Longview.

%files
%attr(0744, root, root) /usr/sbin/*
%attr(0644, root, root) /lib/systemd/system/*

%prep
echo "BUILDROOT = \$RPM_BUILD_ROOT"

mkdir -p \$RPM_BUILD_ROOT/usr/sbin/
mkdir -p \$RPM_BUILD_ROOT/lib/systemd/system/

cp ${PWD}/package/temp-deb/agent/usr/sbin/${OUT_EXE} \$RPM_BUILD_ROOT/usr/sbin/
cp ${PWD}/package/agent/clearview-agent.service \$RPM_BUILD_ROOT/lib/systemd/system/
EOF

            cat "${TEMPDIR_RPM}/${WHAT}/SPECS/clearview-${WHAT}.spec"

            rpmbuild -bb --target "${RPM_ARCH}" \
                "${TEMPDIR_RPM}/${WHAT}/SPECS/clearview-${WHAT}.spec"

            cp "${HOME}/rpmbuild/RPMS/${RPM_ARCH}/${OUT_RPM}" "${PACKDIR}/${OUT_RPM}"
@patsevanton

This comment has been minimized.

Copy link
Contributor

commented Jul 25, 2019

@kmansoft

This comment has been minimized.

Copy link
Contributor

commented Jul 25, 2019

@patsevanton Hmmmm... I was thinking adding it to the existing build script(s) which build .deb packages, and therefore need to fork it off the complete Victoria repository.

@kmansoft

This comment has been minimized.

Copy link
Contributor

commented Jul 25, 2019

Also @patsevanton can we drop support for non-systemd systems?

@patsevanton

This comment has been minimized.

Copy link
Contributor

commented Jul 25, 2019

@kmansoft i think first merge #121

I dont know about drop support for non-systemd systems. Question to @valyala

@kmansoft

This comment has been minimized.

Copy link
Contributor

commented Jul 25, 2019

RHEL 7 (has systemd) came out in 2014

For Debian, it's systemd only so that's "wheezy" and newer (I think), 2016 release date.

@kmansoft

This comment has been minimized.

Copy link
Contributor

commented Jul 25, 2019

@kmansoft i think first merge #121

Got it, great, once that's done I'll fork the main repo again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.