Yolean / kafka-cache

Explorations for the log-backed in-memory cache we need in almost every service
6 stars 0 forks source link

Supply a prebuilt yolean/node-kafka-cache image #9

Open atamon opened 6 years ago

atamon commented 6 years ago

As we use the yolean/node-kafka image for pre-built node-rdkafka (and memdown) to reduce number of internal images that need to build these two, we need to bump both the image sha and the kafka-cache npm version number when upgrading node-rdkafka.

Supplying an image from this repository with a pre-built and pre-installed kafka-cache version that can just be used with npm link or something would remove one of these versioning steps.

solsson commented 6 years ago

TypeScript bailed on a lacking package. Solved during dev using a script like:

var http = require('https');
var fs = require('fs');

http.get("https://raw.githubusercontent.com/Blizzard/node-rdkafka/master/index.d.ts", function(response) {
  response.pipe(fs.createWriteStream("node_modules/@types/node-rdkafka/index.d.ts"));
  console.log('node-rdkafka types written');
});

var package = {
  "name": "@types/node-rdkafka",
  "version": "2.3.3"
};
fs.writeFile("node_modules/@types/node-rdkafka/package.json", package, function(err) {
  console.log('package.json written', err || 'ok');
});

Edit: I think this could be a git+https dependency. I wouldn't want to npm publish to @types because node-rdkafka comes with the .d.ts file.

solsson commented 6 years ago

Looks good, dev image runs node-rdkafka properly without a dependency in package.json. I think we should go ahead with this idea, but first I need to make sure production builds work too, and integration tests.

solsson commented 6 years ago

I've tested with https://github.com/Yolean/node-rdkafka-types and it seems to solve the TypeScript problem, without custom scripts. We're good to go. There's a new yolean/node-kafka@sha256:3acd64fcc616872ece886d115a0514f23f0a3ee98238d2ac0f9043abbc6cea37 without memdown.