2022-08-01 10:56:16 -07:00
# US Notify API
2015-11-20 10:51:08 +00:00
2022-10-20 14:05:23 -04:00
This project is the core of [Notify ](https://notifications-admin.app.cloud.gov/ ). It's cloned from the brilliant work of the team at [GOV.UK Notify ](https://github.com/alphagov/notifications-api ), cheers!
2022-08-01 10:50:50 -07:00
2022-10-20 14:05:23 -04:00
This repo contains:
2022-07-14 13:36:05 -05:00
2022-10-20 14:05:23 -04:00
- A public-facing REST API for Notify, which teams can integrate with using [API clients built by UK ](https://www.notifications.service.gov.uk/documentation )
- An internal-only REST API built using Flask to manage services, users, templates, etc., which the [admin UI ](http://github.com/18F/notifications-admin ) talks to)
2022-10-26 14:05:37 +00:00
- Asynchronous workers built using Celery to put things on queues and read them off to be processed, sent to providers, updated, etc.
2015-11-20 10:51:08 +00:00
2022-10-26 15:45:45 +00:00
Our other repositories are:
- [notifications-admin ](https://github.com/GSA/notifications-admin )
- [notifications-utils ](https://github.com/GSA/notifications-utils )
- [us-notify-compliance ](https://github.com/GSA/us-notify-compliance/ )
- [notify-python-demo ](https://github.com/GSA/notify-python-demo )
## Documentation, here and elsewhere
### About Notify
- [Roadmap ](https://notifications-admin.app.cloud.gov/features/roadmap )
- [Using the API ](./docs/api-usage.md )
### Infrastructure
- [Overview, setup, and onboarding ](./docs/infra-overview.md )
- [Database management ](./docs/database-management.md )
### Common dev work
- [Local setup ](#local-setup )
- [Testing ](./docs/testing.md )
2022-10-28 11:11:17 -04:00
- [Deploying ](./docs/deploying.md )
2022-10-26 15:45:45 +00:00
- [Running one-off tasks ](./docs/one-off-tasks.md )
## UK docs that may still be helpful
- [Writing public APIs ](docs/writing-public-apis.md )
- [Updating dependencies ](https://github.com/alphagov/notifications-manuals/wiki/Dependencies )
2022-10-20 14:05:23 -04:00
## Local setup
2022-08-05 02:22:21 +00:00
2022-10-20 14:05:23 -04:00
### Direct installation
2022-08-05 02:22:21 +00:00
2022-10-28 12:48:22 -04:00
1. Set up Postgres && Redis on your machine
1. Install [pipenv ](https://pipenv.pypa.io/en/latest/ )
2022-08-05 02:22:21 +00:00
2022-10-20 14:05:23 -04:00
1. Install dependencies into a virtual environment
2022-08-05 02:22:21 +00:00
2022-10-28 12:48:22 -04:00
`make bootstrap`
2022-08-05 02:22:21 +00:00
2022-10-20 14:05:23 -04:00
1. Create the .env file
2022-08-05 02:22:21 +00:00
2022-10-20 14:05:23 -04:00
```
cp sample.env .env
# follow the instructions in .env
```
2022-08-05 02:22:21 +00:00
2022-10-20 14:05:23 -04:00
1. Run Flask
2022-08-05 02:22:21 +00:00
2022-10-28 12:48:22 -04:00
`make run-flask`
2022-08-05 02:22:21 +00:00
2022-10-20 14:05:23 -04:00
1. Run Celery
2022-08-01 10:50:50 -07:00
2022-10-28 12:48:22 -04:00
`make run-celery`
2022-08-22 14:25:39 -05:00
2016-10-04 15:09:58 +01:00
2022-10-20 14:05:23 -04:00
### VS Code && Docker installation
2016-10-04 15:09:58 +01:00
2022-10-20 14:05:23 -04:00
If you're working in VS Code, you can also leverage Docker for a containerized dev environment
2022-08-01 10:50:50 -07:00
2022-10-26 14:05:37 +00:00
1. Create the .env file
```
cp sample.env .env
# follow the instructions in .env
```
2022-06-28 15:30:09 -07:00
2022-10-20 14:05:23 -04:00
1. Install the Remote-Containers plug-in in VS Code
2022-06-28 15:30:09 -07:00
2022-10-20 14:05:23 -04:00
1. With Docker running, create the network:
2022-06-28 15:30:09 -07:00
2022-10-20 14:05:23 -04:00
`docker network create notify-network`
2022-06-28 15:30:09 -07:00
2022-10-20 14:05:23 -04:00
1. Using the command palette (shift+cmd+p) or green button thingy in the bottom left, search and select “Remote Containers: Open Folder in Container...” When prompted, choose **devcontainer-api ** folder (note: this is a * subfolder * of notification-api). This will startup the container in a new window, replacing the current one.
2022-06-28 15:30:09 -07:00
2022-10-26 14:05:37 +00:00
1. Wait a few minutes while things happen 🍵
2022-06-28 15:30:09 -07:00
2022-10-20 14:05:23 -04:00
1. Open a VS Code terminal and run the Flask application:
2022-06-28 15:30:09 -07:00
2022-10-20 14:05:23 -04:00
`make run-flask`
2016-02-23 12:28:10 +00:00
2022-10-20 14:05:23 -04:00
1. Open another VS Code terminal and run Celery:
2021-02-18 15:19:40 +00:00
2022-10-20 14:05:23 -04:00
`make run-celery`
2018-11-07 16:33:22 +00:00
2022-10-20 14:05:23 -04:00
NOTE: when you change .env in the future, you'll need to rebuild the devcontainer for the change to take effect. Vscode _ should _ detect the change and prompt you with a toast notification during a cached build. If not, you can find a manual rebuild in command pallette or just `docker rm` the notifications-api container.
2016-05-11 15:52:49 +01:00