diff --git a/Dockerfile b/Dockerfile index 49b3813..90cb9ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,5 +6,8 @@ EXPOSE 8080 # Set this variable to the name of your production config file (without the extension) ENV NODE_ENV development +# Set this variable to the folder where the logs should be place (must exist) +ENV LOG_PATH './log' + # Set this variable to the value of the secret field of the Github webhook ENV WEBHOOK_SECRET '' diff --git a/bot/index.js b/bot/index.js index 812a249..3781609 100644 --- a/bot/index.js +++ b/bot/index.js @@ -8,9 +8,9 @@ const logger = winston.createLogger({ level: 'info', format: winston.format.json(), transports: [ - new winston.transports.File({ filename: config.logPath + 'error.log', level: 'error' }), - new winston.transports.File({ filename: config.logPath + 'info.log', level: 'info' }), - new winston.transports.File({ filename: 'combined.log' }) + new winston.transports.File({ filename: './log/error.log', level: 'error' }), + new winston.transports.File({ filename: './log/info.log', level: 'info' }), + // new winston.transports.File({ filename: './log/combined.log' }) ] }); diff --git a/config/default.js b/config/default.js index 3960609..c2b7d7e 100644 --- a/config/default.js +++ b/config/default.js @@ -7,9 +7,6 @@ module.exports = { // URL where the bot is listening (e.g. '/funding') urlEndpoint: '', - // Path for the log files inside the docker image (e.g. './log/'), remember to create the folder inside the docker workspace if you change it (the folde will be copied to the docker image during the build) - logPath: '', - // URL for the signer (e.g. 'https://ropsten.infura.io') signerPath: '', diff --git a/restart.sh b/restart.sh index 20112a3..662dc6a 100755 --- a/restart.sh +++ b/restart.sh @@ -1,6 +1,7 @@ CONTAINER_ID="$(docker ps -lq)" +LOG_PATH=$(readlink -f './log') docker stop ${CONTAINER_ID} docker build -t autobounty . -sudo docker run -d -p 8080:8080 autobounty & - + docker run -d --mount source=$LOG_PATH,target=/usr/src/app/log -p 8080:8080 autobounty +docker run -d -v ${LOG_PATH}:/usr/src/app/log -p 8080:8080 autobounty &