{"id":19900098,"url":"https://github.com/m-lab/measure-saver","last_synced_at":"2025-05-02T23:30:28.533Z","repository":{"id":56660786,"uuid":"271269485","full_name":"m-lab/measure-saver","owner":"m-lab","description":"Upload service for the M-Lab Measure Chrome Extension","archived":false,"fork":false,"pushed_at":"2024-01-19T14:44:57.000Z","size":110,"stargazers_count":3,"open_issues_count":2,"forks_count":2,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-10-29T14:53:24.074Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/m-lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-06-10T12:21:49.000Z","updated_at":"2023-11-20T11:10:46.000Z","dependencies_parsed_at":"2024-02-23T06:47:11.428Z","dependency_job_id":null,"html_url":"https://github.com/m-lab/measure-saver","commit_stats":null,"previous_names":["m-lab/measure-upload-service"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-lab%2Fmeasure-saver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-lab%2Fmeasure-saver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-lab%2Fmeasure-saver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-lab%2Fmeasure-saver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m-lab","download_url":"https://codeload.github.com/m-lab/measure-saver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224003673,"owners_count":17239482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T20:11:10.078Z","updated_at":"2024-11-12T20:11:10.679Z","avatar_url":"https://github.com/m-lab.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# M-Lab Measure Saver\n\n[![GoDoc](https://godoc.org/github.com/m-lab/measure-saver?status.svg)](https://godoc.org/github.com/m-lab/measure-saver) [![Build Status](https://travis-ci.com/m-lab/measure-saver.svg?branch=master)](https://travis-ci.org/m-lab/measure-saver) [![Coverage Status](https://coveralls.io/repos/github/m-lab/measure-saver/badge.svg?branch=master)](https://coveralls.io/github/m-lab/measure-saver?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/m-lab/measure-saver)](https://goreportcard.com/report/github.com/m-lab/measure-saver)\n\nThis repository contains the source code for the Measure Saver service that\ningests data from the M-Lab Measure Chrome Extension and stores it into a\nPostgreSQL database.\n\n## Building the service\n\n### Using Docker\n\n```bash\ndocker build -t measurementlab/measure-saver:latest .\n```\n\nThis will build a minimal Alpine Linux image containing a statically-linked measure-saver executable. This is the recommended way of building and running the service.\n\nFor further details about how the Docker build works, please read the [Dockerfile](Dockerfile)\n\n### From the source code\n\nIf you are making changes and just want to test them:\n\n```bash\ngo build ./cmd/measure-saver\n```\n\nThen run it with\n\n```bash\n./measure-saver\n```\n\nOr, you can install it in `$GOPATH/bin` with:\n\n```bash\ngo install ./cmd/measure-saver\n```\n\n## Testing the service\n\n### Running a PostgreSQL instance\n\nFirstly, make sure you're running a PostgreSQL database locally and you have\ncreated a user and a database for this service to use.\n\nFor the purpose of testing this application, you can just run it in a Docker\ncontainer:\n\n```bash\ndocker run --name postgres-dev -d postgres:12.3-alpine\n```\n\nThen, spawn a psql instance into the running container:\n\n```bash\ndocker exec -it postgres-dev psql -U postgres\n```\n\n...and create a database:\n\n```text\npostgres=# create database \"measure-saver\";\n```\n\n### Running the service\n\nWhen you run the service for the first time, the needed tables are\nautomatically created for you:\n\n```bash\ndocker run --network=host measurementlab/measure-saver:latest\n```\n\nA more complete example of how to run measure-saver with a remote PostgreSQL database, an authorized keys file and a TLS certificate:\n\n```bash\ndocker run --network=host measurementlab/measure-saver:latest \\\n  -db.addr \"myhost:5432\" \\\n  -db.name \"database-name\" \\\n  -db.user \"user\" \\\n  -db.pass \"password\" \\\n  -keys.file \"authorized_api_keys.txt\" \\\n  -tls.cert \"certs/cert.pem\" \\\n  -tls.key \"certs/key.pem\"\n```\n\nFor a complete and up-to-date list of the available flags, please refer to the\noutput of `-help`.\n\n### Using the service\n\nThe API only exposes one REST resource: `/v0/measurements`. To send a\nmeasurement to this API, send a `POST` request to this endpoint containing the\nJSON representing a measurement's result.\n\nExample:\n\n```json\n{\n  \"BrowserID\": \"a-unique-browser-id\",\n  \"DeviceType\": \"xyz\",\n  \"Notes\": \"This is a note\",\n  \"Download\": 100,\n  \"Upload\": 50,\n  \"Latency\": 20,\n  \"ClientInfo\": {\n    [the ClientInfo object]\n  },\n  \"ServerInfo\": {\n    [the ServerInfo object]\n  },\n  \"Results\": {\n    [the NDT results object]\n  }\n}\n```\n\nThe ClientInfo, ServerInfo and Results objects are defined\n[here](internal/model/measurement.go).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-lab%2Fmeasure-saver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm-lab%2Fmeasure-saver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-lab%2Fmeasure-saver/lists"}