Move all build-related scripts to /etc directory. Update default args
for start scripts. Add npm to builder Dockerfile. Remove stderr redirect in init script.pull/323/head
parent
50862b2638
commit
da42a07b28
|
@ -11,14 +11,22 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
|||
ruby-dev \
|
||||
rpm \
|
||||
zip \
|
||||
python \
|
||||
python-boto \
|
||||
asciidoc \
|
||||
xmlto \
|
||||
docbook-xsl
|
||||
python-pip
|
||||
|
||||
RUN pip install boto requests python-jose --upgrade
|
||||
RUN gem install fpm
|
||||
|
||||
# Install node
|
||||
RUN wget -q https://nodejs.org/dist/latest-v5.x/node-v5.11.1-linux-x64.tar.gz; \
|
||||
tar -xvf node-v5.11.1-linux-x64.tar.gz -C / --strip-components=1; \
|
||||
rm -f node-v5.11.1-linux-x64.tar.gz
|
||||
|
||||
# Update npm
|
||||
RUN cd $(npm root -g)/npm \
|
||||
&& npm install fs-extra \
|
||||
&& sed -i -e s/graceful-fs/fs-extra/ -e s/fs.rename/fs.move/ ./lib/utils/rename.js
|
||||
RUN npm install npm -g
|
||||
|
||||
# Install go
|
||||
ENV GOPATH /root/go
|
||||
ENV GO_VERSION 1.7.3
|
||||
|
@ -35,4 +43,4 @@ WORKDIR $PROJECT_DIR
|
|||
|
||||
VOLUME $PROJECT_DIR
|
||||
|
||||
ENTRYPOINT [ "/root/go/src/github.com/influxdata/chronograf/build.py" ]
|
||||
ENTRYPOINT [ "/root/go/src/github.com/influxdata/chronograf/etc/build.py" ]
|
|
@ -22,21 +22,18 @@ INSTALL_ROOT_DIR = "/usr/bin"
|
|||
LOG_DIR = "/var/log/chronograf"
|
||||
DATA_DIR = "/var/lib/chronograf"
|
||||
SCRIPT_DIR = "/usr/lib/chronograf/scripts"
|
||||
CONFIG_DIR = "/etc/chronograf"
|
||||
LOGROTATE_DIR = "/etc/logrotate.d"
|
||||
|
||||
INIT_SCRIPT = "scripts/init.sh"
|
||||
SYSTEMD_SCRIPT = "scripts/chronograf.service"
|
||||
POSTINST_SCRIPT = "scripts/post-install.sh"
|
||||
POSTUNINST_SCRIPT = "scripts/post-uninstall.sh"
|
||||
LOGROTATE_SCRIPT = "scripts/logrotate"
|
||||
DEFAULT_CONFIG = "etc/config.sample.toml"
|
||||
INIT_SCRIPT = "etc/scripts/init.sh"
|
||||
SYSTEMD_SCRIPT = "etc/scripts/chronograf.service"
|
||||
POSTINST_SCRIPT = "etc/scripts/post-install.sh"
|
||||
POSTUNINST_SCRIPT = "etc/scripts/post-uninstall.sh"
|
||||
LOGROTATE_SCRIPT = "etc/scripts/logrotate"
|
||||
|
||||
# Default AWS S3 bucket for uploads
|
||||
DEFAULT_BUCKET = "dl.influxdata.com/chronograf/artifacts"
|
||||
|
||||
CONFIGURATION_FILES = [
|
||||
CONFIG_DIR + '/chronograf.conf',
|
||||
LOGROTATE_DIR + '/chronograf',
|
||||
]
|
||||
|
||||
|
@ -115,7 +112,6 @@ def create_package_fs(build_root):
|
|||
LOG_DIR[1:],
|
||||
DATA_DIR[1:],
|
||||
SCRIPT_DIR[1:],
|
||||
CONFIG_DIR[1:],
|
||||
LOGROTATE_DIR[1:]
|
||||
]
|
||||
for d in dirs:
|
||||
|
@ -126,10 +122,7 @@ def package_scripts(build_root, config_only=False, windows=False):
|
|||
"""Copy the necessary scripts to the package filesystem.
|
||||
"""
|
||||
if config_only:
|
||||
# TODO: check whether we'll support a config file at some point
|
||||
logging.debug("Copying configuration to build directory.")
|
||||
shutil.copyfile(DEFAULT_CONFIG, os.path.join(build_root, "chronograf.conf"))
|
||||
os.chmod(os.path.join(build_root, "chronograf.conf"), 0o644)
|
||||
pass
|
||||
else:
|
||||
logging.debug("Copying scripts to build directory.")
|
||||
shutil.copyfile(INIT_SCRIPT, os.path.join(build_root, SCRIPT_DIR[1:], INIT_SCRIPT.split('/')[1]))
|
||||
|
@ -138,8 +131,6 @@ def package_scripts(build_root, config_only=False, windows=False):
|
|||
os.chmod(os.path.join(build_root, SCRIPT_DIR[1:], SYSTEMD_SCRIPT.split('/')[1]), 0o644)
|
||||
shutil.copyfile(LOGROTATE_SCRIPT, os.path.join(build_root, LOGROTATE_DIR[1:], "chronograf"))
|
||||
os.chmod(os.path.join(build_root, LOGROTATE_DIR[1:], "chronograf"), 0o644)
|
||||
shutil.copyfile(DEFAULT_CONFIG, os.path.join(build_root, CONFIG_DIR[1:], "chronograf.conf"))
|
||||
os.chmod(os.path.join(build_root, CONFIG_DIR[1:], "chronograf.conf"), 0o644)
|
||||
|
||||
def run_generate():
|
||||
"""Generate static assets.
|
|
@ -8,10 +8,7 @@ After=network-online.target
|
|||
[Service]
|
||||
User=chronograf
|
||||
Group=chronograf
|
||||
LimitNOFILE=65536
|
||||
EnvironmentFile=-/etc/default/chronograf
|
||||
ExecStart=/usr/bin/chronograf ${CHRONOGRAF_OPTS}
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
ExecStart=/usr/bin/chronograf --host localhost --port 10000 -b /var/lib/chronograf/chronograf.db -c /usr/share/chronograf
|
||||
KillMode=control-group
|
||||
Restart=on-failure
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
# Script to execute when starting
|
||||
SCRIPT="/usr/bin/chronograf"
|
||||
# Options to pass to the script on startup
|
||||
SCRIPT_OPTS="run -c /etc/chronograf/chronograf.conf"
|
||||
SCRIPT_OPTS="--host localhost --port 10000 -b /var/lib/chronograf/chronograf.db -c /usr/share/chronograf"
|
||||
|
||||
# User to run the process under
|
||||
RUNAS=chronograf
|
||||
|
@ -22,7 +22,6 @@ RUNAS=chronograf
|
|||
PIDFILE=/var/run/chronograf.pid
|
||||
# Where to redirect logging to
|
||||
LOGFILE=/var/log/chronograf/chronograf.log
|
||||
ERRLOGFILE=/var/log/chronograf/chronograf.log
|
||||
|
||||
start() {
|
||||
if [[ -f $PIDFILE ]]; then
|
||||
|
@ -33,7 +32,7 @@ start() {
|
|||
return 0
|
||||
fi
|
||||
fi
|
||||
local CMD="$SCRIPT $SCRIPT_OPTS 1>> \"$LOGFILE\" 2>> \"$ERRLOGFILE\" & echo \$!"
|
||||
local CMD="$SCRIPT $SCRIPT_OPTS 2>&1 1>> \"$LOGFILE\" & echo \$!"
|
||||
su -s /bin/sh -c "$CMD" $RUNAS > "$PIDFILE"
|
||||
if [[ -f $PIDFILE ]]; then
|
||||
# PIDFILE exists
|
Loading…
Reference in New Issue