Skip to content
This repository has been archived by the owner on Jan 17, 2025. It is now read-only.

Commit

Permalink
Merge pull request #186 from communitiesuk/update-notif-README
Browse files Browse the repository at this point in the history
updated with links and amended
  • Loading branch information
AbuNavsa authored Jan 15, 2024
2 parents 16d28dd + 0089329 commit aa32c02
Showing 1 changed file with 21 additions and 109 deletions.
130 changes: 21 additions & 109 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,18 @@
[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)
[![Code style : black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Repo for the funding service design notification.
This repository hosts a Flask web service for Funding Service Design Notification System, handling notifications including magic links and emails.

Built with Flask.
[Developer setup guide](https://github.com/communitiesuk/funding-service-design-workflows/blob/main/readmes/python-repos-setup.md)

## Prerequisites
This service depends on:
-[utils](https://github.com/communitiesuk/funding-service-design-utils)

- python ^= 3.10
# IDE Setup
[Python IDE Setup](https://github.com/communitiesuk/funding-service-design-workflows/blob/main/readmes/python-repos-ide-setup.md)

# Getting started

## Installation

Clone the repository

### Create a Virtual environment

python3 -m venv .venv

### Enter the virtual environment

...either macOS using bash:

source .venv/bin/activate

...or if on Windows using Command Prompt:

.venv\Scripts\activate.bat

### Install dependencies
From the top-level directory enter the command to install pip and the dependencies of the project

python3 -m pip install --upgrade pip && pip install -r requirements-dev.txt

NOTE: requirements-dev.txt and requirements.txt are updated using [pip-tools pip-compile](https://github.com/jazzband/pip-tools)
To update requirements please manually add the dependencies in the .in files (not the requirements.txt files)
Then run:

pip-compile requirements.in

pip-compile requirements-dev.in
# Testing
[Testing in Python repos](https://github.com/communitiesuk/funding-service-design-workflows/blob/main/readmes/python-repos-testing.md)

## How to use
Refer to the steps as required
Expand Down Expand Up @@ -104,85 +76,25 @@ Based on the attributes set on the template during its creation, ensure that all

Note: This service is an internal service so it doesn't have the frontend.

# Run with Gunicorn

In deployed environments the service is run with gunicorn. You can run the service locally with gunicorn to test

First set the FLASK_ENV environment you wish to test eg:

export FLASK_ENV=dev

Then run gunicorn using the following command:

gunicorn wsgi:app -c run/gunicorn/local.py
## Paketo
Paketo is used to build the docker image which gets deployed to our test and production environments. Details available [here](https://github.com/communitiesuk/funding-service-design-workflows/blob/main/readmes/python-repos-paketo.md)

## How to post data for notification service.

### Build with Paketo

[Pack](https://buildpacks.io/docs/tools/pack/cli/pack_build/)

[Paketo buildpacks](https://paketo.io/)

```pack build <name your image> --builder paketobuildpacks/builder:base```

Example:

```
[~/work/repos/funding-service-design-notification] pack build paketo-demofsd-app --builder paketobuildpacks/builder:base
***
Successfully built image paketo-demofsd-app
```

You can then use that image with docker to run a container

```
docker run -d -p 8080:8080 --env PORT=8080 --env FLASK_ENV=dev [envs] paketo-demofsd-app
```

`envs` needs to include values for each of:
GOV_NOTIFY_API_KEY
SENTRY_DSN
GITHUB_SHA

```
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
42633142c619 paketo-demofsd-app "/cnb/process/web" 8 seconds ago Up 7 seconds 0.0.0.0:8080->8080/tcp peaceful_knuth
```
Go to relevant service. See example
[Magic links](app/notification/magic_link/README.md)
[Application Record of Submission](app/notification/application/README.md)
[Application Deadline Reminder](app/notification/application_reminder/README.md)

# Pipelines

Place brief descriptions of Pipelines here

- Deploy to Gov PaaS - This is a simple pipeline to demonstrate capabilities. Builds, tests and deploys a simple python application to the PaaS for evaluation in Dev and Test Only.

# Testing

This repo comes with a `.pre-commit-config.yaml`, if you wish to use this do
the following while in your virtual enviroment:

pip install pre-commit black

pre-commit install

Once the above is done you will have autoformatting and pep8 compliance built
into your workflow. You will be notified of any pep8 errors during commits.

## Copilot Initialisation

Copilot is the deployment of the infrastructure configuration, which is all stored under the copilot folder. The manifest files have been pre-generated by running through various initialisation steps that create the manifest files by prompting a series of questions, but do not _deploy_ the infrastructure.

For each AWS account, these commands will need to be run _once_ to initialise the environment:

`copilot app init pre-award` - this links the pre-award app with the current service, and associates the next commands with the service. Essentially, this provides context for the service to run under

```
copilot init \
--name fsd-notification \
--app pre-award \
--type 'Backend Service' \
--image 'ghcr.io/communitiesuk/funding-service-design-notification:latest' \
--port 80
```

This will initalise this service, using the current created image
# Builds and Deploys
Details on how our pipelines work and the release process is available [here](https://dluhcdigital.atlassian.net/wiki/spaces/FS/pages/73695505/How+do+we+deploy+our+code+to+prod)
## Copilot
Copilot is used for infrastructure deployment. Instructions are available [here](https://github.com/communitiesuk/funding-service-design-workflows/blob/main/readmes/python-repos-copilot.md), with the following values for the notification store:
- service-name: fsd-notification
- image-name: funding-service-design-notification

0 comments on commit aa32c02

Please sign in to comment.