Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node_faye
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
ikcrm_common
node_faye
Commits
9259c5b7
Commit
9259c5b7
authored
Jan 12, 2017
by
李福中
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Dockerfile for dingtalk ews
parent
0bae3380
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
118 additions
and
5 deletions
+118
-5
Dockerfile
+39
-0
README.md
+3
-1
app.js
+40
-0
ews.md
+7
-0
faye.js
+12
-3
package.json
+2
-1
yarn.lock
+15
-0
No files found.
Dockerfile
0 → 100644
View file @
9259c5b7
# FROM node
# # ENV NGINX_VERSION 1.11.8-1~jessie
# # RUN apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 \
# # && echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list \
# # && apt-get update \
# # && apt-get install --no-install-recommends --no-install-suggests -y \
# # ca-certificates \
# # nginx=${NGINX_VERSION} \
# # nginx-module-xslt \
# # nginx-module-geoip \
# # nginx-module-image-filter \
# # nginx-module-perl \
# # nginx-module-njs \
# # gettext-base \
# # && rm -rf /var/lib/apt/lists/*
# # RUN ln -sf /dev/stdout /var/log/nginx/access.log \
# # && ln -sf /dev/stderr /var/log/nginx/error.log
# # EXPOSE 80 443
# WORKDIR /app
# COPY . /app/
# ENTRYPOINT NODE_PORT=8080 node /app/app.js
# # ENTRYPOINT nginx -g daemon off;
FROM
readytalk/nodejs
WORKDIR
/app
COPY
. /app
CMD
[]
ENTRYPOINT
node /app/app.js
README.md
View file @
9259c5b7
...
...
@@ -9,7 +9,7 @@
git clone ssh://gitlab@gitlab.ikcrm.com:40022/ikcrm_common/node_faye.git
yarn install (或者: npm install)
node faye.js
[NODE_PORT=8000 WORKERS=4]
node faye.js
curl localhost:9991/faye/client.js
...
...
@@ -39,3 +39,5 @@ curl http://localhost:9991/faye -d 'message={[channel]("/messages/new",) [data](
client.subscribe('/messages', function(message) {
alert('Got a message: ' + message.text);
});
阿里聚石塔请参照 ews.md
app.js
0 → 100644
View file @
9259c5b7
var
http
=
require
(
'http'
),
fs
=
require
(
'fs'
),
faye
=
require
(
'faye'
),
fayeRedis
=
require
(
'faye-redis'
),
process
=
require
(
'process'
),
env
=
process
.
env
,
yaml
=
require
(
'js-yaml'
),
engineConf
=
{},
serPort
=
parseInt
(
env
[
"portslbhttp0"
]
||
env
[
"port.NODE_PORT"
]
||
env
[
"NODE_PORT"
]
||
8080
),
workers
=
parseInt
(
env
.
WORKERS
||
1
);
console
.
log
(
"Server running at http://127.0.0.1:"
+
serPort
);
if
(
env
[
"REDIS_CONF"
])
{
engineConf
=
JSON
.
parse
(
env
[
"REDIS_CONF"
]);
engineConf
.
type
=
fayeRedis
;
}
if
(
!
fs
.
existsSync
(
"tmp"
))
fs
.
mkdirSync
(
"tmp"
);
if
(
!
fs
.
existsSync
(
"tmp/pids"
))
fs
.
mkdirSync
(
"tmp/pids"
);
fs
.
writeFileSync
(
'tmp/pids/faye.'
+
serPort
+
'.pid'
,
process
.
pid
);
function
createServer
(
port
)
{
var
server
=
http
.
createServer
(),
bayeux
=
new
faye
.
NodeAdapter
({
mount
:
'/faye'
,
timeout
:
45
,
engine
:
engineConf
});
bayeux
.
attach
(
server
);
server
.
listen
(
port
);
}
for
(
var
i
=
1
;
i
<
workers
;
i
++
)
{
setTimeout
(
createServer
,
0
,
serPort
+
i
);
}
createServer
(
serPort
);
ews.md
0 → 100644
View file @
9259c5b7
### 环境配置
<pre>
名称: REDIS_CONF
值: {"host":"xxx","password":"xxx","port":6379,"database":0}
说明: Faye Redis JSON格式配置
</pre>
\ No newline at end of file
faye.js
View file @
9259c5b7
...
...
@@ -28,6 +28,7 @@ var http = require('http'),
port
=
process
.
env
.
PORT
||
9901
,
yaml
=
require
(
'js-yaml'
),
redisFilePath
=
"config/redis.yml"
,
workers
=
process
.
env
.
WORKERS_COUNT
||
1
,
engineConf
=
{};
...
...
@@ -43,12 +44,20 @@ if ( !fs.existsSync("tmp/pids") ) fs.mkdirSync("tmp/pids");
fs
.
writeFileSync
(
'tmp/pids/faye.'
+
port
+
'.pid'
,
process
.
pid
);
var
server
=
http
.
createServer
(),
function
createServer
(
port
)
{
var
server
=
http
.
createServer
(),
bayeux
=
new
faye
.
NodeAdapter
({
mount
:
'/faye'
,
timeout
:
45
,
engine
:
engineConf
});
bayeux
.
attach
(
server
);
server
.
listen
(
port
);
bayeux
.
attach
(
server
);
server
.
listen
(
port
);
}
for
(
var
i
=
1
;
i
<
workers
;
i
++
)
{
setTimeout
(
createServer
,
0
,
port
+
i
);
}
createServer
(
port
);
package.json
View file @
9259c5b7
...
...
@@ -9,6 +9,7 @@
"
faye
"
:
"^1.2.3"
,
"
faye-redis
"
:
"^0.2.0"
,
"
js-yaml
"
:
"^3.7.0"
,
"
process
"
:
"^0.11.9"
"
process
"
:
"^0.11.9"
,
"
ws
"
:
"^1.1.1"
}
}
yarn.lock
View file @
9259c5b7
...
...
@@ -55,6 +55,10 @@ js-yaml@^3.7.0:
argparse "^1.0.7"
esprima "^2.6.0"
options@>=0.0.5:
version "0.0.6"
resolved "https://registry.yarnpkg.com/options/-/options-0.0.6.tgz#ec22d312806bb53e731773e7cdaefcf1c643128f"
process@^0.11.9:
version "0.11.9"
resolved "https://registry.yarnpkg.com/process/-/process-0.11.9.tgz#7bd5ad21aa6253e7da8682264f1e11d11c0318c1"
...
...
@@ -97,6 +101,10 @@ tunnel-agent@*:
version "0.4.3"
resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.4.3.tgz#6373db76909fe570e08d73583365ed828a74eeeb"
ultron@1.0.x:
version "1.0.2"
resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.0.2.tgz#ace116ab557cd197386a4e88f4685378c8b2e4fa"
websocket-driver@>=0.5.1:
version "0.6.5"
resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.6.5.tgz#5cb2556ceb85f4373c6d8238aa691c8454e13a36"
...
...
@@ -106,3 +114,10 @@ websocket-driver@>=0.5.1:
websocket-extensions@>=0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.1.tgz#76899499c184b6ef754377c2dbb0cd6cb55d29e7"
ws@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ws/-/ws-1.1.1.tgz#082ddb6c641e85d4bb451f03d52f06eabdb1f018"
dependencies:
options ">=0.0.5"
ultron "1.0.x"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment