Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.55 KB | None | 0 0
  1. Last login: Wed Mar 22 13:32:23 on ttys015
  2. l% πŸ‘ 🐝 𝗠 ➜ apigateway git:(master) βœ— ls
  3. CONTRIBUTING.md Makefile conf.d init.sh tests
  4. Dockerfile README.md doc naxsi_core.rules tools
  5. LICENSE.txt api-gateway.conf html scripts
  6. πŸ‘ 🐝 𝗠 ➜ apigateway git:(master) βœ— docker ps
  7. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
  8. 4f8fbe048201 openwhisk/apigateway:latest "/etc/init-contain..." 40 seconds ago Up 39 seconds 0.0.0.0:80->80/tcp, 0.0.0.0:9000->9000/tcp, 8423/tcp, 0.0.0.0:32776->8080/tcp apigateway
  9. ba7e1d51a06f redis "docker-entrypoint..." About an hour ago Up About an hour 0.0.0.0:6379->6379/tcp trusting_bardeen
  10. πŸ‘ 🐝 𝗠 ➜ apigateway git:(master) βœ— docker ps
  11. πŸ‘ 🐝 𝗠 ➜ apigateway git:(master) βœ— ls
  12. CONTRIBUTING.md Makefile conf.d init.sh tests
  13. Dockerfile README.md doc naxsi_core.rules tools
  14. LICENSE.txt api-gateway.conf html scripts
  15. πŸ‘ 🐝 𝗠 ➜ apigateway git:(master) βœ— git commit -m "fix broken ratelimiting" -a
  16. [master 18985bc] fix broken ratelimiting
  17. Committer: Taylor King <taylor@taylors-mbp.raleigh.ibm.com>
  18. Your name and email address were configured automatically based
  19. on your username and hostname. Please check that they are accurate.
  20. You can suppress this message by setting them explicitly:
  21.  
  22. git config --global user.name "Your Name"
  23. git config --global user.email you@example.com
  24.  
  25. After doing this, you may fix the identity used for this commit with:
  26.  
  27. git commit --amend --reset-author
  28.  
  29. 1 file changed, 1 deletion(-)
  30. πŸ‘ 🐝 𝗠 ➜ apigateway git:(master) βœ— git rebase HEAD~2 -i
  31. [detached HEAD 19b7817] fix broken ratelimiting
  32. Date: Wed Mar 22 13:32:39 2017 -0400
  33. Committer: Taylor King <taylor@taylors-mbp.raleigh.ibm.com>
  34. Your name and email address were configured automatically based
  35. on your username and hostname. Please check that they are accurate.
  36. You can suppress this message by setting them explicitly:
  37.  
  38. git config --global user.name "Your Name"
  39. git config --global user.email you@example.com
  40.  
  41. After doing this, you may fix the identity used for this commit with:
  42.  
  43. git commit --amend --reset-author
  44.  
  45. 2 files changed, 9 insertions(+), 4 deletions(-)
  46. ls
  47. Successfully rebased and updated refs/heads/master.
  48. πŸ‘ 🐝 𝗠 ➜ apigateway git:(master) βœ— ls
  49. CONTRIBUTING.md Makefile conf.d init.sh tests
  50. Dockerfile README.md doc naxsi_core.rules tools
  51. LICENSE.txt api-gateway.conf html scripts
  52. πŸ‘ 🐝 𝗠 ➜ apigateway git:(master) βœ— cd ..
  53. πŸ‘ 🐝 𝗠 ➜ projects git:(master) βœ— ls
  54. Architecture html5up-big-picture-8728
  55. GbaByteFiddle html5up-prologue-8725
  56. LuaJIT-2.0.4 ipfs
  57. LuaJIT-2.0.4.tar.gz jepsen
  58. Makefile jinglesbot
  59. Nightcode juhu
  60. OpenRCT2 juhu2
  61. PrologExercises kafka
  62. SmartSim kompose
  63. TSH linux-stable
  64. a.out lua-5.3.3
  65. a.out.dSYM lua-5.3.3.tar.gz
  66. a8ctl lua-resty-string
  67. angular luaffi
  68. apic-auto-deploy luarocks-2.4.1
  69. apic-tract-client luarocks-2.4.1.tar.gz
  70. apigateway macemu
  71. apigateway-datastore mangodb
  72. apigateway-examples merge.C
  73. apigateway-test mesos-infrastructure-master.zip
  74. apim microgateway
  75. apim-ui ms
  76. apimesh msutil
  77. apisman msutil-master.zip
  78. bhendi new
  79. bluemix-service-broker node-v4.5.0
  80. bob node-v4.5.0.tar.gz
  81. btc node-vim-debugger
  82. build node_modules
  83. c11 nomouse
  84. cassandra npm-debug.log
  85. certs old
  86. check old2
  87. checkedc openwhisk
  88. checkedc-clang out
  89. checkedc-llvm overflow
  90. cljsplayground passwordCrack.class
  91. clojurescript passwordCrack.java
  92. clsh pearpc
  93. cookies.txt prolog-bot
  94. crow quicksort.c
  95. csim quicksort.o
  96. cucked repl
  97. curl rubber-docker
  98. d2 run.sh
  99. devops sample-api
  100. devportal simple-node
  101. devportal_large_files t
  102. dotfiles taylor
  103. dragos tea
  104. dtc test.beam
  105. eddie-final test.c
  106. emoji-prompt test.erl
  107. example.js test.go
  108. fakeredis test.js
  109. fivewords test.o
  110. gateway-director test.sh
  111. gateway-director-apigateway test_dummy.C
  112. gateway-director-bluemix testms
  113. gateway-director-interface testproject
  114. gateway-director-interface2 timg
  115. gateway-director-management-interface tinycljwm
  116. gateway-director-management-interface-legacy tora
  117. gateway-director-test tora.wiki
  118. gateway-service-gw-controller tract
  119. gd-bluemix2 tset.c
  120. generator tt1
  121. git tush
  122. gosh vim
  123. gotest vim-misc
  124. gprolog web
  125. gprolog-1.4.4.tar.gz web.tar.gz
  126. hpapi xterm.js
  127. πŸ‘ 🐝 𝗠 ➜ projects git:(master) βœ— cd gateway-director-bluemix
  128. πŸ‘ 🐝 𝗠 ➜ gateway-director-bluemix git:(master) βœ— ls
  129. Dockerfile _deploy-config environments package.json server
  130. Jenkinsfile common node_modules runctl utils
  131. πŸ‘ 🐝 𝗠 ➜ gateway-director-bluemix git:(master) βœ— git log
  132. πŸ‘ 🐝 𝗠 ➜ gateway-director-bluemix git:(master) βœ— ls
  133. Dockerfile _deploy-config environments package.json server
  134. Jenkinsfile common node_modules runctl utils
  135. πŸ‘ 🐝 𝗠 ➜ gateway-director-bluemix git:(master) βœ— git branch --list
  136. develop
  137. * logging
  138. logging2
  139. test
  140. πŸ‘ 🐝 𝗠 ➜ gateway-director-bluemix git:(master) βœ— ls
  141. Dockerfile _deploy-config environments package.json server
  142. Jenkinsfile common node_modules runctl utils
  143. πŸ‘ 🐝 𝗠 ➜ gateway-director-bluemix git:(master) βœ— cd ..
  144. πŸ‘ 🐝 𝗠 ➜ projects git:(master) βœ— ls
  145. Architecture html5up-big-picture-8728
  146. GbaByteFiddle html5up-prologue-8725
  147. LuaJIT-2.0.4 ipfs
  148. LuaJIT-2.0.4.tar.gz jepsen
  149. Makefile jinglesbot
  150. Nightcode juhu
  151. OpenRCT2 juhu2
  152. PrologExercises kafka
  153. SmartSim kompose
  154. TSH linux-stable
  155. a.out lua-5.3.3
  156. a.out.dSYM lua-5.3.3.tar.gz
  157. a8ctl lua-resty-string
  158. angular luaffi
  159. apic-auto-deploy luarocks-2.4.1
  160. apic-tract-client luarocks-2.4.1.tar.gz
  161. apigateway macemu
  162. apigateway-datastore mangodb
  163. apigateway-examples merge.C
  164. apigateway-test mesos-infrastructure-master.zip
  165. apim microgateway
  166. apim-ui ms
  167. apimesh msutil
  168. apisman msutil-master.zip
  169. bhendi new
  170. bluemix-service-broker node-v4.5.0
  171. bob node-v4.5.0.tar.gz
  172. btc node-vim-debugger
  173. build node_modules
  174. c11 nomouse
  175. cassandra npm-debug.log
  176. certs old
  177. check old2
  178. checkedc openwhisk
  179. checkedc-clang out
  180. checkedc-llvm overflow
  181. cljsplayground passwordCrack.class
  182. clojurescript passwordCrack.java
  183. clsh pearpc
  184. cookies.txt prolog-bot
  185. crow quicksort.c
  186. csim quicksort.o
  187. cucked repl
  188. curl rubber-docker
  189. d2 run.sh
  190. devops sample-api
  191. devportal simple-node
  192. devportal_large_files t
  193. dotfiles taylor
  194. dragos tea
  195. dtc test.beam
  196. eddie-final test.c
  197. emoji-prompt test.erl
  198. example.js test.go
  199. fakeredis test.js
  200. fivewords test.o
  201. gateway-director test.sh
  202. gateway-director-apigateway test_dummy.C
  203. gateway-director-bluemix testms
  204. gateway-director-interface testproject
  205. gateway-director-interface2 timg
  206. gateway-director-management-interface tinycljwm
  207. gateway-director-management-interface-legacy tora
  208. gateway-director-test tora.wiki
  209. gateway-service-gw-controller tract
  210. gd-bluemix2 tset.c
  211. generator tt1
  212. git tush
  213. gosh vim
  214. gotest vim-misc
  215. gprolog web
  216. gprolog-1.4.4.tar.gz web.tar.gz
  217. hpapi xterm.js
  218. πŸ‘ 🐝 𝗠 ➜ projects git:(master) βœ— cd ..
  219. πŸ‘ 🐝 𝗠 ➜ ~ git:(master) βœ— cd projects
  220. πŸ‘ 🐝 𝗠 ➜ projects git:(master) βœ— ls
  221. Architecture html5up-big-picture-8728
  222. GbaByteFiddle html5up-prologue-8725
  223. LuaJIT-2.0.4 ipfs
  224. LuaJIT-2.0.4.tar.gz jepsen
  225. Makefile jinglesbot
  226. Nightcode juhu
  227. OpenRCT2 juhu2
  228. PrologExercises kafka
  229. SmartSim kompose
  230. TSH linux-stable
  231. a.out lua-5.3.3
  232. a.out.dSYM lua-5.3.3.tar.gz
  233. a8ctl lua-resty-string
  234. angular luaffi
  235. apic-auto-deploy luarocks-2.4.1
  236. apic-tract-client luarocks-2.4.1.tar.gz
  237. apigateway macemu
  238. apigateway-datastore mangodb
  239. apigateway-examples merge.C
  240. apigateway-test mesos-infrastructure-master.zip
  241. apim microgateway
  242. apim-ui ms
  243. apimesh msutil
  244. apisman msutil-master.zip
  245. bhendi new
  246. bluemix-service-broker node-v4.5.0
  247. bob node-v4.5.0.tar.gz
  248. btc node-vim-debugger
  249. build node_modules
  250. c11 nomouse
  251. cassandra npm-debug.log
  252. certs old
  253. check old2
  254. checkedc openwhisk
  255. checkedc-clang out
  256. checkedc-llvm overflow
  257. cljsplayground passwordCrack.class
  258. clojurescript passwordCrack.java
  259. clsh pearpc
  260. cookies.txt prolog-bot
  261. crow quicksort.c
  262. csim quicksort.o
  263. cucked repl
  264. curl rubber-docker
  265. d2 run.sh
  266. devops sample-api
  267. devportal simple-node
  268. devportal_large_files t
  269. dotfiles taylor
  270. dragos tea
  271. dtc test.beam
  272. eddie-final test.c
  273. emoji-prompt test.erl
  274. example.js test.go
  275. fakeredis test.js
  276. fivewords test.o
  277. gateway-director test.sh
  278. gateway-director-apigateway test_dummy.C
  279. gateway-director-bluemix testms
  280. gateway-director-interface testproject
  281. gateway-director-interface2 timg
  282. gateway-director-management-interface tinycljwm
  283. gateway-director-management-interface-legacy tora
  284. gateway-director-test tora.wiki
  285. gateway-service-gw-controller tract
  286. gd-bluemix2 tset.c
  287. generator tt1
  288. git tush
  289. gosh vim
  290. gotest vim-misc
  291. gprolog web
  292. gprolog-1.4.4.tar.gz web.tar.gz
  293. hpapi xterm.js
  294. πŸ‘ 🐝 𝗠 ➜ projects git:(master) βœ— cd gateway-director-test
  295. πŸ‘ 🐝 𝗠 ➜ gateway-director-test git:(master) βœ— ls
  296. README.md id_rsa.pub scenario2 scenario7
  297. certs manipulateCatalogs scenario3 scenario8
  298. deleteCatalogs package.json scenario4 scenario9
  299. deleteSubs scenario0 scenario5 sendCatalogs
  300. gateway-director-apigateway scenario1 scenario6 testcases
  301. πŸ‘ 🐝 𝗠 ➜ gateway-director-test git:(master) βœ— cd scenario9
  302. πŸ‘ 🐝 𝗠 ➜ scenario9 git:(master) βœ— ls
  303. cassandra gateway-director-bluemix gateway-director-swagger
  304. docker-compose.yml gateway-director-interface install.sh
  305. gateway-director-apigateway gateway-director-redis openwhisk-apigateway
  306. πŸ‘ 🐝 𝗠 ➜ scenario9 git:(master) βœ— cd gateway-director-bluemix
  307. πŸ‘ 🐝 𝗠 ➜ gateway-director-bluemix git:(master) βœ— ls
  308. Dockerfile _deploy-config environments package.json utils
  309. Jenkinsfile common node_modules server
  310. πŸ‘ 🐝 𝗠 ➜ gateway-director-bluemix git:(master) βœ— git log
  311. πŸ‘ 🐝 𝗠 ➜ gateway-director-bluemix git:(master) βœ— git remote -v
  312. origin git@github.ibm.com:apimesh/gateway-director-bluemix.git (fetch)
  313. origin git@github.ibm.com:apimesh/gateway-director-bluemix.git (push)
  314. taylor git@github.ibm.com:taylor-king1/gateway-director-bluemix (fetch)
  315. taylor git@github.ibm.com:taylor-king1/gateway-director-bluemix (push)
  316. πŸ‘ 🐝 𝗠 ➜ gateway-director-bluemix git:(master) βœ— ls
  317. Dockerfile _deploy-config environments package.json utils
  318. Jenkinsfile common node_modules server
  319. πŸ‘ 🐝 𝗠 ➜ gateway-director-bluemix git:(master) βœ— git push -u origin
  320. Enter passphrase for key '/Users/taylor/.ssh/id_rsa':
  321.  
  322. πŸ‘ 🐝 𝗠 ➜ gateway-director-bluemix git:(master) βœ— git push -u taylor
  323. Enter passphrase for key '/Users/taylor/.ssh/id_rsa':
  324. Enter passphrase for key '/Users/taylor/.ssh/id_rsa':
  325. Total 0 (delta 0), reused 0 (delta 0)
  326. To github.ibm.com:taylor-king1/gateway-director-bluemix
  327. ca7679d..06b140c kafka -> kafka
  328. Branch kafka set up to track remote branch kafka from taylor.
  329. πŸ‘ 🐝 𝗠 ➜ gateway-director-bluemix git:(master) βœ— ls
  330. Dockerfile _deploy-config environments package.json utils
  331. Jenkinsfile common node_modules server
  332. πŸ‘ 🐝 𝗠 ➜ gateway-director-bluemix git:(master) βœ— cd ..
  333. πŸ‘ 🐝 𝗠 ➜ scenario9 git:(master) βœ— ls
  334. cassandra gateway-director-bluemix gateway-director-swagger
  335. docker-compose.yml gateway-director-interface install.sh
  336. gateway-director-apigateway gateway-director-redis openwhisk-apigateway
  337. πŸ‘ 🐝 𝗠 ➜ scenario9 git:(master) βœ— cd gateway-director-interface
  338. πŸ‘ 🐝 𝗠 ➜ gateway-director-interface git:(master) βœ— ls
  339. Dockerfile README.md common definitions node_modules server
  340. Jenkinsfile _deploy-config configs environments package.json utils
  341. πŸ‘ 🐝 𝗠 ➜ gateway-director-interface git:(master) βœ— cd common
  342. πŸ‘ 🐝 𝗠 ➜ common git:(master) βœ— ls
  343. models
  344. πŸ‘ 🐝 𝗠 ➜ common git:(master) βœ— cd models
  345. πŸ‘ 🐝 𝗠 ➜ models git:(master) βœ— ls
  346. health.js health.json package.js package.json product.js product.json
  347. πŸ‘ 🐝 𝗠 ➜ models git:(master) βœ— vi package.js
  348.  
  349. 'use strict';
  350. var logger = require('../../utils/logger')
  351. .child({ loc: 'models:package' });
  352. var _ = require('lodash');
  353. var db = require('../../utils/persistence');
  354. var Promise = require('bluebird');
  355. var apiGateway = require('../../utils/api-gateway');
  356. var uuidV4 = require('uuid/v4');
  357. var requestQueue = require('../../utils/queue');
  358. //var requestQueue = [];
  359. var requestStillProcessing = false;
  360. + const ZOOKEEPER_HOST = process.env['ZOOKEEPER_HOST'] || process.env['DC_HOST'];
  361. + const ZOOKEEPER_PORT = process.env['ZOOKEEPER_PORT'] || 2181
  362. + const ZOOKEEPER_CONNSTRING = ZOOKEEPER_HOST + ":" + ZOOKEEPER_PORT;
  363. +
  364. + const INPUT_TOPIC = 'input_topic';
  365. +
  366. + const kafka = require('kafka-node')
  367. + var client = new kafka.Client(ZOOKEEPER_CONNSTRING), var consumer = new kafka.Consumer(client, [{topic: INPUT_TOPI C, offset:0}]);
  368. +
  369. + consumer.on('message', (message) => {
  370. + logger.info("recieved kafka message! " + message);
  371. + });
  372. +
  373. + consumer.on('error', (error) => {
  374. + logger.error('encountered a kafka error: ' + error);
  375. + })
  376. +
  377.  
  378. module.exports = function(Package) {
  379.  
  380. //start the init array
  381. setInterval(function () {
  382. if(db.isDatabaseUp()){
  383. processRequest();
  384. }
  385. }, 1000);
  386.  
  387. +
  388. Package.countAllPackages = () => {
  389. return db.countAllPackages()
  390. .then((countResult) => {
  391. return Promise.resolve(countResult.count);
  392. }).catch((err) =>{
  393. logger.error(err);
  394. throw err;
  395. });
  396. };
  397.  
  398. Package.countPackagesByOrgAndCatalog = (orgid, catalogid) => {
  399. return db.countPackagesByOrgAndCatalog(orgid, catalogid)
  400. .then((countResult) => {
  401. return Promise.resolve(countResult.count);
  402. }).catch((err) =>{
  403. logger.error(err);
  404. throw err;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement