diff --git a/Dockerfile b/Dockerfile index 8555003..3b328e0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ RUN apt-get update \ WORKDIR /docker-discover COPY package.json package-lock.json ./ -RUN npm install --only=prod +RUN npm install --omit=dev COPY index.js config.yml rproxy.handlebars ./ diff --git a/config.yml b/config.yml index 1f3d0c9..90e084e 100644 --- a/config.yml +++ b/config.yml @@ -9,7 +9,7 @@ rproxy: - rproxy2.local auth: username: root - privateKey: /root/.ssh/id_rsa + privateKeyPath: /root/.ssh/id_rsa confDir: /etc/haproxy reloadCmd: service haproxy reload acls: diff --git a/index.js b/index.js index e120fdd..12fc5bf 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ require('require-yaml'); const Docker = require('dockerode'); const handlebars = require('handlebars'); -const ssh = require('node-ssh'); +const {NodeSSH} = require('node-ssh'); const fs = require('fs-extra'); const shajs = require('sha.js'); const conf = require('./config.yml'); @@ -148,7 +148,7 @@ async function updateProxy(firstRun) { console.log(`Updating host: ${host}`); if (!isProduction) continue; - const sshClient = new ssh(); + const sshClient = new NodeSSH(); await sshClient.connect(Object.assign({host}, conf.rproxy.auth)); await sshClient.putFiles([files]); if (firstRun) @@ -158,7 +158,7 @@ async function updateProxy(firstRun) { {recursive: true} ); if (conf.rproxy.reloadCmd) - await sshClient.exec(conf.rproxy.reloadCmd); + await sshClient.execCommand(conf.rproxy.reloadCmd); await sshClient.dispose(); }