2022-08-01 11:14:37 -07:00
# US Notify Admin
2015-11-18 16:32:15 +00:00
2022-08-01 11:14:37 -07:00
Cloned from the brilliant work of the team at [GOV.UK Notify ](https://github.com/alphagov/notifications-admin ), cheers!
2022-11-07 13:55:30 -05:00
US Notify admin application - https://notify-demo.app.cloud.gov (contact team for access)
2015-11-23 14:37:29 +00:00
2016-03-03 07:41:53 +00:00
- Register and manage users
- Create and manage services
- Send batch emails and SMS by uploading a CSV
2016-02-03 15:18:57 +00:00
- Show history of notifications
Use a Node-based tools for handling assets
…or how to move a bunch of things from a bunch of different places into
`app/static`.
There are three main reasons not to use Flask Assets:
- It had some strange behaviour like only
- It was based on Ruby SASS, which is slower to get new features than libsass,
and meant depending on Ruby, and having the SASS Gem globally installed—so
you’re already out of being a ‘pure’ Python app
- Martyn and I have experience of doing it this way on Marketplace, and we’ve
ironed out the initial rough patches
The specific technologies this introduces, all of which are Node-based:
- Gulp – like a Makefile written in Javascript
- NPM – package management, used for managing Gulp and its related dependencies
- Bower – also package management, and the only way I can think to have
GOV.UK template as a proper dependency
…speaking of which, GOV.UK template is now a dependency. This means it can’t be
modified at all (eg to add a global `#content` wrapper), so every page now
inherits from a template that has this wrapper. But it also means that we have a
clean upgrade path when the template is modified.
Everything else (toolkit, elements) I’ve kept as submodules but moved them to a
more logical place (`app/assets` not `app/assets/stylesheets`, because they
contain more than just SASS/CSS).
2015-12-15 08:20:25 +00:00
2022-08-05 15:29:51 +00:00
## QUICKSTART
2022-04-05 12:00:26 +01:00
2022-08-05 15:29:51 +00:00
---
**NOTE**: Set up the [notifications-api repo ](https://github.com/18F/notifications-api ) locally **FIRST ** , you'll need both the docker network it provides and a functioning api to make use of the notifications-admin repo. It is expected as a byproduct of getting notifications-api running you will also be running VS Code and the Remote Containers extension, and that docker daemon is running and the API is as well.
2016-03-23 14:09:07 +00:00
2022-08-05 15:29:51 +00:00
Open the notifications-admin repo in VS Code (File->Open Folder, select notifications-admin folder)
2016-08-17 15:59:16 +01:00
2022-08-12 15:06:55 -05:00
create a .env file as detailed in the .env Setup section below
2022-08-05 15:29:51 +00:00
2022-08-30 10:31:48 -04:00
Using VS Code's command pallette (cmd+shift+p), search "Remote Containers: Open folder in Container..."
2022-08-05 15:29:51 +00:00
choose devcontainer-admin folder (note: this is a subfolder of notifications-admin/). This will open a new window, closing the current one in the process. After the new window loads, hit "show logs" link in the bottom-right. If this is the first build it will take a few minutes to create the image. The process completes shortly after running gulp.js and compiling front-end files.
Select View->Open View..., then search/select “ports”. Await a green dot on the port view, then open a new terminal and run the web server:
`make run-flask`
2015-11-25 15:29:12 +00:00
2022-08-01 11:14:37 -07:00
Visit [localhost:6012 ](http://localhost:6012 )
2021-02-22 17:12:03 +00:00
2022-08-01 11:14:37 -07:00
NOTE: any .py code changes you make should be picked up automatically in development. If you're developing JavaScript code, open another vscode terminal and run `npm run watch` to achieve the same.
2021-05-11 18:20:40 +01:00
2022-08-05 15:29:51 +00:00
---
## .env Setup
create a .env file using sample.env as a template
`cp sample.env .env` (or via VS Code file browser)
2022-08-12 15:06:55 -05:00
from the notifications-api checkout, copy the values in that repo's .env file for `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` into this repo's .env file.
2022-08-05 15:29:51 +00:00
Change `BASIC_AUTH_USERNAME` and `BASIC_AUTH_PASSWORD` to what you'd like them to be for this deployment.
2021-02-22 17:12:03 +00:00
## To test the application
2022-08-01 11:14:37 -07:00
From a terminal within the running devcontainer:
2021-02-22 17:12:03 +00:00
```
2021-05-11 18:20:40 +01:00
# run all the tests
2021-02-22 17:12:03 +00:00
make test
2021-05-11 18:20:40 +01:00
# continuously run js tests
npm run test-watch
2021-02-22 17:12:03 +00:00
```
2018-07-10 15:16:14 +01:00
2021-05-11 18:20:40 +01:00
To run a specific JavaScript test, you'll need to copy the full command from `package.json` .
2022-08-30 10:31:48 -04:00
## Running a11y-scans locally
Unlike most of the tests and scans, pa11y-ci cannot currently be run from within the VSCode dev container.
1. Run `make run-flask` from within the devcontainer
2. Run `make a11y-scan` from your host computer.
2022-08-01 11:14:37 -07:00
## Further docs [STILL UK DOCS]
2018-12-14 16:25:31 +00:00
2021-02-22 17:15:09 +00:00
- [Working with static assets ](docs/static-assets.md )
2022-04-05 12:00:26 +01:00
- [JavaScript documentation ](https://github.com/alphagov/notifications-manuals/wiki/JavaScript-Documentation )
2021-12-29 15:01:21 +00:00
- [Updating dependencies ](https://github.com/alphagov/notifications-manuals/wiki/Dependencies )