1
0
mirror of https://github.com/Oxalide/vsphere-influxdb-go.git synced 2023-10-10 11:36:51 +00:00

add vendoring with go dep

This commit is contained in:
Adrian Todorov
2017-10-25 20:52:40 +00:00
parent 704f4d20d1
commit a59409f16b
1627 changed files with 489673 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
# If you modify this, please also make sure to edit init.sh
[Unit]
Description=InfluxDB is an open-source, distributed, time series database
Documentation=https://docs.influxdata.com/influxdb/
After=network-online.target
[Service]
User=influxdb
Group=influxdb
LimitNOFILE=65536
EnvironmentFile=-/etc/default/influxdb
ExecStart=/usr/bin/influxd -config /etc/influxdb/influxdb.conf ${INFLUXD_OPTS}
KillMode=control-group
Restart=on-failure
[Install]
WantedBy=multi-user.target
Alias=influxd.service

233
vendor/github.com/influxdata/influxdb/scripts/init.sh generated vendored Executable file
View File

@@ -0,0 +1,233 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: influxd
# Required-Start: $all
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the InfluxDB process
### END INIT INFO
# If you modify this, please make sure to also edit influxdb.service
# Command-line options that can be set in /etc/default/influxdb. These will override
# any config file values.
DEFAULT=/etc/default/influxdb
# Daemon options
INFLUXD_OPTS=
# Process name ( For display )
NAME=influxdb
# User and group
USER=influxdb
GROUP=influxdb
# Check for sudo or root privileges before continuing
if [ "$UID" != "0" ]; then
echo "You must be root to run this script"
exit 1
fi
# Daemon name, where is the actual executable If the daemon is not
# there, then exit.
DAEMON=/usr/bin/influxd
if [ ! -x $DAEMON ]; then
echo "Executable $DAEMON does not exist!"
exit 5
fi
# Configuration file
CONFIG=/etc/influxdb/influxdb.conf
# PID file for the daemon
PIDFILE=/var/run/influxdb/influxd.pid
PIDDIR=`dirname $PIDFILE`
if [ ! -d "$PIDDIR" ]; then
mkdir -p $PIDDIR
chown $USER:$GROUP $PIDDIR
fi
# Max open files
OPEN_FILE_LIMIT=65536
if [ -r /lib/lsb/init-functions ]; then
source /lib/lsb/init-functions
fi
# Logging
if [ -z "$STDOUT" ]; then
STDOUT=/dev/null
fi
if [ ! -f "$STDOUT" ]; then
mkdir -p $(dirname $STDOUT)
fi
if [ -z "$STDERR" ]; then
STDERR=/var/log/influxdb/influxd.log
fi
if [ ! -f "$STDERR" ]; then
mkdir -p $(dirname $STDERR)
fi
# Override init script variables with DEFAULT values
if [ -r $DEFAULT ]; then
source $DEFAULT
fi
function log_failure_msg() {
echo "$@" "[ FAILED ]"
}
function log_success_msg() {
echo "$@" "[ OK ]"
}
function start() {
# Check if config file exist
if [ ! -r $CONFIG ]; then
log_failure_msg "config file $CONFIG doesn't exist (or you don't have permission to view)"
exit 4
fi
# Check that the PID file exists, and check the actual status of process
if [ -f $PIDFILE ]; then
PID="$(cat $PIDFILE)"
if kill -0 "$PID" &>/dev/null; then
# Process is already up
log_success_msg "$NAME process is already running"
return 0
fi
else
su -s /bin/sh -c "touch $PIDFILE" $USER &>/dev/null
if [ $? -ne 0 ]; then
log_failure_msg "$PIDFILE not writable, check permissions"
exit 5
fi
fi
# Bump the file limits, before launching the daemon. These will
# carry over to launched processes.
ulimit -n $OPEN_FILE_LIMIT
if [ $? -ne 0 ]; then
log_failure_msg "Unable to set ulimit to $OPEN_FILE_LIMIT"
exit 1
fi
# Launch process
echo "Starting $NAME..."
if which start-stop-daemon &>/dev/null; then
start-stop-daemon \
--chuid $USER:$GROUP \
--start \
--quiet \
--pidfile $PIDFILE \
--exec $DAEMON \
-- \
-pidfile $PIDFILE \
-config $CONFIG \
$INFLUXD_OPTS >>$STDOUT 2>>$STDERR &
else
local CMD="$DAEMON -pidfile $PIDFILE -config $CONFIG $INFLUXD_OPTS >>$STDOUT 2>>$STDERR &"
su -s /bin/sh -c "$CMD" $USER
fi
# Sleep to verify process is still up
sleep 1
if [ -f $PIDFILE ]; then
# PIDFILE exists
if kill -0 $(cat $PIDFILE) &>/dev/null; then
# PID up, service running
log_success_msg "$NAME process was started"
return 0
fi
fi
log_failure_msg "$NAME process was unable to start"
exit 1
}
function stop() {
# Stop the daemon.
if [ -f $PIDFILE ]; then
local PID="$(cat $PIDFILE)"
if kill -0 $PID &>/dev/null; then
echo "Stopping $NAME..."
# Process still up, send SIGTERM and remove PIDFILE
kill -s TERM $PID &>/dev/null && rm -f "$PIDFILE" &>/dev/null
n=0
while true; do
# Enter loop to ensure process is stopped
kill -0 $PID &>/dev/null
if [ "$?" != "0" ]; then
# Process stopped, break from loop
log_success_msg "$NAME process was stopped"
return 0
fi
# Process still up after signal, sleep and wait
sleep 1
n=$(expr $n + 1)
if [ $n -eq 30 ]; then
# After 30 seconds, send SIGKILL
echo "Timeout exceeded, sending SIGKILL..."
kill -s KILL $PID &>/dev/null
elif [ $? -eq 40 ]; then
# After 40 seconds, error out
log_failure_msg "could not stop $NAME process"
exit 1
fi
done
fi
fi
log_success_msg "$NAME process already stopped"
}
function restart() {
# Restart the daemon.
stop
start
}
function status() {
# Check the status of the process.
if [ -f $PIDFILE ]; then
PID="$(cat $PIDFILE)"
if kill -0 $PID &>/dev/null; then
log_success_msg "$NAME process is running"
exit 0
fi
fi
log_failure_msg "$NAME process is not running"
exit 1
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status
;;
version)
$DAEMON version
;;
*)
# For invalid arguments, print the usage message.
echo "Usage: $0 {start|stop|restart|status|version}"
exit 2
;;
esac

View File

@@ -0,0 +1,8 @@
/var/log/influxdb/influxd.log {
daily
rotate 7
missingok
dateext
copytruncate
compress
}

View File

@@ -0,0 +1,73 @@
#!/bin/bash
BIN_DIR=/usr/bin
DATA_DIR=/var/lib/influxdb
LOG_DIR=/var/log/influxdb
SCRIPT_DIR=/usr/lib/influxdb/scripts
LOGROTATE_DIR=/etc/logrotate.d
function install_init {
cp -f $SCRIPT_DIR/init.sh /etc/init.d/influxdb
chmod +x /etc/init.d/influxdb
}
function install_systemd {
cp -f $SCRIPT_DIR/influxdb.service /lib/systemd/system/influxdb.service
systemctl enable influxdb
}
function install_update_rcd {
update-rc.d influxdb defaults
}
function install_chkconfig {
chkconfig --add influxdb
}
id influxdb &>/dev/null
if [[ $? -ne 0 ]]; then
useradd --system -U -M influxdb -s /bin/false -d $DATA_DIR
fi
chown -R -L influxdb:influxdb $DATA_DIR
chown -R -L influxdb:influxdb $LOG_DIR
# Add defaults file, if it doesn't exist
if [[ ! -f /etc/default/influxdb ]]; then
touch /etc/default/influxdb
fi
# Remove legacy symlink, if it exists
if [[ -L /etc/init.d/influxdb ]]; then
rm -f /etc/init.d/influxdb
fi
# Distribution-specific logic
if [[ -f /etc/redhat-release ]]; then
# RHEL-variant logic
which systemctl &>/dev/null
if [[ $? -eq 0 ]]; then
install_systemd
else
# Assuming sysv
install_init
install_chkconfig
fi
elif [[ -f /etc/debian_version ]]; then
# Debian/Ubuntu logic
which systemctl &>/dev/null
if [[ $? -eq 0 ]]; then
install_systemd
else
# Assuming sysv
install_init
install_update_rcd
fi
elif [[ -f /etc/os-release ]]; then
source /etc/os-release
if [[ $ID = "amzn" ]]; then
# Amazon Linux logic
install_init
install_chkconfig
fi
fi

View File

@@ -0,0 +1,56 @@
#!/bin/bash
function disable_systemd {
systemctl disable influxdb
rm -f /lib/systemd/system/influxdb.service
}
function disable_update_rcd {
update-rc.d -f influxdb remove
rm -f /etc/init.d/influxdb
}
function disable_chkconfig {
chkconfig --del influxdb
rm -f /etc/init.d/influxdb
}
if [[ -f /etc/redhat-release ]]; then
# RHEL-variant logic
if [[ "$1" = "0" ]]; then
# InfluxDB is no longer installed, remove from init system
rm -f /etc/default/influxdb
which systemctl &>/dev/null
if [[ $? -eq 0 ]]; then
disable_systemd
else
# Assuming sysv
disable_chkconfig
fi
fi
elif [[ -f /etc/lsb-release ]]; then
# Debian/Ubuntu logic
if [[ "$1" != "upgrade" ]]; then
# Remove/purge
rm -f /etc/default/influxdb
which systemctl &>/dev/null
if [[ $? -eq 0 ]]; then
disable_systemd
else
# Assuming sysv
disable_update_rcd
fi
fi
elif [[ -f /etc/os-release ]]; then
source /etc/os-release
if [[ $ID = "amzn" ]]; then
# Amazon Linux logic
if [[ "$1" = "0" ]]; then
# InfluxDB is no longer installed, remove from init system
rm -f /etc/default/influxdb
disable_chkconfig
fi
fi
fi

16
vendor/github.com/influxdata/influxdb/scripts/pre-install.sh generated vendored Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
if [[ -d /etc/opt/influxdb ]]; then
# Legacy configuration found
if [[ ! -d /etc/influxdb ]]; then
# New configuration does not exist, move legacy configuration to new location
echo -e "Please note, InfluxDB's configuration is now located at '/etc/influxdb' (previously '/etc/opt/influxdb')."
mv -vn /etc/opt/influxdb /etc/influxdb
if [[ -f /etc/influxdb/influxdb.conf ]]; then
backup_name="influxdb.conf.$(date +%s).backup"
echo "A backup of your current configuration can be found at: /etc/influxdb/$backup_name"
cp -a /etc/influxdb/influxdb.conf /etc/influxdb/$backup_name
fi
fi
fi