• Stars
    star
    125
  • Rank 286,335 (Top 6 %)
  • Language
    Puppet
  • License
    MIT License
  • Created about 9 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Puppet manifests used to provision remaining parts of the legacy GOV.UK stack (as at Nov 2023: just Licensify left)

GOV.UK Puppet

This repository contains the puppet modules and manifests for GOV.UK.

⚠️ Puppet configuration is only for EC2

Most GOV.UK applications and services have now been migrated to new infrastructure (EKS) and no longer use puppet for configuration. Configuration for EKS is defined in the govuk-infrastructure and govuk-helm-charts repositories.

Some services may not have been migrated yet and still run on EC2, in which case you may need to make change to the puppet configuration. We're in the process of retiring migrated services running on EC2, consquently there might duplicate configuration until this is finished. Make sure you know which infrastructure you need make changes to.

Getting started

In order to run/test the Puppet manifests you will need Ruby 1.9.x and Bundler.

Dependencies are managed with Bundler and librarian-puppet, but hopefully this should be transparent unless you need to update the dependencies yourself.

Standards

Please familiarise yourself with our Puppet standards before contributing to this repository:

Run rake spec and rake lint to run the tests and lint before checking in.

Dependencies

All modules from librarian-puppet are cached in this repo under vendor/puppet/ in order to ensure that third-party code doesn't change underneath us, protect us from downtime, and improve build times.

Installing

If you're using this repo for the first time or the contents of Gemfile[.lock] or Puppetfile[.lock] have recently changed then you'll need to run:

$ bundle install
$ bundle exec rake librarian:install

Please avoid using librarian-puppet directly because it's not very good at respecting or maintaining its own config file.

Running these commands will often be the solution to Puppet errors about unknown classes or functions such as:

  • Unknown function validate_bool at …
  • Could not find class apt for …
  • Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type apt::source …

It may affect errors relating to classes you have not modified when running spec tests after a rebase.

This should also fix errors while trying to run govuk_puppet, of the form:

  • chown: changing ownership of '/home/vagrant/.puppet/[…]': Operation not permitted

Updating

If you need to add a new module to the Puppetfile then you will need to run the following to install it and update the cache:

$ bundle exec rake librarian:package

If you need to update an existing module to a newer version, you'll need to run the following:

$ bundle exec rake 'librarian:update[alphagov/tune_ext]'

Afterwards you should commit the Puppetfile, Puppetfile.lock and any new files in vendor/puppet/. If updating a module then you will need to manually delete the old tarball from the cache directory.

NB: There should never be any changes to .librarian/puppet/config.

Testing

Assuming that your dependencies are installed, run all the tests:

$ bundle exec rake

The module tests are located in modules/<module>/spec. See the RSpec Puppet documentation for more details. The specs are run in parallel by default.

Puppet-lint is a tool that checks various syntax and style rules common to well written Puppet code. It can be run with:

$ bundle exec rake lint

This outputs a set of errors or warnings that should be fixed. See the Puppet Style Guide for more information.

Scoped testing

You can run the tests for a specific module or modules by setting an environment variable, mods for the rake task, e.g.

$ bundle exec rake mods=nginx,varnish

The manifests/ directory is considered one module called manifests for this purpose.

$ bundle exec rake mods=manifests,govuk

Precommit Testing

This repo uses pre-commit for managing its pre- commit hooks. This is available via brew:

brew install pre-commit

The pre-commit hooks are configured in the .pre-commit-config.yaml file in the root of this repo. To make the pre-commit hooks work you first need to install the pre-commit shim in your local .git/hooks directory:

pre-commit install

This will run hooks configured in .pre-commit-config.yaml when you run a git commit and will pass each hook the list of files staged as part of the commit. You can test the hooks by doing:

pre-commit run

You can also run the hooks on all files to test the status of the entire repo. This might be useful, for example, as part of a PR builder job:

pre-commit run --all-files

Node testing

Some issues that span multiple classes or modules may not be picked up unit testing. Duplicate resources and mislabelled dependencies are such examples. To catch these, all available govuk::node classes can be exercised with:

$ bundle exec rake spec:nodes

Compiling node complete node catalogs takes quite a long time, so you may wish to restrict it to certain classes of node by setting the environment variable classes for the rake task, e.g.

$ bundle exec rake spec:nodes classes=frontend,backend

Test Hieradata

During spec tests spec/fixtures/hiera/hiera.yaml is used to configure hieradata which only uses spec/fixtures/hieradata/common.yaml for its values (i.e. nothing from hieradata/).

During node tests the hieradata uses the vagrant environment.

Test Coverage

Each test suite's results are followed by a summary of how many resources that suite covers, how many the tests touch and the coverage as a percentage. e.g.

Total resources:   175
Touched resources: 36
Resource coverage: 20.57%

A list of untouched resources can be gained by setting the FULL_COVERAGE_REPORT environment variable before running the tests:

FULL_COVERAGE_REPORT=true bundle exec rake spec

Warning Given the number of modules that have limited tests this will produce a very large amount of output unless the tests are scoped.

Rspec Basic Mode

It is sometimes useful to have access to the normal RSpec Rake task. This exposes the SPEC and SPEC_OPTS environment variables that mean you can set the test specification and RSpec options respectively. This gives finer grain control when it is needed. e.g.

$ bundle exec rake rspec_basic_mode SPEC="./modules/collectd/spec/classes/collectd__package_spec.rb:7" SPEC_OPTS="-c"

runs the single test at line 7 of collectd__package_spec.rb with colour mode enabled.

Warning using this option disables parallel running of tests and the mod arguments will not work.

Vagrant testing

Prerequisites

You will need an up-to-date checkout of the private govuk-provisioning repository for node definitions.

Setup

It is recommended that you use Vagrant > 1.4 from a binary/system install. alphagov/gds-boxen can set this up for you.

Usage

You need only bring up the subset of nodes that you're working on. For example, to bring up a frontend and backend:

vagrant up frontend-1.frontend backend-1.backend

Vagrant will run the Puppet provisioner against the node when it boots up. Nodes should look almost identical to that of our real production/staging/preview environments, including network addresses. To access a node's services like HTTP/HTTPS you can point your hosts file to the host-only IP address (eth1).

Physical attributes like memory and num_cores will be ignored because they don't scale appropriately to local VMs, but can still be customised as described below.

Customisation

Node definitions can be overridden with a nodes.local.yaml file in this directory. This is merged on top of all other node definitions. The following keys are currently available for customisation:

  • box_dist Ubuntu distribution. Currently "trusty".
  • box_version Internal version number of the GDS basebox.
  • memory Amount of RAM. Default is "384".
  • ip IP address for hostonly networking. Currently all subnets are /16.
  • class Name of the Puppet class/role.

For example to increase the amount of RAM on a PuppetMaster:

---
puppetmaster-1.management:
  memory: 768

Errors

Some errors that you might encounter..

NFS failed mounts
[frontend-1.frontend] Mounting NFS shared folders...
Mounting NFS shared folders failed. This is most often caused by the NFS
client software not being installed on the guest machine. Please verify
that the NFS client software is properly installed, and consult any resources
specific to the linux distro you're using for more information on how to do this.

This seems to be caused by a combination of OSX, VirtualBox, and Cisco AnyConnect. Try temporarily disconnecting from the VPN when bringing up a new node. You can also set VAGRANT_GOVUK_NFS=no as an environment variable to disable the use of NFS. This is less performant but fine for checking puppet runs.

Licence

MIT License

More Repositories

1

govuk-frontend

GOV.UK Frontend contains the code you need to start building a user interface for government platforms and services.
JavaScript
1,108
star
2

whitehall

Publishes government content on GOV.UK
Ruby
833
star
3

accessible-autocomplete

An autocomplete component, built to be accessible.
JavaScript
792
star
4

govuk-design-system

One place for service teams to find styles, components and patterns for designing government services.
Nunjucks
499
star
5

govuk_frontend_toolkit

❗️GOV.UK Frontend Toolkit is deprecated, and will only receive major bug fixes and security patches.
JavaScript
404
star
6

govuk-aws

The GOV.UK repository for our Migration to AWS
HCL
404
star
7

e-petitions

This is the code base for the UK Government's e-petitions service (https://petition.parliament.uk)
Ruby
301
star
8

govuk-prototype-kit

Rapidly create HTML prototypes of GOV.UK services
JavaScript
293
star
9

govuk_elements

❗️GOV.UK Elements is deprecated, and will only receive major bug fixes and security patches.
HTML
227
star
10

router

HTTP router in front of GOV.UK to proxy to backend servers on a single domain.
Go
205
star
11

government-service-design-manual

Government Service Design Manual
CSS
194
star
12

styleguides

GOV.UK coding standards and guidelines for other tools we use
193
star
13

smart-answers

Serves smart answers on GOV.UK
HTML
168
star
14

unicornherder

Unicorn Herder: manage daemonized (g)unicorns
Python
152
star
15

magna-charta

Accessible, useful, beautiful barcharts from HTML tables.
JavaScript
152
star
16

govuk_template

❗️GOV.UK Template is deprecated, and will only receive major bug fixes and security patches. A template containing the GOV.UK header and footer, and associated assets.
Ruby
110
star
17

gds-way

How we build and operate products at GDS
HTML
100
star
18

govuk-developer-docs

📖 Tech docs for everyone working on GOV.UK
Ruby
92
star
19

govuk-infrastructure

Terraform turnup automation for the EKS Kubernetes clusters that host GOV.UK. See https://github.com/alphagov/govuk-helm-charts for application config.
HCL
91
star
20

wcag-primer

Get up to speed with the Web Content Accessibility Guidelines
HTML
90
star
21

signon

Single sign-on service for GOV.UK
Ruby
87
star
22

govspeak

Markdown extension library for Government editors
Ruby
82
star
23

paas-cf

GOV.UK PaaS - Cloud Foundry
Go
81
star
24

accessibility-tool-audit

Automated accessibility tools audit
HTML
74
star
25

tech-docs-template

A template for building technical documentation with a GOV.UK style
HTML
68
star
26

govuk-guix

Package, service and system definitions using GNU Guix for software and systems related to GOV.UK.
Scheme
63
star
27

govuk_frontend_alpha

This repository will be archived.
CSS
61
star
28

notifications-api

GOV.UK Notify API
Python
60
star
29

govuk_publishing_components

A gem to document and distribute frontend components for GOV.UK applications
JavaScript
59
star
30

Product-Managers-Learn-By-Doing

Things you should know how to do, to be a successful Product Manager
59
star
31

govuk-docker

GOV.UK development environment using Docker 🐳
Ruby
59
star
32

design-principles

Serves /design-principles on GOV.UK
HTML
57
star
33

fabric-scripts

DEPRECATED
Python
57
star
34

govuk-rfcs

GOV.UK staff use this repository as a forum to discuss and make technical decisions
55
star
35

cdn-acceptance-tests

CDN Acceptance Tests
Go
49
star
36

terraform-provider-concourse

A terraform provider for Concourse
Go
48
star
37

calendars

Serves /bank-holidays and /when-do-the-clocks-change on GOV.UK
Ruby
47
star
38

government-frontend

Serves government pages on GOV.UK
Ruby
46
star
39

publisher

Publishes mainstream content on GOV.UK
Ruby
42
star
40

smokey

Smoke tests for GOV.UK
Ruby
41
star
41

pay-publicapi

The Payments Public API in Java (Dropwizard)
Java
40
star
42

puppet-auditd

Puppet module for Auditd
Ruby
39
star
43

fourth-wall

Retired pull request and build status monitor
JavaScript
38
star
44

notifications-admin

GOV.UK Notify frontend application
Python
37
star
45

paas-alpha-tsuru-terraform

HCL
36
star
46

spotlight

Hybrid rendering application for the Performance Platform using Backbone and D3
JavaScript
36
star
47

need-o-tron

Ruby
35
star
48

paas-docker-cloudfoundry-tools

Ruby
34
star
49

govuk-country-and-territory-autocomplete

An autocomplete widget that uses data from Country and Territory Register.
JavaScript
33
star
50

puppet-aptly

Puppet module for aptly
Ruby
33
star
51

collections

Serves GOV.UK navigation pages, browse, topic, step-by-steps & services and information pages.
Ruby
33
star
52

govuk-coronavirus-vulnerable-people-form

Helps the public get support during the COVID-19 pandemic
Ruby
33
star
53

gsp

GSP is a container platform and curated suite of components helping government deploy, run, observe and secure their services
Go
31
star
54

slimmer

Templating Rack middleware, injects standard header/footer and GOV.UK Components
Ruby
30
star
55

content-publisher

Publishing application for GOV.UK
Ruby
29
star
56

publishing-api

API to publish content on GOV.UK
Ruby
29
star
57

frontend

Serves the homepage, transactions and some index pages on GOV.UK
Ruby
29
star
58

puppet-skeleton

Skeleton project for infrastructure teams
Ruby
27
star
59

gds-boxen

Apple Macbook setup via Puppet - forked from https://github.com/boxen/our-boxen
Puppet
26
star
60

govuk-content-schemas

Definitions of the data formats used to represent content on GOV.UK
Jsonnet
26
star
61

accessibility-personas

Experience the web as personas with access needs
HTML
25
star
62

data-ethics-and-society-reading-group

Data ethics and society reading group for cross government sessions on books and articles relating to ethics in data science
25
star
63

prototyping

Old tool for making prototypes. No longer maintained. Use https://github.com/alphagov/govuk_prototype_kit instead
HTML
25
star
64

search-api

Search API for GOV.UK
Ruby
25
star
65

data-standards-authority

Collaboration space for working on data standards and guidance for the DSA
JavaScript
24
star
66

content-store

API for content on GOV.UK
Ruby
23
star
67

prometheus-aws-configuration-beta

Terraform configuration to manage a Prometheus server running on AWS.
HCL
23
star
68

paas-alpha-tsuru-ansible

Ansible configs for Tsuru
Python
23
star
69

gds-sso

OmniAuth adapter to allow apps to sign in via GOV.UK signon
Ruby
23
star
70

govuk-frontend-docs

Technical documentation for GOV.UK Frontend
HTML
22
star
71

govuk_frontend_toolkit_gem

A gem wrapper around the govuk_frontend_toolkit files to enable easy integration with Rails
Ruby
22
star
72

govuk-taxonomy-supervised-learning

Auto-tag govuk content to the collated legacy taxonomies
Jupyter Notebook
21
star
73

accessibility-community-notes-and-discussion

Draft accessibility guidance
21
star
74

alphagov.github.io

GitHub organisation site for GDS. Also an Apache Maven repository.
HTML
21
star
75

paas-billing

A Go application for generating billing data from cloudfoundry events
Go
21
star
76

interaction-diagrams

Tooling to generate microservice interaction diagrams using wireshark and PCAP processing.
Ruby
20
star
77

release

Helps deploying to GOV.UK
Ruby
20
star
78

government-digital-strategy

Government Digital Strategy
CSS
20
star
79

govuk-browser-extension

Chrome and Firefox extension for developers working on GOV.UK.
JavaScript
20
star
80

verify-frontend

The frontend service for GOV.UK Verify
Ruby
20
star
81

table-editor

Table editor for creating complex tables in HTML
HTML
19
star
82

govuk-terraform-provisioning

**DEPRECATED** Terraform configuration and utilities to provision parts of the GOV.UK AWS Infrastructure
HCL
19
star
83

pay-selfservice

Payments Team Self Service
JavaScript
19
star
84

fastly-configure

Configures GOV.UK Fastly setup via the command-line
Ruby
19
star
85

govuk-related-links-recommender

Machine learning model to recommend related content
Python
19
star
86

govuk_admin_template

[Deprecated] Styles, scripts and templates for building GOV.UK backend admin apps
JavaScript
19
star
87

static

GOV.UK static files and resources
JavaScript
18
star
88

notifications-net-client

.NET client for the GOV.UK Notify API
C#
18
star
89

gds-nodejs-boilerplate

A Node.js project boilerplate for production apps
JavaScript
18
star
90

paas-cf-conduit

Go
18
star
91

backdrop

Storing and querying data for the Performance Platform
Python
18
star
92

datainsight-frontend

Public facing web app to display various measurements of the GOV.UK site
JavaScript
18
star
93

govuk-archive

18
star
94

aws-security-alarms

CloudTrail and CloudWatch configuration with some basic security alarms.
HCL
18
star
95

govuk-lda-tagger

An experiment of using the LDA machine learning algorithm to generate topics from documents and tag them with those topics
Jupyter Notebook
17
star
96

panopticon

Retired. App that holds some of the content on GOV.UK
Ruby
17
star
97

seal

Slack bot that publishes a team's pull requests to their Slack channel
Ruby
17
star
98

verify-service-provider

👑 ☑️ The easiest way to connect to GOV.UK Verify
Java
17
star
99

paas-aiven-broker

A service broker to provide Aiven Elasticsearch and InfluxDB services to Cloud Foundry users
Go
17
star
100

finder-frontend

Serves finder and search pages for GOV.UK
Ruby
17
star