{ "info": { "author": "Jaime Wissner", "author_email": "jwissner@billtrust.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7" ], "description": "# SLA Monitor Worker\n\nThis is the test runner portion of the SLA monitor/reporter. It performs tests (or any command you want) repeatedly, and publishes success/failure to an SNS topic for external processing (for example, using lambda to write to a custom cloudwatch metric), as well as optionally uploading logs to an S3 bucket.\n\nTODO: Unit tests not working\n\n## Installing\n\nTo install simply install via pip\n\n```bash\npip install --user sla-runner\n```\n\nHighly recommended is iam-docker run:\n\n```bash\npip install --user iam-docker-run\n```\n\nThis project assumes you are using role based authentication, as would be used in a production environment in AWS. This mimics that environment by running with an actual role.\n\n## Terraform\n\nExcute the following in the root folder to run terraform. Obviously, have Terraform installed. Set the bucket and table variables to existing backend resources for remote state.\n\n**IMPORTANT: IF YOU ARE SWITCHING ACCOUNTS (e.g. dev, stage, prod), DELETE THE .terraform FOLDER BEFORE RUNNING IN THE NEW ENVIRONMENT**\n\n```shell\n# pip install iam-starter\ncd terraform && \\\nexport AWS_ENV=\"dev\" && \\\nexport AWS_BACKEND_REGION=\"us-east-1\" && \\\nexport AWS_DEFAULT_REGION=\"us-east-1\" && \\\nexport AWS_REMOTE_BUCKET=\"billtrust-tfstate-$AWS_ENV\" && \\\nexport AWS_REMOTE_TABLE=\"tfstate_$AWS_ENV\" && \\\niam-starter \\\n --profile $AWS_ENV \\\n --command \\\n \"terraform init \\\n -backend-config=\\\"region=$AWS_BACKEND_REGION\\\" \\\n -backend-config=\\\"bucket=$AWS_REMOTE_BUCKET\\\" \\\n -backend-config=\\\"dynamodb_table=$AWS_REMOTE_TABLE\\\" && \\\n terraform apply \\\n --auto-approve \\\n -var \\\"aws_env=$AWS_ENV\\\" \\\n -var \\\"aws_region=$AWS_DEFAULT_REGION\\\"\"\n```\n\n## Using\n\nUse iam-docker-run outside of AWS to run tests. In real life scenarios on ECS, instead install sla-runner via pypi in your service container, and set `--image` to the image of the service container which contains your test.\n\n```bash\ndocker build -t sla-monitor/sla-runner:latest .\n\nexport AWS_ENV=\"dev\"\niam-docker-run \\\n -e SLARUNNER_COMMAND=\"/bin/bash /src/test-scripts/run-tests.sh\" \\\n -e SLARUNNER_SERVICE=example-service \\\n -e SLARUNNER_GROUPS=\"dev-team,critical\" \\\n -e SLARUNNER_DELAY=30 \\\n -e SLARUNNER_SNSTOPICNAME=\"sla-monitor-result-published-$AWS_ENV\" \\\n -e SLARUNNER_S3BUCKETNAME=\"sla-monitoring-logs-$AWS_ENV\" \\\n --full-entrypoint \"sla-runner\" \\\n --region us-east-1 \\\n --profile $AWS_ENV \\\n --role sla-monitor-runner-role-$AWS_ENV \\\n --image sla-monitor/sla-runner:latest\n```\n\nIn ECS, add these as environment variables in the task definition or load from ssm via ssm-starter:\n\n```\n--full-entrypoint \"ssm-starter --ssm-name slarunner --command 'sla-runner'\"\n```\n\n## Variables\n\nThe runner takes the following values which are provided by environment variable. \n\n#### command\n\n$SLARUNNER_COMMAND\n\nCommand to be run repeatedly. Pretty straightforward. If there is an interrupt, the runner will attempt to finish the command gracefully before exit.\n\n#### service\n\n$SLARUNNER_SERVICE\n\nName of the component service you're testing. This will be used as the prefix for s3 uploads, and will be passed in the JSON event as \"service\" to SNS.\n\n#### groups\n\n$SLARUNNER_GROUPS\n\nName of the grouping of components you're testing, in csv format. This will be passed in the JSON event as \"groups\" to SNS as a list, and is meant to provide secondary statistics if multiple services are part of the same component.\n\n#### delay\n\n$SLARUNNER_DELAY\n\nHow long to wait between commands being run in seconds.\n\n#### disabled\n\n$SLARUNNER_DISABLED\n\nTo disable sla-runner at startup.\n\n#### sns-topic-arn\n\n$SLARUNNER_SNSTOPICARN\n\nSNS topic arn to publish results to. It will be published as a JSON object. For example, the command above would produce the following:\n\n```json\n{\n \"service\": \"example-service\",\n \"group\": [\"dev-team\", \"critical\"],\n \"succeeded\": true,\n \"timestamp\": \"1574515200\",\n \"testExecutionSecs\": \"914\"\n}\n```\n\n#### s3-bucket-name\n\n$SLARUNNER_S3BUCKETNAME\n\nBucket to write logs to. This is an optional parameter. The object will be named as the timestamp followed by the result for easily searching by result, and will be prefixed by the service name. For example \"example-service/1574514000_SUCCESS\"\n\n#### dry-run\n\n$SLARUNNER_DRYRUN\n\nIf there is any value at all in this variable, the test will run once, output the sns topic it would publish to, the result message, the log output of the command, and the name of the object that would be written to the bucket. It will NOT publish to sns or write the object to s3. Only for testing purposes.\n\n## Development and Testing\n\n```bash\ndocker build -t sla-runner:latest -f Dockerfile .\n```\n\n```bash\niam-docker-run \\\n --image sla-runner:latest \\\n --role sla-monitor-runner-role \\\n --profile dev \\\n --region us-east-1 \\\n --host-source-path . \\\n --container-source-path /src \\\n --shell\n```\n\n## Publishing Updates to PyPi\n\nFor the maintainer - to publish an updated version of ssm-search, increment the version number in version.py and run the following:\n\ndocker build -t sla-runner . && \\\ndocker run --rm -it --entrypoint make sla-runner publish\n\nAt the prompts, enter the username and password to the pypi.org repo.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/billtrust/sla-monitor-runner", "keywords": "sla-testing,aws-sla-reporting,sla-monitor,sla,continuous runner", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "sla-runner", "package_url": "https://pypi.org/project/sla-runner/", "platform": "", "project_url": "https://pypi.org/project/sla-runner/", "project_urls": { "Homepage": "https://github.com/billtrust/sla-monitor-runner" }, "release_url": "https://pypi.org/project/sla-runner/0.0.8/", "requires_dist": null, "requires_python": "", "summary": "A continuous test runner for gathering SLA data", "version": "0.0.8" }, "last_serial": 5209632, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "3a30efea2d8d72eb32943d62402eb080", "sha256": "cc9fa5dbee3ccd4ec66eaaa7e8caf88d350c9089a88e0905e19adfb4f370bd78" }, "downloads": -1, "filename": "sla-runner-0.0.1.tar.gz", "has_sig": false, "md5_digest": "3a30efea2d8d72eb32943d62402eb080", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5451, "upload_time": "2019-03-01T16:38:55", "url": "https://files.pythonhosted.org/packages/af/64/3389f7d6135e06d63e6718a0bd5bfa3c36e05fe3b3c7bc07a69e737ab455/sla-runner-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "bc89ede59a94a94bf1c439ce5c29db55", "sha256": "f50b485ab7c8c22e5103f5fb03ea06af9948e7a6ce8125ae60ec727b954baaea" }, "downloads": -1, "filename": "sla-runner-0.0.2.tar.gz", "has_sig": false, "md5_digest": "bc89ede59a94a94bf1c439ce5c29db55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5844, "upload_time": "2019-03-06T18:33:21", "url": "https://files.pythonhosted.org/packages/7b/ec/0d599c33a1faf3bf22ab310183bcd971722056a18bed7e94691e24bf96b8/sla-runner-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "6a7a695ff9d8e399ad324d4c11cf3ba1", "sha256": "b9000195ab2d03221cc8f8c0f8efee901fcacfc0920427db5b2bb8cce33456bb" }, "downloads": -1, "filename": "sla-runner-0.0.3.tar.gz", "has_sig": false, "md5_digest": "6a7a695ff9d8e399ad324d4c11cf3ba1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5850, "upload_time": "2019-03-28T19:36:16", "url": "https://files.pythonhosted.org/packages/17/0b/87cd8b1273a121eb21e0df2f6788e01634ebed8308a5bd8bfca711f91ff8/sla-runner-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "6b5c08c5a79b763767cdf38f20c7ec3f", "sha256": "fd8f024ea2f708631c4a8ab8125ef0c9bc4f7c8a04db12ef7844e8632318b4d5" }, "downloads": -1, "filename": "sla-runner-0.0.4.tar.gz", "has_sig": false, "md5_digest": "6b5c08c5a79b763767cdf38f20c7ec3f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5529, "upload_time": "2019-04-12T14:13:53", "url": "https://files.pythonhosted.org/packages/db/61/313dda552ee70694961188a6b595d516798d9a862fc41aacb0e8ac051efa/sla-runner-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "28efb22c1b70ce88b99da228b1ed265b", "sha256": "4bda5892f64811ffcf56725c38ff674ef4a2cf45d7e78d5d7dc1e784dbe50bcd" }, "downloads": -1, "filename": "sla-runner-0.0.5.tar.gz", "has_sig": false, "md5_digest": "28efb22c1b70ce88b99da228b1ed265b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5856, "upload_time": "2019-04-15T15:43:54", "url": "https://files.pythonhosted.org/packages/d5/93/64292a32cfe84f3d26c88a4abf3fc02a01441c723e65169759dac6bafdec/sla-runner-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "3e68c076db376c9d9627805e6ec13f53", "sha256": "4ef76c3e58ef6ca1a227190a23803d1c163a8ee86a3f4623df0fbfa0aa0d31b3" }, "downloads": -1, "filename": "sla-runner-0.0.6.tar.gz", "has_sig": false, "md5_digest": "3e68c076db376c9d9627805e6ec13f53", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5858, "upload_time": "2019-04-15T23:59:20", "url": "https://files.pythonhosted.org/packages/8b/77/a749cf2bf33ca7b841554750b266da25324bb9b65953d44bffcd94380dde/sla-runner-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "7090cbcda3003df0530999ecc03bda3a", "sha256": "5639303df68e273c8a6d12127bdc9592e21990fb76e3d9420551a7ac0b613544" }, "downloads": -1, "filename": "sla-runner-0.0.7.tar.gz", "has_sig": false, "md5_digest": "7090cbcda3003df0530999ecc03bda3a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6055, "upload_time": "2019-04-30T16:40:49", "url": "https://files.pythonhosted.org/packages/88/8b/e949f0be25cf5ce8fda416144084dfb4effb1286748f21a1b00528c052f6/sla-runner-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "74071076a7d4215566417231cb62627c", "sha256": "18013df1c83fb397ec39ea343cc59ebb624e5e3fef5a1c85485d824afd2bc17d" }, "downloads": -1, "filename": "sla-runner-0.0.8.tar.gz", "has_sig": false, "md5_digest": "74071076a7d4215566417231cb62627c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6069, "upload_time": "2019-04-30T18:53:45", "url": "https://files.pythonhosted.org/packages/ae/19/8441f66e3e0f3382068f580cadd7e934a59e33e534a47af7b2b696ffba38/sla-runner-0.0.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "74071076a7d4215566417231cb62627c", "sha256": "18013df1c83fb397ec39ea343cc59ebb624e5e3fef5a1c85485d824afd2bc17d" }, "downloads": -1, "filename": "sla-runner-0.0.8.tar.gz", "has_sig": false, "md5_digest": "74071076a7d4215566417231cb62627c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6069, "upload_time": "2019-04-30T18:53:45", "url": "https://files.pythonhosted.org/packages/ae/19/8441f66e3e0f3382068f580cadd7e934a59e33e534a47af7b2b696ffba38/sla-runner-0.0.8.tar.gz" } ] }