{"action":"created","comment":{"url":"https://api.github.com/repos/base2solutions/DevOps/pulls/comments/73617126","id":73617126,"diff_hunk":"@@ -0,0 +1,141 @@\n+# (AWS) Jenkins Deployment\n+\n+<br />\n+### Deploy Jenkins via Packer:  \n+ * Install [Packer](https://www.packer.io/downloads.html)  \n+ * Clone DevOps repository:  \n+ >     git clone git@github.com:base2solutions/DevOps.git\n+ * Change directory to the location of the packer template:  \n+ * Start Packer Build process:  \n+ >     packer build baseJenkinsECS.json  \n+ * Once the build process has been completed, sign into [AWS Console](http://internal-base2.signin.aws.amazon.com/) > Click on Services and click EC2  \n+ * On EC2:  \n+   * Under Images, click AMIs  \n+   * Select the previously created Jenkins AMI and click Launch > launch the AMI to create the Jenkins instance.  \n+\n+<br/>\n+### Configure Jenkins:  \n+#### Route 53  \n+ * On AWS, click on Services > click Route 53 > click on Hosted zones  \n+ * In Hosted zones:  \n+   * Click Create Hosted Zone and enter the following:  \n+     * Domain name: barbuild.base2d.com  \n+     * Comment: internal VPC for dual  \n+     * Type: Public Hosted Zone  \n+     * Click Create  \n+ * In Hosted zones, select the previously created zone > click Create Record Set  \n+     * In Create Record Set pane, enter:  \n+     * Name: barbuild.base2d.com  \n+     * Value: enter the private ip of the newly created Jenkins instance  \n+     * Click Create  \n+\n+#### Nginx\n+ * SSH into the newly created Jenkins instance  \n+ * Navigate to /etc/nginx/nginx.conf > Uncomment out the following line:\n+ >     include /etc/nginx/conf.d/*.conf\n+ \n+#### Add letsencrypt certs  \n+ * Stop Nginx:  \n+ >     sudo service nginx stop  \n+ * Generate letsencrypt certificate:  \n+ >     sudo wget https://dl.eff.org/certbot-auto  \n+ >     sudo chmod a+x certbot-auto  \n+ >     sudo ./certbot-auto certonly --standalone -d barbuild.base2d.com  \n+\n+#### Set Jenkins SSL certs in Jenkins config file:  \n+ * modify /etc/nginx/conf.d/jenkins.conf file as follow:  \n+   * Add:  \n+   >     ssl_certificate           /etc/letsencrypt/live/barbuild.base2d.com/fullchain.pem;  \n+   >     ssl_certificate_key       /etc/letsencrypt/live/barbuild.base2d.com/privkey.pem;  \n+   >     ssl on;  \n+   * Comment out:  \n+   >     #  ssl_certificate           /etc/nginx/cert.crt;  \n+   >     #  ssl_certificate_key       /etc/nginx/cert.key;  \n+   >     #  ssl_dhparam               /etc/nginx/ssl/dh2048.pem;  \n+ * Start Nginx:  \n+ >     sudo service nginx start  \n+\n+#### Jenkins First Step   \n+ * Using a web browser, navigate to [https://barbuild.base2d.com.](https://barbuild.base2d.com])  \n+ * Log in using the password created in `/var/lib/jenkins/secrets/initialAdminPassword`  \n+ * Select to install most recommended plugins  \n+ * Lastly, create a local admin account  \n+\n+#### Manage Jenkins Plugins  \n+ * Login to Jenkins > click Manage Jenkins > click on Manage Plugins  \n+ * Click on Available tab > then select:  \n+ >     Amazon EC2 Container Service plugin  \n+ >     Amazon EC2 Container Service plugin with autoscaling capabilities  \n+ >     Amazon EC2 plugin  \n+ >     Amazon ECR plugin  \n+ >     GitHub Authentication plugin  \n+ >     GitHub Pull Request Builder  \n+ * Click `Download now and install after restart` > the installation will start   \n+ * Afterward, tick `Restart Jenkins when installation is complete and no jobs are running`.  \n+\n+#### Configure Jenkins Global Security  \n+ * Click Manage Jenkins > click Configure Global Security  \n+ * Tick \"Enable security\" > Select Random for TCP port for JNLP slave agents  \n+ * Click on Agent protocols > Select all listed protocols  \n+ * In Access Control > Under Security Realm > select GitHub Authentication Plugin > enter the following:  \n+ >     GitHub Web URI:  https://github.com  \n+ >     GitHub API URI: https://api.github.com  \n+ >     Client ID: enter GitHub client ID here  \n+ >     Client Secret: enter GitHub secret here  \n+ >     OAuth Scope(s): read:org,user:email  \n+ * Under Authorization > select GitHub Committer Authorization Strategy  \n+ * Under GitHub Authorization Settings > enter the following:  \n+ >     Admin User names: enter names of administrators  \n+ >     Participant in Organization: base2solutions  \n+ >     Use GitHub repository permissions: yes  \n+ * Click Save  \n+ **NOTE**: Client ID and secret needs to be generate beforehand on GitHub - OAuth applications  \n+ \n+#### Jenkins Configure System  \n+ * Click Manage Jenkins > click on Configure System  \n+ * Under GitHub Pull Request Builder > enter the following:  \n+ * GitHub Service API URL: https://api.github.com  \n+ * Shared Secret: enter secret here  \n+ * Credentials: select github service account here  \n+ * Under Cloud > click on Add a new cloud > select Amazon EC2 Container Service Cloud > enter the following:  \n+ >     Name: name_of_ecs_cloud\n+ >     Amazon ECS Credentials: select service account with access permission to ECS cluster  \n+ >     Amazon ECS Region Name: select us-west-2  \n+ >     Click Advanced > In Alternative Jenkins URL > enter https://barbuild.base2d.com  \n+ * Locate ECS slave templates > click Add > Enter the following:  \n+ >     Label: buildslave  \n+ >     Docker Image: enter docker image address retrieved from ECS\n+ >     Filesystem root: /home/jenkins  \n+ >     Memory: 1024  \n+ >     CPU units: 1  \n+ * Click save  \n+ **NOTE**: Amazon ECS credentials must be created beforehand on AWS Console - IAM section\n+\n+<br />\n+### Configure GitHub and Amazon AWS credentials:\n+#### GitHub - Repository webhook  \n+ * Log into GitHub at https://github.com > navigate to base2solutions/777x.dual repo > click Settings  ","path":"AWS/jenkins-deployment.md","position":117,"original_position":117,"commit_id":"052ebdbead938329e127517fe4d48fc80c9729da","original_commit_id":"052ebdbead938329e127517fe4d48fc80c9729da","user":{"login":"mbrewster","id":4481019,"avatar_url":"https://avatars.githubusercontent.com/u/4481019?v=3","gravatar_id":"","url":"https://api.github.com/users/mbrewster","html_url":"https://github.com/mbrewster","followers_url":"https://api.github.com/users/mbrewster/followers","following_url":"https://api.github.com/users/mbrewster/following{/other_user}","gists_url":"https://api.github.com/users/mbrewster/gists{/gist_id}","starred_url":"https://api.github.com/users/mbrewster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbrewster/subscriptions","organizations_url":"https://api.github.com/users/mbrewster/orgs","repos_url":"https://api.github.com/users/mbrewster/repos","events_url":"https://api.github.com/users/mbrewster/events{/privacy}","received_events_url":"https://api.github.com/users/mbrewster/received_events","type":"User","site_admin":false},"body":"Generic","created_at":"2016-08-04T22:55:46Z","updated_at":"2016-08-04T22:55:46Z","html_url":"https://github.com/base2solutions/DevOps/pull/1#discussion_r73617126","pull_request_url":"https://api.github.com/repos/base2solutions/DevOps/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/base2solutions/DevOps/pulls/comments/73617126"},"html":{"href":"https://github.com/base2solutions/DevOps/pull/1#discussion_r73617126"},"pull_request":{"href":"https://api.github.com/repos/base2solutions/DevOps/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/base2solutions/DevOps/pulls/1","id":80161777,"html_url":"https://github.com/base2solutions/DevOps/pull/1","diff_url":"https://github.com/base2solutions/DevOps/pull/1.diff","patch_url":"https://github.com/base2solutions/DevOps/pull/1.patch","issue_url":"https://api.github.com/repos/base2solutions/DevOps/issues/1","number":1,"state":"open","locked":false,"title":"Packer/aws jenkins","user":{"login":"QuangHuyNguyen","id":4612601,"avatar_url":"https://avatars.githubusercontent.com/u/4612601?v=3","gravatar_id":"","url":"https://api.github.com/users/QuangHuyNguyen","html_url":"https://github.com/QuangHuyNguyen","followers_url":"https://api.github.com/users/QuangHuyNguyen/followers","following_url":"https://api.github.com/users/QuangHuyNguyen/following{/other_user}","gists_url":"https://api.github.com/users/QuangHuyNguyen/gists{/gist_id}","starred_url":"https://api.github.com/users/QuangHuyNguyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/QuangHuyNguyen/subscriptions","organizations_url":"https://api.github.com/users/QuangHuyNguyen/orgs","repos_url":"https://api.github.com/users/QuangHuyNguyen/repos","events_url":"https://api.github.com/users/QuangHuyNguyen/events{/privacy}","received_events_url":"https://api.github.com/users/QuangHuyNguyen/received_events","type":"User","site_admin":false},"body":"Template to deploy Jenkins as AMI to AWS EC2","created_at":"2016-08-04T22:39:54Z","updated_at":"2016-08-04T22:55:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"78964518253d22004835a1f8aa0275a3fe3891f6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/base2solutions/DevOps/pulls/1/commits","review_comments_url":"https://api.github.com/repos/base2solutions/DevOps/pulls/1/comments","review_comment_url":"https://api.github.com/repos/base2solutions/DevOps/pulls/comments{/number}","comments_url":"https://api.github.com/repos/base2solutions/DevOps/issues/1/comments","statuses_url":"https://api.github.com/repos/base2solutions/DevOps/statuses/052ebdbead938329e127517fe4d48fc80c9729da","head":{"label":"base2solutions:packer/aws_jenkins","ref":"packer/aws_jenkins","sha":"052ebdbead938329e127517fe4d48fc80c9729da","user":{"login":"base2solutions","id":4500662,"avatar_url":"https://avatars.githubusercontent.com/u/4500662?v=3","gravatar_id":"","url":"https://api.github.com/users/base2solutions","html_url":"https://github.com/base2solutions","followers_url":"https://api.github.com/users/base2solutions/followers","following_url":"https://api.github.com/users/base2solutions/following{/other_user}","gists_url":"https://api.github.com/users/base2solutions/gists{/gist_id}","starred_url":"https://api.github.com/users/base2solutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/base2solutions/subscriptions","organizations_url":"https://api.github.com/users/base2solutions/orgs","repos_url":"https://api.github.com/users/base2solutions/repos","events_url":"https://api.github.com/users/base2solutions/events{/privacy}","received_events_url":"https://api.github.com/users/base2solutions/received_events","type":"Organization","site_admin":false},"repo":{"id":64152752,"name":"DevOps","full_name":"base2solutions/DevOps","owner":{"login":"base2solutions","id":4500662,"avatar_url":"https://avatars.githubusercontent.com/u/4500662?v=3","gravatar_id":"","url":"https://api.github.com/users/base2solutions","html_url":"https://github.com/base2solutions","followers_url":"https://api.github.com/users/base2solutions/followers","following_url":"https://api.github.com/users/base2solutions/following{/other_user}","gists_url":"https://api.github.com/users/base2solutions/gists{/gist_id}","starred_url":"https://api.github.com/users/base2solutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/base2solutions/subscriptions","organizations_url":"https://api.github.com/users/base2solutions/orgs","repos_url":"https://api.github.com/users/base2solutions/repos","events_url":"https://api.github.com/users/base2solutions/events{/privacy}","received_events_url":"https://api.github.com/users/base2solutions/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/base2solutions/DevOps","description":"The Base2 DevOps Handbook","fork":false,"url":"https://api.github.com/repos/base2solutions/DevOps","forks_url":"https://api.github.com/repos/base2solutions/DevOps/forks","keys_url":"https://api.github.com/repos/base2solutions/DevOps/keys{/key_id}","collaborators_url":"https://api.github.com/repos/base2solutions/DevOps/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/base2solutions/DevOps/teams","hooks_url":"https://api.github.com/repos/base2solutions/DevOps/hooks","issue_events_url":"https://api.github.com/repos/base2solutions/DevOps/issues/events{/number}","events_url":"https://api.github.com/repos/base2solutions/DevOps/events","assignees_url":"https://api.github.com/repos/base2solutions/DevOps/assignees{/user}","branches_url":"https://api.github.com/repos/base2solutions/DevOps/branches{/branch}","tags_url":"https://api.github.com/repos/base2solutions/DevOps/tags","blobs_url":"https://api.github.com/repos/base2solutions/DevOps/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/base2solutions/DevOps/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/base2solutions/DevOps/git/refs{/sha}","trees_url":"https://api.github.com/repos/base2solutions/DevOps/git/trees{/sha}","statuses_url":"https://api.github.com/repos/base2solutions/DevOps/statuses/{sha}","languages_url":"https://api.github.com/repos/base2solutions/DevOps/languages","stargazers_url":"https://api.github.com/repos/base2solutions/DevOps/stargazers","contributors_url":"https://api.github.com/repos/base2solutions/DevOps/contributors","subscribers_url":"https://api.github.com/repos/base2solutions/DevOps/subscribers","subscription_url":"https://api.github.com/repos/base2solutions/DevOps/subscription","commits_url":"https://api.github.com/repos/base2solutions/DevOps/commits{/sha}","git_commits_url":"https://api.github.com/repos/base2solutions/DevOps/git/commits{/sha}","comments_url":"https://api.github.com/repos/base2solutions/DevOps/comments{/number}","issue_comment_url":"https://api.github.com/repos/base2solutions/DevOps/issues/comments{/number}","contents_url":"https://api.github.com/repos/base2solutions/DevOps/contents/{+path}","compare_url":"https://api.github.com/repos/base2solutions/DevOps/compare/{base}...{head}","merges_url":"https://api.github.com/repos/base2solutions/DevOps/merges","archive_url":"https://api.github.com/repos/base2solutions/DevOps/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/base2solutions/DevOps/downloads","issues_url":"https://api.github.com/repos/base2solutions/DevOps/issues{/number}","pulls_url":"https://api.github.com/repos/base2solutions/DevOps/pulls{/number}","milestones_url":"https://api.github.com/repos/base2solutions/DevOps/milestones{/number}","notifications_url":"https://api.github.com/repos/base2solutions/DevOps/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/base2solutions/DevOps/labels{/name}","releases_url":"https://api.github.com/repos/base2solutions/DevOps/releases{/id}","deployments_url":"https://api.github.com/repos/base2solutions/DevOps/deployments","created_at":"2016-07-25T17:03:53Z","updated_at":"2016-07-25T18:23:31Z","pushed_at":"2016-08-04T22:39:54Z","git_url":"git://github.com/base2solutions/DevOps.git","ssh_url":"git@github.com:base2solutions/DevOps.git","clone_url":"https://github.com/base2solutions/DevOps.git","svn_url":"https://github.com/base2solutions/DevOps","homepage":"","size":7,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"base2solutions:master","ref":"master","sha":"dfad6be3c07be60814886fcb2233c0be9c7310fc","user":{"login":"base2solutions","id":4500662,"avatar_url":"https://avatars.githubusercontent.com/u/4500662?v=3","gravatar_id":"","url":"https://api.github.com/users/base2solutions","html_url":"https://github.com/base2solutions","followers_url":"https://api.github.com/users/base2solutions/followers","following_url":"https://api.github.com/users/base2solutions/following{/other_user}","gists_url":"https://api.github.com/users/base2solutions/gists{/gist_id}","starred_url":"https://api.github.com/users/base2solutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/base2solutions/subscriptions","organizations_url":"https://api.github.com/users/base2solutions/orgs","repos_url":"https://api.github.com/users/base2solutions/repos","events_url":"https://api.github.com/users/base2solutions/events{/privacy}","received_events_url":"https://api.github.com/users/base2solutions/received_events","type":"Organization","site_admin":false},"repo":{"id":64152752,"name":"DevOps","full_name":"base2solutions/DevOps","owner":{"login":"base2solutions","id":4500662,"avatar_url":"https://avatars.githubusercontent.com/u/4500662?v=3","gravatar_id":"","url":"https://api.github.com/users/base2solutions","html_url":"https://github.com/base2solutions","followers_url":"https://api.github.com/users/base2solutions/followers","following_url":"https://api.github.com/users/base2solutions/following{/other_user}","gists_url":"https://api.github.com/users/base2solutions/gists{/gist_id}","starred_url":"https://api.github.com/users/base2solutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/base2solutions/subscriptions","organizations_url":"https://api.github.com/users/base2solutions/orgs","repos_url":"https://api.github.com/users/base2solutions/repos","events_url":"https://api.github.com/users/base2solutions/events{/privacy}","received_events_url":"https://api.github.com/users/base2solutions/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/base2solutions/DevOps","description":"The Base2 DevOps Handbook","fork":false,"url":"https://api.github.com/repos/base2solutions/DevOps","forks_url":"https://api.github.com/repos/base2solutions/DevOps/forks","keys_url":"https://api.github.com/repos/base2solutions/DevOps/keys{/key_id}","collaborators_url":"https://api.github.com/repos/base2solutions/DevOps/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/base2solutions/DevOps/teams","hooks_url":"https://api.github.com/repos/base2solutions/DevOps/hooks","issue_events_url":"https://api.github.com/repos/base2solutions/DevOps/issues/events{/number}","events_url":"https://api.github.com/repos/base2solutions/DevOps/events","assignees_url":"https://api.github.com/repos/base2solutions/DevOps/assignees{/user}","branches_url":"https://api.github.com/repos/base2solutions/DevOps/branches{/branch}","tags_url":"https://api.github.com/repos/base2solutions/DevOps/tags","blobs_url":"https://api.github.com/repos/base2solutions/DevOps/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/base2solutions/DevOps/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/base2solutions/DevOps/git/refs{/sha}","trees_url":"https://api.github.com/repos/base2solutions/DevOps/git/trees{/sha}","statuses_url":"https://api.github.com/repos/base2solutions/DevOps/statuses/{sha}","languages_url":"https://api.github.com/repos/base2solutions/DevOps/languages","stargazers_url":"https://api.github.com/repos/base2solutions/DevOps/stargazers","contributors_url":"https://api.github.com/repos/base2solutions/DevOps/contributors","subscribers_url":"https://api.github.com/repos/base2solutions/DevOps/subscribers","subscription_url":"https://api.github.com/repos/base2solutions/DevOps/subscription","commits_url":"https://api.github.com/repos/base2solutions/DevOps/commits{/sha}","git_commits_url":"https://api.github.com/repos/base2solutions/DevOps/git/commits{/sha}","comments_url":"https://api.github.com/repos/base2solutions/DevOps/comments{/number}","issue_comment_url":"https://api.github.com/repos/base2solutions/DevOps/issues/comments{/number}","contents_url":"https://api.github.com/repos/base2solutions/DevOps/contents/{+path}","compare_url":"https://api.github.com/repos/base2solutions/DevOps/compare/{base}...{head}","merges_url":"https://api.github.com/repos/base2solutions/DevOps/merges","archive_url":"https://api.github.com/repos/base2solutions/DevOps/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/base2solutions/DevOps/downloads","issues_url":"https://api.github.com/repos/base2solutions/DevOps/issues{/number}","pulls_url":"https://api.github.com/repos/base2solutions/DevOps/pulls{/number}","milestones_url":"https://api.github.com/repos/base2solutions/DevOps/milestones{/number}","notifications_url":"https://api.github.com/repos/base2solutions/DevOps/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/base2solutions/DevOps/labels{/name}","releases_url":"https://api.github.com/repos/base2solutions/DevOps/releases{/id}","deployments_url":"https://api.github.com/repos/base2solutions/DevOps/deployments","created_at":"2016-07-25T17:03:53Z","updated_at":"2016-07-25T18:23:31Z","pushed_at":"2016-08-04T22:39:54Z","git_url":"git://github.com/base2solutions/DevOps.git","ssh_url":"git@github.com:base2solutions/DevOps.git","clone_url":"https://github.com/base2solutions/DevOps.git","svn_url":"https://github.com/base2solutions/DevOps","homepage":"","size":7,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/base2solutions/DevOps/pulls/1"},"html":{"href":"https://github.com/base2solutions/DevOps/pull/1"},"issue":{"href":"https://api.github.com/repos/base2solutions/DevOps/issues/1"},"comments":{"href":"https://api.github.com/repos/base2solutions/DevOps/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/base2solutions/DevOps/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/base2solutions/DevOps/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/base2solutions/DevOps/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/base2solutions/DevOps/statuses/052ebdbead938329e127517fe4d48fc80c9729da"}}}}
{"actor":{"display_login":"mbrewster"}}