Closed jayhding closed 8 years ago
@ndelitski would you entertain a pull request for supporting noauth?
@flaccid surely! sry didn't see notifications earlier. we will definitely fix it soon!
@ndelitski no worries, we also would like templating of the emails including html; I sent you an email, but basically just wondering if pull requests are ok or if you would rather do in your own way - templating for example is not a minor change.
PR with fixes are totally ok! but for features like email templating project needs significant refactoring as you said, it would be better if I do it by myself. I'll try release templating these week, it depends on my current workload
Mounting a template file(something like .hbs) into rancher-alarms container sounds good for you?
No problem, we'll keep an eye out and then after these 2 are addressed see if we can PR any fixes that might be laying around. I think for feature changes that are not minor, we'll start with an issue first.
Re: templating, handlebars is fine but we do need a basic way to do this in compose directly in rancher without using volumes if possible though it might make sense that the rancher-alarms container can simply take a volumes-from of a data container with custom templates inside.
@JayHaoDing @flaccid just released a prepatch version image with noauth fix, please check it out with your smtp server docker pull ndelitski/rancher-alarms:0.1.1-0
and then I release 0.1.1 and update latest
image
FYI code changes since 0.1.0 https://github.com/ndelitski/rancher-alarms/commit/aafeabb7e637c585f245b0863d1cf637bd70fce3
@ndelitski test result showed the solution did not work. I did not configure ALARM_EMAIL_USER and ALARM_EMAIL_PASS but seems smtp.auth is still not NULL.
npm info it worked if it ends with ok
npm info using npm@2.14.7
npm info using node@v4.2.1
npm info prestart rancher-alarms@0.1.0
npm info start rancher-alarms@0.1.0
> rancher-alarms@0.1.0 start /usr/src/app
> node bin/rancher-alarms.js
[INFO] 2016-3-1 22:45:42:554 trying to compose config from env variables
[INFO] 2016-3-1 22:45:42:572 started with config:
{
"rancher": {
"address": "http://rancher.xxx.xxx/v1/projects/***",
"auth": {
"accessKey": "***",
"secretKey": "***"
},
"projectId": "***"
},
"pollServicesInterval": 60000,
"filter": [
"***"
],
"notifications": {
"*": {
"targets": {
"email": {
"recipients": [
"xxx.xxx@***.***"
]
}
},
"healthcheck": {
"pollInterval": 15000,
"healthyThreshold": 3,
"unhealthyThreshold": 4
}
}
},
"targets": {
"email": {
"smtp": {
"from": "***@***",
"auth": {},
"host": "***",
"secureConnection": true,
"port": "25"
}
}
}
}
[ERROR] 2016-3-1 22:45:43:139 { [AssertionError: undefined == true]
name: 'AssertionError',
actual: undefined,
expected: true,
operator: '==',
message: 'undefined == true',
generatedMessage: true } AssertionError: undefined == true
at new EmailTarget (/usr/src/app/src/notifications/email.es6:18:7)
at Function.init (/usr/src/app/src/notifications/target.es6:12:12)
at ServiceStateMonitor.setupNotificationsTargets (/usr/src/app/src/monitor.es6:76:33)
at new ServiceStateMonitor (/usr/src/app/src/monitor.es6:69:12)
at initServiceMonitor$ (/usr/src/app/src/server.es6:52:12)
at tryCatch (/usr/src/app/node_modules/babel-core/node_modules/regenerator/runtime.js:61:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/src/app/node_modules/babel-core/node_modules/regenerator/runtime.js:328:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/src/app/node_modules/babel-core/node_modules/regenerator/runtime.js:94:21)
at invoke (/usr/src/app/node_modules/babel-core/node_modules/regenerator/runtime.js:136:37)
at callInvokeWithMethodAndArg (/usr/src/app/node_modules/babel-core/node_modules/regenerator/runtime.js:172:16)
at previousPromise (/usr/src/app/node_modules/babel-core/node_modules/regenerator/runtime.js:194:19)
at new Promise (/usr/src/app/node_modules/babel-core/node_modules/core-js/modules/es6.promise.js:197:7)
at AsyncIterator.enqueue (/usr/src/app/node_modules/babel-core/node_modules/regenerator/runtime.js:193:13)
at AsyncIterator.prototype.(anonymous function) [as next] (/usr/src/app/node_modules/babel-core/node_modules/regenerator/runtime.js:94:21)
at Object.runtime.async (/usr/src/app/node_modules/babel-core/node_modules/regenerator/runtime.js:215:14)
at initServiceMonitor (/usr/src/app/src/server.es6:51:22)
npm info rancher-alarms@0.1.0 Failed to exec start script
And just FYI, due to proxy issue we cannot use the rancher-alarms image directly so we have touse own Dockerfile and looks like
FROM node:4.2.1
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
RUN npm config set http-proxy http://x.x.x.x:8080
RUN npm config set https-proxy http://x.x.x.x:8080
RUN npm install
COPY . /usr/src/app
CMD [ "npm", "start" ]
@JayHaoDing no need to pass empty hash in auth
parameter, current logic is – if auth
present it should have credentials or it is invalid
But it didn't work according to my test. I simpley did not set any value (not mention at all) for USER and PASS in docker compose file. What else shall I do? To me it looked like the auth{} did not make the if check be failed.
Regards, Jay Ding
_____________________________
From: Nick Delitski notifications@github.com Sent: Wednesday, March 2, 2016 17:25 Subject: Re: [rancher-alarms] Anonymous Email Sending Failed (#1) To: ndelitski/rancher-alarms rancher-alarms@noreply.github.com Cc: Jay (Hao) Ding jay.dinghao@outlook.com
@JayHaoDing no need to pass empty hash in auth parameter, current logic is – if auth present it should have credentials or it is invalid
— Reply to this email directly or view it on GitHub.
Perhaps support either method and document best method in readme?
@JayHaoDing you are right, I forgot a part where environment variables are composed into config. In a future refactoring I am planning to move config asserts into one place. Updated master, this should fix. will update readme later
@ndelitski new changes have fixed this issue, thanks!
Good to close (after merge to master)?
will close soon after updating docs
Possible to wrap this one up soon?
Existing email sending schema requires auth method. It is necessary for public SMTP server but corporation internal SMTP can be used for anonymous email sending.
Therefore, default configuration will give following error
If the auth part is removed in email.es6 then it's fine