Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORPD-124 - rename orp to find business regulations #58

Merged
merged 4 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .copilot/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
repository: orp
repository: find-business-regulations
builder:
name: paketobuildpacks/builder-jammy-full
version: 0.3.339
2 changes: 1 addition & 1 deletion .copilot/image_build_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export BUILD_STEP='True'
export COPILOT_ENVIRONMENT_NAME='build'
export DJANGO_SETTINGS_MODULE="config.settings.base"

poetry run python orp/manage.py collectstatic --noinput
poetry run python fbr/manage.py collectstatic --noinput
6 changes: 4 additions & 2 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ jobs:
run: |
npm install
npm run build
DJANGO_SETTINGS_MODULE=config.settings.local poetry run orp/manage.py collectstatic --noinput
DJANGO_SETTINGS_MODULE=config.settings.local poetry run fbr/manage.py collectstatic --noinput

# poetry run fbr/manage.py makemigrations --check --dry-run

# - name: Run tests
# run: poetry run pytest orp/tests
# run: poetry run pytest fbr/tests

# - name: Generate coverage report
# run: poetry run coverage xml
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ cover/
local_settings.py
db.sqlite3
db.sqlite3-journal
orp/static
fbr/static

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
Expand Down
42 changes: 21 additions & 21 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- repo: https://github.com/psf/black
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black
- id: black
args: [--check, --diff] # diff is required for Github workflow
- repo: https://github.com/pycqa/isort
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args:
- --check
- --diff # diff is required for Github workflow
- --profile black
- repo: https://github.com/pycqa/flake8
- --check
- --diff # diff is required for Github workflow
- --profile black
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
- repo: https://github.com/Yelp/detect-secrets
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
- id: detect-secrets
args: [--baseline, .secrets.baseline]
exclude: poetry.lock
- repo: https://github.com/pycqa/bandit
rev: '1.7.8'
- repo: https://github.com/pycqa/bandit
rev: "1.7.8"
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.10.0'
- id: bandit
args: ["-c", "pyproject.toml"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.10.0"
hooks:
- id: mypy
- id: mypy
27 changes: 0 additions & 27 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -135,33 +135,6 @@
"is_verified": false,
"line_number": 102
}
],
"orp/tests/conftest.py": [
{
"type": "Secret Keyword",
"filename": "orp/tests/conftest.py",
"hashed_secret": "ff84e88d512a74e0763b73780b819937e28100cf",
"is_verified": false,
"line_number": 17
}
],
"orp/tests/core/test_companies_house.py": [
{
"type": "Secret Keyword",
"filename": "orp/tests/core/test_companies_house.py",
"hashed_secret": "ff84e88d512a74e0763b73780b819937e28100cf",
"is_verified": false,
"line_number": 10
}
],
"orp/tests/data/mock_ch_profile_response.json": [
{
"type": "Base64 High Entropy String",
"filename": "orp/tests/data/mock_ch_profile_response.json",
"hashed_secret": "da6511f97b6d20a5390ea9afd4c155f9d7236613",
"is_verified": false,
"line_number": 44
}
]
},
"generated_at": "2024-09-09T12:08:54Z"
Expand Down
5 changes: 3 additions & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# The Open Regulation Platform team maintain the orp service
* @uktrade/orp
# The Open Regulation Platform team maintain the Find business regulations service

- @uktrade/find-business-regulations
32 changes: 16 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SHELL := /bin/sh
APPLICATION_NAME="ORP"
APPLICATION_NAME="Find business regulations"
gdbarnes marked this conversation as resolved.
Show resolved Hide resolved

# Colour coding for output
COLOUR_NONE=\033[0m
Expand All @@ -14,19 +14,19 @@ help: # List commands and their descriptions
database: # Create a postgres database for the project
@echo "$(COLOUR_GREEN)Initialising database...$(COLOUR_NONE)"
docker compose up --force-recreate --remove-orphans -d db
docker compose exec db createdb -h localhost -U postgres -T template0 orp
docker compose exec db createdb -h localhost -U postgres -T template0 fbr
docker compose stop db
@echo "$(COLOUR_GREEN)Done$(COLOUR_NONE)"

drop-database: # Delete project's postgres database
@echo "$(COLOUR_RED)Drop database orp$(COLOUR_NONE)"
@echo "$(COLOUR_RED)Drop database fbr$(COLOUR_NONE)"
@read -p "Are you sure? " -n 1 -r; \
if [[ $$REPLY =~ ^[Yy] ]]; \
then \
echo ""; \
echo "$(COLOUR_RED)Dropping database orp$(COLOUR_NONE)"; \
echo "$(COLOUR_RED)Dropping database fbr$(COLOUR_NONE)"; \
docker compose up --force-recreate --remove-orphans -d db; \
docker compose exec db dropdb -h localhost -U postgres orp; \
docker compose exec db dropdb -h localhost -U postgres fbr; \
docker compose stop db; \
echo "$(COLOUR_GREEN)Done$(COLOUR_NONE)"; \
else \
Expand All @@ -38,10 +38,10 @@ build: # Build docker containers for local execution
docker compose build

collectstatic: # Run Django collectstatic
docker compose run --rm web poetry run python orp/manage.py collectstatic --noinput
docker compose run --rm web poetry run python fbr/manage.py collectstatic --noinput

admin: # Create a superuser
docker compose exec web poetry run python orp/manage.py createsuperuser --username admin --email admin@localhost
docker compose exec web poetry run python fbr/manage.py createsuperuser --username admin --email admin@localhost

first-use: # Initialise for local execution
@echo "$(COLOUR_GREEN)Preparing for first use$(COLOUR_NONE)"
Expand Down Expand Up @@ -75,13 +75,13 @@ stop: # Stop running containers without removing them
docker compose stop

.SILENT: clean
clean: # Remove all orp containers and images
clean: # Remove all fbr containers and images
docker compose stop
for i in $$(docker ps -a | awk '$$0!~/IMAGE/ { print $$1 }') ; do \
echo "Removing container $$i" ; \
docker rm $$i ; \
done
for j in $$(docker images | grep 'none\|local_deployment\|orp-web' | awk '{ print $$3; }') ; do \
for j in $$(docker images | grep 'none\|local_deployment\|fbr-web' | awk '{ print $$3; }') ; do \
echo "Removing image $$j" ; \
docker image rm -f $$j ; \
done
Expand All @@ -90,27 +90,27 @@ logs: # View container logs
docker compose logs -f -t

test: # Run tests
pytest orp/tests --cov-report term
pytest fbr/tests --cov-report term

bdd: # Run BDD tests
HEADLESS_MODE=false SLOW_MO_MS=500 behave ./orp/tests/bdd/features/ --tags=LOCAL
HEADLESS_MODE=false SLOW_MO_MS=500 behave ./fbr/tests/bdd/features/ --tags=LOCAL

django-shell: # Run a Django shell (on container)
docker compose run web poetry run python orp/manage.py shell
docker compose run web poetry run python fbr/manage.py shell

django-shell-local: # Run a Django shell (local django instance)
DATABASE_URL=postgres://postgres:postgres@localhost:5432/orp \
DATABASE_URL=postgres://postgres:postgres@localhost:5432/fbr \
DEBUG=True \
DJANGO_ADMIN=False \
DJANGO_SECRET_KEY=walls-have-ears \
DJANGO_SETTINGS_MODULE=config.settings.local \
poetry run python orp/manage.py shell
poetry run python fbr/manage.py shell

migrate: # Run Django migrate
docker compose run --rm web poetry run python orp/manage.py migrate --noinput
docker compose run --rm web poetry run python fbr/manage.py migrate --noinput

migrations: # Run Django makemigrations
docker compose run --rm web poetry run python orp/manage.py makemigrations --noinput
docker compose run --rm web poetry run python fbr/manage.py makemigrations --noinput

lint: # Run all linting
make black
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Open Regulation Platform (ORP)
# Find business regulations

## Introduction

The Open Regulation Platform (ORP) will provide a searchable and filterable list of UK regulations and legislation.
The Find business regulations will provide a searchable and filterable list of UK regulations and legislation.
gdbarnes marked this conversation as resolved.
Show resolved Hide resolved

## Getting Started

Expand All @@ -11,8 +11,8 @@ to run the application and required `PostgreSQL` in a containerised environment.
Most of the actions required to run and manage the application are encapsulated
in the `Makefile`. First, in a working directory run:

$ git clone [email protected]:uktrade/orp.git
$ cd orp
$ git clone [email protected]:uktrade/find-business-regulations.git
$ cd find-business-regulations

The docker compose configuration requires that a `local.env` file is present.
An example file is provided in the repository. Create one like this:
Expand Down Expand Up @@ -106,12 +106,12 @@ With your Poetry shell active:

> To update local database tables, you need to set the `DATABASE_URL` environment variable. You can set it in the terminal or in the `.env` file.

<!-- pragma: allowlist secret --> $ export DATABASE_URL=postgres://postgres:postgres@localhost:5432/orp
<!-- pragma: allowlist secret --> $ export DATABASE_URL=postgres://postgres:postgres@localhost:5432/fbr

> If you want to migrate all apps then navigate /orp/orp and use the following command:
> If you want to migrate all apps then navigate /find-business-regulations/fbr and use the following command:

$ poetry run python manage.py migrate

> If you want to migrate a single app then navigate /orp/orp and use the following command:
> If you want to migrate a single app then navigate /find-business-regulations/fbr and use the following command:

$ poetry run python manage.py migrate <app_name>
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ORP docker-compose configuration.
# Find business regulations docker-compose configuration.
volumes:
postgres_data:
driver: local
Expand All @@ -8,7 +8,7 @@ services:
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=orp
- POSTGRES_DB=fbr
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
Expand All @@ -32,9 +32,9 @@ services:
# db:
# condition: service_healthy
volumes:
- .:/orp
- .:/app
networks:
- proxynet
networks:
proxynet:
name: orp_network
name: fbr_network
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions orp/config/asgi.py → fbr/config/asgi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
ASGI config for orp project.
ASGI config for Find business regulations project.

It exposes the ASGI callable as a module-level variable named ``application``.

Expand All @@ -13,6 +13,6 @@

from django.core.asgi import get_asgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "orp.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fbr.settings")

application = get_asgi_application()
File renamed without changes.
File renamed without changes.
24 changes: 13 additions & 11 deletions orp/config/settings/base.py → fbr/config/settings/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Django base settings for orp project.
"""Django base settings for Find business regulations project.

Environment:
We use django-environ but do not read a `.env` file. Locally we provide
Expand All @@ -25,16 +25,18 @@
# Define the root directory (i.e. <repo-root>)
root = environ.Path(__file__) - 4 # i.e. Repository root
SITE_ROOT = Path(root())
# Define the project base directory (i.e. <repo-root>/orp)
BASE_DIR: Path = Path(root(), "orp")
# Define the project base directory (i.e. <repo-root>/fbr)
BASE_DIR: Path = Path(root(), "fbr")

# Get environment variables
env = environ.Env(
DEBUG=(bool, False),
)

# Must be provided by the environment
SECRET_KEY = env("DJANGO_SECRET_KEY", default="orp-secret-key")
SECRET_KEY = env(
"DJANGO_SECRET_KEY", default="find-business-regulations-secret-key"
)

DEBUG = env("DEBUG", default=False)
DJANGO_ADMIN = env("DJANGO_ADMIN", default=False)
Expand Down Expand Up @@ -225,14 +227,14 @@
LOGGING["loggers"]["django"]["handlers"] = ["asim"]

# ------------------------------------------------------------------------------
# The Open Regulation Platform Zone - specific ORP service settings.
# The Find business regulations zone - specific service settings.
# ------------------------------------------------------------------------------

# Service

SERVICE_NAME: str = "Open Regulation Platform"
SERVICE_NAME_SEARCH: str = "Open Regulation Platform"
CONTACT_EMAIL: str = "paymentpracticesreporting@businessandtrade.gov.uk"
SERVICE_NAME: str = "Find business regulations"
SERVICE_NAME_SEARCH: str = "Find business regulations"
CONTACT_EMAIL: str = "findbusinessregulations@businessandtrade.gov.uk"

# Cookies
ANALYTICS_CONSENT_NAME: str = "analytics_consent"
Expand All @@ -246,9 +248,9 @@
# HOSTNAME
HOSTNAME_MAP = {
"local": "http://localhost:8081",
"dev": "https://dev.orp.uktrade.digital/",
"staging": "https://staging.orp.uktrade.digital/",
"prod": "https://orp.uktrade.digital/",
"dev": "https://dev.find-business-regulations.uktrade.digital/",
"staging": "https://staging.find-business-regulations.uktrade.digital/",
"prod": "https://find-business-regulations.uktrade.digital/",
}

HOSTNAME = HOSTNAME_MAP.get(ENVIRONMENT.lower(), HOSTNAME_MAP["prod"])
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion orp/config/urls.py → fbr/config/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""orp URL configuration."""
"""Find business regulations URL configuration."""

import logging
import time
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion orp/config/wsgi.py → fbr/config/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
WSGI config for orp project.
WSGI config for Find business regulations project.

It exposes the WSGI callable as a module-level variable named ``application``.

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion orp/core/apps.py → fbr/core/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

class CoreConfig(AppConfig):
name = "core"
verbose_name = "ORP core application functionality"
verbose_name = "Find business regulations core application functionality"
default_auto_field = "django.db.models.BigAutoField"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading