Skip to content

Commit

Permalink
Merge pull request #163 from LandRegistry/formatting
Browse files Browse the repository at this point in the history
Formatting
  • Loading branch information
sichapman authored Jan 6, 2025
2 parents 3ff405a + ef2f524 commit 116f21a
Show file tree
Hide file tree
Showing 53 changed files with 2,049 additions and 1,744 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
pull_request:
push:
branches:
- 'master'
- 'develop'
- "master"
- "develop"

jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ AllCops:
TargetRubyVersion: 2.5

Exclude:
- 'apps/**/*'
- 'scripts/docker/**/*'
- "apps/**/*"
- "scripts/docker/**/*"

Layout/LineLength:
Max: 125
Expand Down
24 changes: 12 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Please note we have a code of conduct, please follow it in all your interactions

## Making a change

Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub][how-to-contribute]. Another useful source of information is [First Timers Only][first-timers].
Working on your first Pull Request? You can learn how from this _free_ series, [How to Contribute to an Open Source Project on GitHub][how-to-contribute]. Another useful source of information is [First Timers Only][first-timers].

Please use the `develop` branch as starting point for your own branch, and the target for any pull requests.

Expand All @@ -22,19 +22,19 @@ In the interest of fostering an open and welcoming environment, we as contributo

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

### Our Responsibilities

Expand Down Expand Up @@ -63,4 +63,4 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], versi
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
[how-to-contribute]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github
[first-timers]: http://www.firsttimersonly.com/
[first-timers]: http://www.firsttimersonly.com/
84 changes: 42 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ This repository contains the code for a development environment that can be used

It provides several hooks for applications to take advantage of, including:

* Docker container creation and launching via docker-compose
* Automatic creation of commodity systems such as Postgres or Elasticsearch (with further hooks to allow for initial provisoning such as running SQL, Alembic DB upgrades or Elasticsearch index creation)
- Docker container creation and launching via docker-compose
- Automatic creation of commodity systems such as Postgres or Elasticsearch (with further hooks to allow for initial provisoning such as running SQL, Alembic DB upgrades or Elasticsearch index creation)

## Getting started

### Prerequisites

* **Docker and Docker Compose**. Exactly what toolset you use depends on your OS and personal preferences, but recommended are:
* [Docker For Mac](https://docs.docker.com/docker-for-mac/)
* [Docker for Windows 10](https://docs.docker.com/docker-for-windows/) (See [the wiki](https://github.com/LandRegistry/common-dev-env/wiki/Windows-setup) for more information on getting a working Windows environment set up)
* [Docker CE for Linux](https://docs.docker.com/install/linux/docker-ce/ubuntu/)
* **Git**
* **Ruby 2.5+**
- **Docker and Docker Compose**. Exactly what toolset you use depends on your OS and personal preferences, but recommended are:
- [Docker For Mac](https://docs.docker.com/docker-for-mac/)
- [Docker for Windows 10](https://docs.docker.com/docker-for-windows/) (See [the wiki](https://github.com/LandRegistry/common-dev-env/wiki/Windows-setup) for more information on getting a working Windows environment set up)
- [Docker CE for Linux](https://docs.docker.com/install/linux/docker-ce/ubuntu/)
- **Git**
- **Ruby 2.5+**

### Git/SSH

Expand All @@ -35,21 +35,21 @@ To begin:

Other `run.sh` parameters are:

* `halt` - stops all containers
* `reload` - stops all containers then rebuilds and restarts them (including running any commodity fragments)
* `destroy` - stops/removes all containers, removes all built images (i.e. leaving any pulled from Docker Hub) and resets all dev-env configuration files.
* `repair` - sets the Docker-compose configuration to use the fragments from applications in _this_ dev-env instance (in case you are switching between several or are in a different terminal window to the one you ran `up` in)
* `quickup` and `quickreload` - as per `up` and `reload` except they do not update anything from git (apps or config), rebuild Docker images or provision any commodity fragments.
- `halt` - stops all containers
- `reload` - stops all containers then rebuilds and restarts them (including running any commodity fragments)
- `destroy` - stops/removes all containers, removes all built images (i.e. leaving any pulled from Docker Hub) and resets all dev-env configuration files.
- `repair` - sets the Docker-compose configuration to use the fragments from applications in _this_ dev-env instance (in case you are switching between several or are in a different terminal window to the one you ran `up` in)
- `quickup` and `quickreload` - as per `up` and `reload` except they do not update anything from git (apps or config), rebuild Docker images or provision any commodity fragments.

#### Extra functionality

* `--nopull` (or `-n`) can go after `up` or `reload` - e.g. `source run.sh up -n`. This will stop images FROMed in Dockerfiles being checked for updates if a copy already exists on the system. Use to avoid Docker Hub pull rate limits.
- `--nopull` (or `-n`) can go after `up` or `reload` - e.g. `source run.sh up -n`. This will stop images FROMed in Dockerfiles being checked for updates if a copy already exists on the system. Use to avoid Docker Hub pull rate limits.

## Usage guide

### Configuration Repository

This is a Git repository that must contain a single file -
This is a Git repository that must contain a single file -
`configuration.yml`. The configuration file has an `applications` key that contains a list of the applications that will be running in the dev-env, each specifying the URL of their Git repository (the `repo` key) plus which branch/tag/commit should be initially checked out (the `ref` key), and any optional Compose fragment variant name to use (the `variant` key) if appropriate.

The name of the application should match the repository name so that things dependent on the directory structure like volume mappings in the app's compose-fragment.yml will work correctly.
Expand All @@ -76,11 +76,11 @@ Docker containers are used to run all apps. So some files are needed to support

This is used by the environment to construct an application container and then launch it. Standard [Compose Spec](https://github.com/compose-spec/compose-spec/blob/master/spec.md) structure applies - but some recommendations are:

* Container name and service name should match
* Any ports that need to be accessed from the host machine (as opposed to from other containers) should be mapped
* A `volumes` entry should map the path of the app folder to wherever the image expects source files to be (if they are to be accessed dynamically, and not copied in at image build time)
* If the provided log collator is to be used, then a syslog logging driver needs to be present, forwarding to logstash:25826.
* If you wish to run the container as the host user so you have full access to any files created by the container (this is only a problem on Linux and WSL), environment variables `OUTSIDE_UID` and `OUTSIDE_GID` are provided for use in the fragment as build args (which can then be used in the `Dockerfile` to create a matching user and set them as the container-executor).
- Container name and service name should match
- Any ports that need to be accessed from the host machine (as opposed to from other containers) should be mapped
- A `volumes` entry should map the path of the app folder to wherever the image expects source files to be (if they are to be accessed dynamically, and not copied in at image build time)
- If the provided log collator is to be used, then a syslog logging driver needs to be present, forwarding to logstash:25826.
- If you wish to run the container as the host user so you have full access to any files created by the container (this is only a problem on Linux and WSL), environment variables `OUTSIDE_UID` and `OUTSIDE_GID` are provided for use in the fragment as build args (which can then be used in the `Dockerfile` to create a matching user and set them as the container-executor).

Although generally an application should only have itself in its compose fragment, there is no reason why other containers based on other Docker images cannot also be listed in this file, if they are not provided already by the dev-env.

Expand Down Expand Up @@ -279,19 +279,19 @@ The OpenLDAP container has been customised with a schema similar to that present

From within a Docker container:

* Host: openldap
* Port: 389 (the default LDAP port)
- Host: openldap
- Port: 389 (the default LDAP port)

From the host system:

* Host: localhost
* Port: 1389
- Host: localhost
- Port: 1389

Other parameters:

* Base DN (AKA search base, search path, etc.): `dc=dev,dc=domain`
* Bind DN (user account for administration): `cn=admin,dc=dev,dc=domain`
* Admin password: `admin`
- Base DN (AKA search base, search path, etc.): `dc=dev,dc=domain`
- Bind DN (user account for administration): `cn=admin,dc=dev,dc=domain`
- Admin password: `admin`

**`/fragments/*.ldif`**

Expand All @@ -307,10 +307,10 @@ When running, Keycloak's admin console is available at <http://localhost:8180/>

Applications using OAuth flows or the OpenID Connect protocol can use Keycloak for this purpose with the following configuration parameters:

* Client ID: `oauth-client`
* Authentication URL: <http://localhost:8180/auth/realms/development/protocol/openid-connect/auth> (must be resolvable by the user agent, hence we use `localhost` assuming that the user agent will be a web browser on the host system)
* Token URL: <http://keycloak:8080/auth/realms/development/protocol/openid-connect/token> (use `localhost:8180` if connecting from the host system)
* OpenID Connect configuration endpoint: <http://keycloak:8080/auth/realms/development/.well-known/openid-configuration> (use `localhost:8180` if connecting from the host system)
- Client ID: `oauth-client`
- Authentication URL: <http://localhost:8180/auth/realms/development/protocol/openid-connect/auth> (must be resolvable by the user agent, hence we use `localhost` assuming that the user agent will be a web browser on the host system)
- Token URL: <http://keycloak:8080/auth/realms/development/protocol/openid-connect/token> (use `localhost:8180` if connecting from the host system)
- OpenID Connect configuration endpoint: <http://keycloak:8080/auth/realms/development/.well-known/openid-configuration> (use `localhost:8180` if connecting from the host system)

JWT tokens issued from the `development` realm have been configured to mimic those issued by Microsoft ADFS servers. In particular, the LDAP `cn` field is mapped to the `UserName` claim in JWT tokens along with the `Office` claim mapped from the `physicalDeliveryOfficeName` in the LDAP database and the `group` claim listing the user's group memberships.

Expand All @@ -325,13 +325,13 @@ Use the following configuration to connect your application:

From within a Docker container:

* Host: cadence
* Port: 7933 (default cadence frontend port)
- Host: cadence
- Port: 7933 (default cadence frontend port)

From the host system:

* Host: localhost
* Port: 7933
- Host: localhost
- Port: 7933

###### Cadence Web

Expand All @@ -340,7 +340,7 @@ cadence core services.

_Running Cadence web locally_

* In a web browser enter <http://localhost:5004>
- In a web browser enter <http://localhost:5004>

###### Localstack

Expand Down Expand Up @@ -382,9 +382,9 @@ If you want to make use of this functionality, ensure that `logstash` is also pr

## Hints and Tips

* Ensure that you give Docker enough CPU and memory to run all your apps.
* The `run.sh destroy` command should be a last resort, as you will have to rebuild all images from scratch. Try the `fullreset` alias as that will just remove your app containers and recreate them. They are most likely to be the source of any corruption. Remember to alter `.commodities.yml` and `.custom_provision.yml` if you need to, and `run.sh reload`.
* A memory limit of 384mb is set for intermediate containers during the image build process - but only if using Docker Compose V1 and you have Buildkit disabled in advanced Docker settings.
- Ensure that you give Docker enough CPU and memory to run all your apps.
- The `run.sh destroy` command should be a last resort, as you will have to rebuild all images from scratch. Try the `fullreset` alias as that will just remove your app containers and recreate them. They are most likely to be the source of any corruption. Remember to alter `.commodities.yml` and `.custom_provision.yml` if you need to, and `run.sh reload`.
- A memory limit of 384mb is set for intermediate containers during the image build process - but only if using Docker Compose V1 and you have Buildkit disabled in advanced Docker settings.

### Useful commands

Expand Down Expand Up @@ -417,8 +417,8 @@ We use [SemVer](http://semver.org/) for versioning. For the versions available a
## Authors
* Simon Chapman ([GitHub](https://github.com/sdchapman))
* Ian Harvey ([GitHub](https://github.com/IWHarvey))
- Simon Chapman ([GitHub](https://github.com/sdchapman))
- Ian Harvey ([GitHub](https://github.com/IWHarvey))
See also the list of [contributors](https://github.com/LandRegistry/common-dev-env/contributors) who participated in this project.
Expand All @@ -428,4 +428,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
## Acknowledgments
* Matthew Pease ([GitHub](https://github.com/Skablam)) - for helping create the original internal version
- Matthew Pease ([GitHub](https://github.com/Skablam)) - for helping create the original internal version
2 changes: 1 addition & 1 deletion apps/root-compose-fragment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ services: {}

networks:
default:
name: 'dv_default'
name: "dv_default"
external: true
4 changes: 2 additions & 2 deletions apps/root-docker-compose-fragment.3.7.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: '3.7'
version: "3.7"

networks:
default:
name: 'dv_default'
name: "dv_default"
external: true
4 changes: 2 additions & 2 deletions apps/root-docker-compose-fragment.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: '2'
version: "2"

networks:
default:
name: 'dv_default'
name: "dv_default"
external: true
26 changes: 13 additions & 13 deletions docs/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<!-- You can erase any questions in this template that are not applicable. -->

* **I'm submitting a ...**
- **I'm submitting a ...**

* [ ] bug report
* [ ] feature request
* [ ] support request
- [ ] bug report
- [ ] feature request
- [ ] support request

* **What is the current behavior?**
- **What is the current behavior?**
_answer_

* **If the current behavior is a bug, what are the steps to reproduce?**
- **If the current behavior is a bug, what are the steps to reproduce?**
_answer_

* **What is the expected/proposed behavior?**
- **What is the expected/proposed behavior?**
_answer_

* **What is the motivation / use case for changing the behavior?**
- **What is the motivation / use case for changing the behavior?**
_answer_

* **Please tell us about your environment:**
- **Please tell us about your environment:**

* Common-dev-env version:
* Operating system (and shell, if not the OS default):
* Ruby version:
- Common-dev-env version:
- Operating system (and shell, if not the OS default):
- Ruby version:

* **Any other information _(e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, etc)_:**
- **Any other information _(e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, etc)_:**
_answer_
20 changes: 10 additions & 10 deletions docs/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
<!-- You can erase any questions or checklists in this template that are not applicable. -->

* **What kind of change does this PR introduce (Bug fix, feature, docs update, ...)?**
- **What kind of change does this PR introduce (Bug fix, feature, docs update, ...)?**
_answer_

* **What is the current behavior?**
- **What is the current behavior?**
_answer (You can also just link to an open issue here)_

* **What is the new behavior (if this is a feature change)?**
- **What is the new behavior (if this is a feature change)?**
_answer_

* **Does this PR introduce a breaking change? If so, what actions will users need to take in order to regain compatibility?**
- **Does this PR introduce a breaking change? If so, what actions will users need to take in order to regain compatibility?**
_answer_

## Checklists

### All submissions

* [ ] Have you followed the guidelines in our [Contributing](CONTRIBUTING.md) document?
* [ ] Is this PR targeting the `develop` branch, and the branch rebased with commits squashed if needed?
* [ ] Have you checked to ensure there aren't other open [Pull Requests](../../pulls) for the same update/change?
- [ ] Have you followed the guidelines in our [Contributing](CONTRIBUTING.md) document?
- [ ] Is this PR targeting the `develop` branch, and the branch rebased with commits squashed if needed?
- [ ] Have you checked to ensure there aren't other open [Pull Requests](../../pulls) for the same update/change?

<!-- You can erase the following part of this template if it's not applicable to your Pull Request. -->

### New feature and bug fix submissions

* [ ] Has your submission been tested locally?
* [ ] Has documentation such as the [README](/README.md) been updated if necessary?
* [ ] Have you linted your new code (using rubocop and markdownlint), and are not introducing any new offenses?
- [ ] Has your submission been tested locally?
- [ ] Has documentation such as the [README](/README.md) been updated if necessary?
- [ ] Have you linted your new code (using rubocop and markdownlint), and are not introducing any new offenses?
2 changes: 1 addition & 1 deletion scripts/docker/activemq/docker-compose-fragment.3.7.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.7'
version: "3.7"
services:
activemq:
container_name: activemq
Expand Down
2 changes: 1 addition & 1 deletion scripts/docker/activemq/docker-compose-fragment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2'
version: "2"
services:
activemq:
container_name: activemq
Expand Down
2 changes: 1 addition & 1 deletion scripts/docker/auth/docker-compose-fragment.3.7.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.7'
version: "3.7"
services:
openldap:
container_name: openldap
Expand Down
2 changes: 1 addition & 1 deletion scripts/docker/auth/docker-compose-fragment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2'
version: "2"
services:
openldap:
container_name: openldap
Expand Down
Loading

0 comments on commit 116f21a

Please sign in to comment.