{"id":18524530,"url":"https://github.com/stelligent/deploy-button","last_synced_at":"2025-04-09T12:30:54.455Z","repository":{"id":145835098,"uuid":"137727975","full_name":"stelligent/deploy-button","owner":"stelligent","description":"functions and templates to have a deploy button for your code pipeline","archived":false,"fork":false,"pushed_at":"2020-01-07T20:10:53.000Z","size":141,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-24T05:26:38.493Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stelligent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"publiccode":null,"codemeta":null}},"created_at":"2018-06-18T08:35:24.000Z","updated_at":"2020-06-22T06:16:29.000Z","dependencies_parsed_at":"2023-07-16T22:16:53.632Z","dependency_job_id":null,"html_url":"https://github.com/stelligent/deploy-button","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stelligent%2Fdeploy-button","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stelligent%2Fdeploy-button/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stelligent%2Fdeploy-button/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stelligent%2Fdeploy-button/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stelligent","download_url":"https://codeload.github.com/stelligent/deploy-button/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248040088,"owners_count":21037813,"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-06T17:42:16.727Z","updated_at":"2025-04-09T12:30:54.449Z","avatar_url":"https://github.com/stelligent.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"deploy-button :ship: :red_circle:\n======\n\nCodePipeline supports Manual Approval actions that allow you to put manual gates in your pipeline. IoT Buttons allow you to have a real world button hooked up to a Lambda function. This project configures your IoT button to approve your CodePipeline manual approval steps.\n\nWhat's in the box\n------\n\nThe `deploy-button` project utilizes several AWS services to get things working. \n\n* CodePipeline:\n  *  Sample Pipeline\n* Lambda Functions:\n  * Process button press\n* IoT:\n  * Thing\n  * Policy\n  * Rule\n  * Certificate\n\nWorkflow:\n------\nAfter you've run the CloudFormation templates to create everything, the pipeline will execute and the follow steps will occur:\n* Code Pipeline hits \"Manual Gate\" stage and waits.\n* Once the pipeline stops at the approval action, your IoT button can accept the changes by pressing the button.\n* Button press triggers a lambda function\n* Lambda function receives the press information and looks up the pipeline information.\n* It then calls the CodePipeline API and sends the approval.\n\nCommands:\n-----\nFirst you have to configure the IoT button to connect to your AWS account. This is done by create keys and certificates that you'll need to upload to the button. First we'll create the keys and certs:\n\n    # first thing: generate IOT cert\n    aws iot create-keys-and-certificate --set-as-active --output json \u003e keys-and-cert.json\n    export cert_arn=$(cat keys-and-cert.json | jq '.certificateArn' | tr -d '\"')\n    cat keys-and-cert.json | jq '.certificatePem' | tr -d '\"' | awk '{gsub(/\\\\n/,\"\\n\")}1' \u003e certificate.pem\n    cat keys-and-cert.json | jq '.keyPair.PrivateKey' | tr -d '\"' | awk '{gsub(/\\\\n/,\"\\n\")}1' \u003e private.key\n    rm keys-and-cert.json\n\nYou'll also want to run these two commands and note the output:\n\n    aws iot describe-endpoint | jq .endpointAddress | tr -d '\"' | awk -F. '{ print $1}'\n    aws iot describe-endpoint | jq .endpointAddress | tr -d '\"' | awk -F. '{ print $3}'\n\nNext is the annoying bit: the IoT button is configured by connecting to it's wireless network and pulling up a webpage. You'll need to put the IoT button into configuration mode, connect to it from your computer, and then enter in the appropriate information.\n1. Hold down the IoT button for 10 seconds, until the light begins flashing blue.\n2. A wireless network will appear, named something like `Button-ConfigureMe`, connect to it.\n3. Navigate to http://192.168.0.1/index.html\n4. Enter your wifi information -- *note*: if you're on a network that configures wifi via a redirect, you won't be able to use your IoT button.\n5. Under `AWS IoT Configuration`\n  * For `Certificate` upload the file you created above `certificate.pem`\n  * For `Private Key` uploaded the file you created above `private.key`\n  * For `Endpoint Subdomain` enter the output from the first command above.\n  * For `Region`, enter the output from the second command above.\n 6. Check the agreement to terms and conditions box\n 7. Click `Configure`\n 8. Reconnect to your nomal wireless network.\n\nThe IoT button will blink red -- that's because we're doing things slightly out of order than it prefers, so don't worry about it. With IoT button is configured, we can set up the resources to support it. You'll need to set the values of the first two variables.\n\n    # The DSN will be on the back of your IoT button\n    export iot_button_dsn=1234567890\n    # The Github token you'll need to generate from your github account page\n    export github_token=12345678908754321\n    # this can be whatever you like, leaving it as is should work too.\n    export lambda_bucket=test-lambda-functions-$(date +%Y%m%d%H%M%S)\n    aws s3 mb s3://$lambda_bucket\n\n    export lambdas_stack_name=deploybutton-lambdas-$(date +%Y%m%d%H%M%S)\n    aws cloudformation package \\\n      --template-file provisioning/everything.yml \\\n      --s3-bucket $lambda_bucket \\\n      --output-template-file /tmp/packaged.yml\n    aws cloudformation deploy \\\n      --template-file /tmp/packaged.yml \\\n      --stack-name $lambdas_stack_name \\\n      --capabilities CAPABILITY_IAM \\\n      --parameter-overrides \\\n        ParameterKey=\"IoTButtonDSN\",ParameterValue=\"$iot_button_dsn\" \\\n        ParameterKey=\"CertificateARN\",ParameterValue=\"$cert_arn\" \\\n        ParameterKey=\"GitHubToken\",ParameterValue=\"${github_token}\"\n\nBonus:\n-----\nThis project leverages IoT, which you may need to troubleshoot. Unfortunately, IoT doesn't come with CloudWatch Logs enabled. You can use this template and command to enable IoT pushing logs to CloudWatch logs on your account.\n\n    iot_logging_role_stack=\"iot-log-role-$(date +%Y%m%d%H%M%S)\"\n    aws cloudformation create-stack \\\n      --stack-name $iot_logging_role_stack \\\n      --template-body file://provisioning/iot-log-role.yml \\\n      --capabilities CAPABILITY_IAM\n    # wait for stack to complete\n    sleep 30\n    aws iot set-v2-logging-options \\\n        --role-arn $(aws cloudformation describe-stacks --stack-name $iot_logging_role_stack --query Stacks[*].Outputs[?OutputKey==\\'IoTLogRole\\'].OutputValue --output text) \\\n        --default-log-level INFO\n\nAfter you run that, IOT should log to the CloudWatch Log Group `AWSIotLogsV2`.\n\nFeedback / Questions / Issues:\n-----\nIf you hit any issues getting any of this to run, or if you really have any feedback at all, please open up a Github issue. Also, please feel free to write your own improvements and open up a pull request!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstelligent%2Fdeploy-button","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstelligent%2Fdeploy-button","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstelligent%2Fdeploy-button/lists"}