diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bab565d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM node:10-alpine + +COPY . /usr/local/caliper/ + +ENV MINI_BREAKPAD_SERVER_PORT 8080 + +RUN apk add --no-cache -q git && cd /usr/local/caliper && npm install && ./node_modules/.bin/grunt && npm cache clean --force + +RUN chmod 755 /usr/local/caliper/bin/caliper + +EXPOSE 8080 +VOLUME ["/usr/local/caliper/pool"] + +WORKDIR /usr/local/caliper +CMD ["/usr/local/caliper/bin/caliper"] diff --git a/README.md b/README.md index b44ae5a..04ccc1c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,11 @@ # Caliper + ### Reviving mini-breakpad-server + Mini-breakpad-server is basically abandonded at this point. Breakpad is still amazing technology, and people want to use it. Caliper is intended to be a middle ground between nothing and Socorro (Mozilla's breakpad infrastructure). ## Caliper holds your breaks. + This intends to be a simple server for crash reports sent by [google-breakpad](https://code.google.com/p/google-breakpad/). @@ -15,11 +18,18 @@ This intends to be a simple server for crash reports sent by ## Run +### Using Docker + +You can use Dockerfile provided by the repository to build and run server in Docker + +### Directly + * `npm install .` -- if this fails make sure you have node-gyp setup correctly * `grunt` * Put your breakpad symbols under `pool/symbols/PDBNAME/PDBUNIQUEIDENTIFIER/PDBNAMEASSYM` -* OR send a POST request to your server at /symbol_upload using googles symupload tool. +* OR send a POST request to your server at /symbol_upload?key=APIKEY using google's symupload tool. * `node lib/app.js` ## Breakpad crash sending + In the SendCrashReport function that breakpad provides, simply put "http://your.site/crash_upload". diff --git a/package.json b/package.json index 0e95a9a..ff9c89f 100644 --- a/package.json +++ b/package.json @@ -14,13 +14,13 @@ "dirty": "0.9.7", "express": "4.13.3", "express-session": "1.11.3", - "formidable": "~1.0.14", + "formidable": "~1.2.2", "fs-plus": "0.10.0", "github-releases": "0.1.x", "glob": "3.x", "jade": "~0.35.0", "method-override": "2.3.5", - "minidump": "0.9.0", + "minidump": "0.22.0", "mkdirp": "~0.3.5", "node-uuid": "~1.4.1", "passport": "0.3.0", diff --git a/src/app.coffee b/src/app.coffee index 5c64b38..2fe4c00 100644 --- a/src/app.coffee +++ b/src/app.coffee @@ -116,8 +116,9 @@ app.post '/crash_upload', (req, res, next) -> res.end() # handle the sympol upload post command. -app.post '/symbol_upload', isLoggedIn, (req, res, next) -> - return symbols.saveSymbols req, (error, destination) -> +app.post '/symbol_upload', (req, res, next) -> + return next "Invalid key" if req.query.key != api_key + return symbols.saveSymbols req, symbDb, (error, destination) -> return next error if error? console.log "Saved Symbols: #{destination}" return res.end() diff --git a/src/symbols.coffee b/src/symbols.coffee index 9c2ac3f..53780dd 100644 --- a/src/symbols.coffee +++ b/src/symbols.coffee @@ -4,7 +4,7 @@ mkdirp = require 'mkdirp' formidable = require 'formidable' # callback is of the form (error, destination). -module.exports.saveSymbols = (req, callback) -> +module.exports.saveSymbols = (req, symbDb, callback) -> form = new formidable.IncomingForm() return form.parse req, (error, fields, files) -> # return if this is a malformed request. @@ -15,7 +15,7 @@ module.exports.saveSymbols = (req, callback) -> # this puts files in a path of: # destination + fields.debug_file + debug_identifier - output_file_name = fields.debug_file.replace ".pdb", ".sym" + output_file_name = files.symbol_file.name.replace ".pdb", ".sym" # TODO: make this serialize-able destination = "pool/symbols" destination = path.join destination, fields.debug_file @@ -29,4 +29,5 @@ module.exports.saveSymbols = (req, callback) -> # copy the POST to destination. fs.copy files.symbol_file.path, destination, (error) -> return callback new Error("Cannot create file: #{destination}") if error? + symbDb.saveSymbol fields.debug_identifier, fields.debug_file return callback null, destination