Skip to content

Commit 85d992b

Browse files
committed
Update README
1 parent 9d40da6 commit 85d992b

File tree

1 file changed

+61
-58
lines changed

1 file changed

+61
-58
lines changed

README.md

Lines changed: 61 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,89 @@
11
Table of Contents
22
=================
33

4-
* [Overview](#overview)
5-
* [How To Set It All Up](#how-to-set-it-all-up)
6-
* [Enable Code Manager](#enable-code-manager)
7-
* [Disable Webhook Auth If Using Gitlab](#disable-webhook-auth-if-using-gitlab)
8-
* [Connecting Code Manager / r10k to Your Git Server](#connecting-code-manager--r10k-to-your-git-server)
9-
* [Steps for Configuring SSH Access to your control\-repo via this module](#steps-for-configuring-ssh-access-to-your-control-repo-via-this-module)
10-
* [Exact Timing and Order of Events](#exact-timing-and-order-of-events)
11-
* [Relation to the puppetlabs/control\-repo](#relation-to-the-puppetlabscontrol-repo)
12-
13-
Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc.go)
4+
* [Overview](#overview)
5+
* [What Does This Module Provide You?](#what-does-this-module-provide-you)
6+
* [Easy Button Setup](#easy-button-setup)
7+
* [Other Notes:](#other-notes)
8+
* [Disable Webhook Auth If Using Gitlab Version < 8\.5](#disable-webhook-auth-if-using-gitlab-version--85)
9+
* [Relation to the puppetlabs\-rampupprogram/control\-repo](#relation-to-the-puppetlabs-rampupprogramcontrol-repo)
10+
* [The Zack/r10k functionality of the Module is Undocumented](#the-zackr10k-functionality-of-the-module-is-undocumented)
1411

1512
# Overview
1613

17-
This module allow for easy setup and configuration of PE code manager in PE2015.3 and above. If you are using PE 2015.2 then the module will default to installing the zack/r10k webhook.
14+
This module allows for easy setup and configuration of PE code manager in PE2015.3 and above. If you are using PE 2015.2 then the module will default to installing the zack/r10k webhook.
1815

1916
Upon upgrading to 2015.3 the module will uninstall zack/r10k and attempt to use code manager but this requires that you've set the correct parameters in the puppet_enterprise module for it to work.
2017

21-
This module was originally a very prescriptive profile in the puppetlabs/control-repo but is now here as its own module to make it more widely available. As a result, you may find that some items are not configurable but we're working on that.
18+
This module was originally a very prescriptive profile in the [puppetlabs-rampupprogram/control-repo](https://github.com/PuppetLabs-RampUpProgram/control-repo) but is now here as its own module to make it more widely available.
2219

23-
# How To Set It All Up
20+
# What Does This Module Provide You?
2421

25-
## Enable Code Manager
22+
1. A new RBAC role for deploying code ( Deploy Environments )
23+
2. A new RBAC user for deploying code ( code_manager_service_user )
24+
3. An infinite liftetime token from the RBAC user for use in a webhook
25+
4. A newly generated SSH key with the correct permissions to be used by code manager
26+
- And for you to setup in your Git server of choice as a deploy key
27+
5. Correctly chowns the $codedir so that code manager can deploy to it
28+
6. A file containing the webhook url to paste into your Git UI
29+
- Located at `/etc/puppetlabs/puppetserver/.puppetlabs/webhook_url.txt` by default
2630

27-
In order to use code manager ( and thus this module ) you must set the following parameter to true via hiera or the PE console UI.
31+
# Easy Button Setup
2832

29-
```
30-
puppet_enterprise::profile::master::code_manager_auto_configure: true
31-
```
33+
1. Enable code manager via the PE Console UI or hiera:
3234

33-
## Disable Webhook Auth If Using Gitlab
35+
```
36+
puppet_enterprise::profile::master::code_manager_auto_configure: true
37+
```
3438

35-
If you are using Gitlab as your git UI then you will also need to set the following hiera key to disable authentication to the code manager webhook. This is because gitlab currently does not allow for webhook urls that are longer than 255 characters while the RBAC token you need to place in the URL is, on its own, longer than 255 characters.
39+
2. Run `puppet agent -t`
3640

37-
If you are using an older version of gitlab ( before version 8 ) then you will not have the ability to disable ssl verification either and would need to disable the webhook authentication on code manager.
38-
```
39-
puppet_enterprise::master::code_manager::authenticate_webhook: false
40-
```
41+
3. Install and run this module:
4142

42-
http://docs.puppetlabs.com/pe/2015.3/release_notes_known_issues_codemgmt.html#turn-off-webhook-authentication-for-gitlab
43+
```
44+
su - pe-puppet -c "puppet module install npwalker-pe_code_manager_webhook"
45+
chown -R pe-puppet:pe-puppet /etc/puppetlabs/code/environments/production/modules/
46+
puppet apply -e "include pe_code_manager_webhook"
47+
```
4348

44-
# Connecting Code Manager / r10k to Your Git Server
49+
4. Configure a deploy key in your Git server using the SSH key created by the module
50+
- You'll paste `cat /etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa.pub`
51+
5. Login to the PE console
52+
6. Navigate to the Classification page
53+
- Click on the PE Master group
54+
- Click the Classes tab
55+
- Find the `puppet_enterprise::profile::master` class
56+
- Set the `r10k_remote` to the SSH url of your git repo
57+
- Set the `r10k_private_key` parameter to `/etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa.key`
58+
- Commit your changes
59+
6. Run `puppet agent -t`
60+
7. Create a webhook on the control-repo repository in your Git server UI
61+
- The URL to connect to code manager is found at `/etc/puppetlabs/puppetserver/.puppetlabs/webhook_url.txt`
62+
8. Assuming this was a new install with no previous code in the code directory then everything worked.
63+
If not, try clearing all of the code and redeploying it with code manager
64+
- `echo 'code_manager_mv_old_code=true' > /opt/puppetlabs/facter/facts.d/code_manager_mv_old_code.txt; puppet agent -t`
4565

46-
Code Manager or r10k ( which Code Manager is based on ) require ssh authentication to your git repo. The basic steps are:
4766

48-
1. Create a ssh key
49-
2. Make said ssh key a deploy key on your control-repo
50-
3. Configure r10k / Code Manager to use this ssh key
5167

52-
## Steps for Configuring SSH Access to your control-repo via this module
68+
# Other Notes:
5369

54-
1. `/usr/bin/ssh-keygen -t rsa -b 2048 -C 'code_manager' -f /etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa -q -N ''`
55-
- http://doc.gitlab.com/ce/ssh/README.html
56-
- https://help.github.com/articles/generating-ssh-keys/
57-
2. Create a deploy key on the control-repo project in your git server
58-
- Paste in the public key from above
59-
- `cat /etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa.pub`
60-
3. Login to the PE console
61-
4. Navigate to the Classification page
62-
- Click on the PE Master group
63-
- Click the Classes tab
64-
- Add the puppet_enterprise::profile::master
65-
- Set the r10k_remote to the ssh url of your git repo
66-
- Set the r10k_private_key parameter to /etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa.key
67-
- Commit your changes
70+
## Disable Webhook Auth If Using Gitlab Version < 8.5
6871

69-
## Exact Timing and Order of Events
72+
If you are using [Gitlab < 8.5](https://gitlab.com/gitlab-org/gitlab-ce/commit/e80113593c120b71af428ea1b00f11fcdeae58b8) as your git UI then you will also need to set the following hiera key to disable authentication to the code manager webhook. This is because gitlab currently does not allow for webhook urls that are longer than 255 characters while the RBAC token you need to place in the URL is, on its own, longer than 255 characters.
73+
74+
If you are using an older version of gitlab ( before version 8 ) then you will not have the ability to disable ssl verification either and would need to disable the webhook authentication on code manager.
75+
```
76+
puppet_enterprise::master::code_manager::authenticate_webhook: false
77+
```
78+
79+
http://docs.puppetlabs.com/pe/2015.3/release_notes_known_issues_codemgmt.html#turn-off-webhook-authentication-for-gitlab
7080

71-
In order to enable code manager using this module you need to complete a very specific set of steps in the right order.
81+
## Relation to the puppetlabs-rampupprogram/control-repo
7282

73-
1. Make sure the code from this module is on your master
74-
- You could either use a `puppet module install` or maybe an `r10k deploy environmnt -pv`
75-
2. Enable code manager
76-
- Set the parameter and run `puppet agent -t`
77-
3. In order to allow file sync ( a companion to code manager) to deploy code it needs a clean $codedir ( meaning nothing in it )
78-
- This problem is solved in the puppet code via an exec statement that only runs if you set the following custom fact
79-
- `echo 'code_manager_mv_old_code=true' > /opt/puppetlabs/facter/facts.d/code_manager_mv_old_code.txt`
80-
4. Finally run `puppet agent -t` 2-3 times to make sure all of the configuration completes
83+
This module was created as a part of the [puppetlabs-rampupprogram/control-repo](https://github.com/PuppetLabs-RampUpProgram/control-repo) and for the time being the documentation in that control-repo may also serve as a useful supplement to this module.
8184

82-
# Relation to the puppetlabs/control-repo
85+
In fact if you are a new user of PE then you may consider using the puppetabs/control repo instead of trying to implement this module on its own.
8386

84-
This module was created as a part of the puppetlabs/control-repo and for the time being the documentation in that control-repo may also serve as a useful supplement to this module.
87+
## The Zack/r10k functionality of the Module is Undocumented
8588

86-
In fact if you are a new user of PE then you may consider using the puppetabs/control repo instead of trying to implement this module on its own.
89+
The purpose of this module is mostly for configuring code manager but the zack/r10k functionality is left in place undocumented.

0 commit comments

Comments
 (0)