Commit Graph

163 Commits

Author SHA1 Message Date
James Moffet
6ad5cefe30 minor configs 2022-07-15 13:53:48 -05:00
Jim Moffet
1c5d432427 clean up and turn off auth for test env 2022-07-01 11:19:58 -07:00
Jim Moffet
1e979ad519 fix basic auth for live environment 2022-07-01 07:58:58 -07:00
Jim Moffet
509cce38f4 set up basicauth config to protect staging site 2022-06-30 17:05:42 -07:00
Christa Hartsock
6d3f67fb9b Initial config for local deployments
Not yet working properly on cloud.gov
2022-06-23 15:53:23 -07:00
Jim Moffet
e17c26d1f6 config buckets 2022-06-23 14:08:29 -07:00
Jim Moffet
2b727e13b4 local dev upgrades 2022-06-13 14:26:46 -07:00
Leo Hemsted
3bda2aa36c remove redis_enabled flag
there's no reason we need to configure this per environment. You can
still use it as before for local development
2022-04-22 12:21:27 +01:00
Katie Smith
66382c240a Delete unused config variable 2022-02-25 11:37:23 +00:00
Chris Hill-Scott
4f672cb5dc Make logo CDN domain into simple config
Having this as a function which does string parsing and manipulation
surprised me a bit when I was trying to figure out why something wasn’t
working.

It’s more in line with the way we do other config like this (for example
`ASSET_PATH`) to make it a simple config variable, rather than trying to
be clever and guess things based on other config variables.

It’s also less code, and is explicit enough that it doesn’t need tests.
2022-01-27 10:33:05 +00:00
Leo Hemsted
86c413557c move financial deets to an environment variable
lets us keep cabinet office financials safe in the credentials repo

the dict in the creds repo will either be an empty dict or a full dict,
so the env var on paas will always contain some parseable json. But
locally it might not, so if it's not set at all then default to the
string `null` so the json parsing doesn't throw a wobbly.
2021-09-08 10:19:46 +01:00
Ben Thorner
b3f48c1a84 Backup original precompiled uploads to S3
This continues the work from Template Preview [1], so that we have
a complete store of original PDFs to use for testing changes to it.

Previously we did store some originals, but these were only invalid
PDFs that had failed sanitisation; for valid PDFs, the "transient"
bucket only contains the sanitised versions, which the API deletes
/ moves when the notification is sent [2].

Since the notification is only created at a later stage [3], there's
no easy way to get the final name of the PDF we send to DVLA. Instead,
we use the "upload_id", which eventually becomes the notification ID
[4]. This should be enough to trace the file for specific debugging.

Note that we only want to store original PDFs if they're valid (and
virus free!), since there's no point testing changes with bad data.

[1]: https://github.com/alphagov/notifications-template-preview/pull/545
[2]: c44ec57c17/app/service/send_notification.py (L212)
[3]: 7930a53a58/app/main/views/uploads.py (L362)
[4]: 7930a53a58/app/main/views/uploads.py (L373)
2021-06-24 12:21:05 +01:00
Rebecca Law
b1d78ada83 Let the API handle setting the default free allowance.
The API has a method to handle setting the default SMS free allowance. This will save a call to the API and remove some code duplication between the two apps.

Needs to be merged after https://github.com/alphagov/notifications-api/pull/3197
2021-04-07 09:32:18 +01:00
Chris Hill-Scott
18a96d3243 Merge pull request #3830 from alphagov/remove-2020-allowances
Remove 2020/21 free allowance data
2021-04-01 10:40:29 +01:00
Chris Hill-Scott
6c8bfdc5b0 Refactor failed login count
We don’t vary this between different environments so it doesn’t need to
be in the config.

I was trying to look up what this value was and found it a bit confusing
that it was spread across multiple places.
2021-03-19 15:20:11 +00:00
Chris Hill-Scott
ef50649572 Remove 2020/21 free allowance data
🚨 Do not merge until after 1 April 2020 🚨

Once this date has past we no longer need to give any services the
previous allowances, so we can remove them from the codebase to avoid
confusion.

It’s possible we change the allowance structure again, but it might
change in a way that this config-based logic doesn’t account for (what
if we did a per-organisation allowance for example). Having both years’
allowances in the config was a quick fix, not a foundation to build on.
2021-03-10 14:51:40 +00:00
Chris Hill-Scott
61f605ff67 Add new rates for 2021
These are the new rates from
https://docs.google.com/document/d/1aObNQNBw3ayPMl3b_Qc5kZBdaXIAMDnBGtV-xPtFBsc/edit?ts=603f68ea#

We’re changing the free allowance so we can continue to support all the
teams that use Notify. The new allowance means over 90% of teams can
still send all the text messages they need to without paying.
2021-03-08 16:59:29 +00:00
Chris Hill-Scott
9a3f2c30ef Use underscores to notate 1000s
This is easier to read than using multiplication, or nothing.
2021-03-08 16:57:57 +00:00
Chris Hill-Scott
bac54462db Change config structure so allowances are dated
We’re going to have different allowances next financial year. This means
that when someone adds a service, we’ll need to check which year it is,
so we can give them the right allowance.

This commit changes the config structure so that the current allowances
are explicitly assigned to the 2020/21 financial year.

It freezes the tests to the 2020/21 financial year, so they won’t start
failing automatically when next financial year comes around.
2021-03-08 14:25:26 +00:00
Chris Hill-Scott
13b63e1a24 Remove reference to styleguide from config
The styleguide no longer exists, so this variable isn’t referred to from
anywhere.
2020-10-16 10:29:26 +01:00
Leo Hemsted
626b1c4211 enable broadcast org in all environments
This organisation is defined in the config file. It's hard coded to a
UUID as defined in the api db migration 0331_add_broadcast_org.
2020-09-25 13:42:13 +01:00
Leo Hemsted
c7ef7d5083 Merge pull request #3643 from alphagov/broadcast-org
move service to broadcast org when broadcasting is enabled
2020-09-24 13:13:34 +01:00
Chris Hill-Scott
6f389d044e Don’t use $yellow to indicate local environment
It clashes with the new `$govuk-focus-colour` now. This commit changes
it to half way between `govuk-colour("dark-grey")` (`#505a5f`) and
`govuk-colour("mid-grey")` (`#b1b4b6`) from the Design System. Dark was
too dark and mid was too light.

It also adds a line of JS to let us easily switch the header to blue by
clicking on it, which is useful for taking screenshots etc.
2020-09-23 11:02:21 +01:00
Leo Hemsted
93d1137474 move service to broadcast org when broadcasting is enabled
we want to keep track of all broadcast services across govt easily. As
such, when broadcasting is enabled for a service, we've decided we're
going to add the service to a special broadcasting organisation.

This organisation is defined in the config file. It's hard coded for
production, if you want to test locally, you should set
BROADCAST_ORGANISATION_ID in your local environment.
2020-09-22 18:18:00 +01:00
David McDonald
2aaca11f8b Turn redis back on 2020-08-11 14:26:12 +01:00
David McDonald
30ed483b7a Turn off redis in all environments for rotation
This is a very short term turn off for while we rotate creds. It will
then be followed immediately by a PR to turn it back on.
2020-08-10 10:25:08 +01:00
David McDonald
d4ed909d0f Revert "Revert "Statsd to prometheus"" 2020-07-01 13:27:12 +01:00
David McDonald
5fb58260e2 Revert "Statsd to prometheus" 2020-07-01 10:00:39 +01:00
David McDonald
6958c0d677 Remove statsd
We don't expose these metrics anywhere anyway and we want to move to
prometheus too (which will be done in the next commit)
2020-06-30 11:08:11 +01:00
Chris Hill-Scott
585fdd9076 Use the correct name for the contact list bucket
Everything else is production. The bucket is currently called
production. The fact that the CSV bucket is called `live-` is a legacy
thing that’s hard to change.
2020-03-16 17:56:55 +00:00
Chris Hill-Scott
03f2368deb Use the correct bucket for storing contact lists
We don’t want to muddy them up with the normal CSV uploads.

I’ve tried to reuse the existing S3 code where possible because it’s
well tested.

Buckets have already been created.
2020-03-16 13:07:39 +00:00
David McDonald
5f548a395a Remove unused environment variable
We no longer use this.

See f56795655e
for further details.
2020-03-06 13:25:53 +00:00
Leo Hemsted
e5b2d81d22 increase reply to address validation timeout on preview
Celery/SQS underperforms in low-traffic environments. Tasks will sit on
celery queues for several seconds before getting picked up if they're
the only thing on the queue. This is observable in our test environments
like preview and staging, but we've got enough load on production that
this isn't an issue.

When we validate reply to email addresses, we expect a delivery receipt
to have been processed within 45 seconds of the button being pressed. On
preview, we often observe times over that, possibly due to the several
queues involved in sending an email and processing its receipt. So, to
ensure that functional tests can pass (when we don't really care how
fast things are, just that the flow doesn't break), bump this timeout up
to 120 seconds on preview. The functional tests were waiting for 120
seconds for the reply to address to be validated anyway.
2020-01-07 12:03:32 +00:00
David McDonald
022c10c20c Merge pull request #3218 from alphagov/dev-antivirus-setting
Antivirus off for development by default
2019-12-06 11:49:48 +00:00
David McDonald
ff9f12c4a7 Antivirus off for development by default
I have copied the approach we use in the API for this
2019-12-05 11:18:48 +00:00
Leo Hemsted
72acc4ebdc add no_cookie blueprint
we have a hunch that some session related issues that we've seen over
the last few weeks might be related to weird race conditions where
cookies set by subresources (image previews of letters on the send flow)
arrive just as the img request is cancelled because the user has clicked
on a button to navigate to a new page, but still manage to set the
cookie? We're not entirely sure what's going on, but we've got a hunch
that not setting cookies on image fetches sounds sensible. Images are
always loaded as a subresource (ie: through a `src` tag in an html
element), so they should never need to change the cookies, so this seems
sensible. We've done this by creating a new blueprint that doesn't set
session.permanent, and doesn't call `save_serivce_or_org_after_request`
either.

cookies are sent back to the browser if:
`sesion.modified or (session.permanent and 'REFRESH_EVERY_REQUEST')`
(where the latter is a config setting).

Turning off REFRESH_EVERY_REQUEST (which is True by default) means that
we will only update the sesion if it's been modified. In practice,
literally every request is modified in the after_request handler
`save_service_or_org_after_request`. This is accidentally convenient,
as it guarantees that we'll still send back the cookie normally even
though refresh_every_request is disabled. Sending back the cookie
updates the expiry time (20 hours), so we need to keep doing this to
preserve existing session timeout behaviour.
2019-12-03 17:06:14 +00:00
Katie Smith
8a322b844b Sanitise uploaded letters and store in S3
This sanitises uploaded letters and stores the sanitised result in S3
with if it passes validation or the original PDF in S3 if validation
fails. A metadata value of 'status' is set to either 'valid' or
'invalid'.
2019-09-12 09:54:36 +01:00
Chris Hill-Scott
13a98a73c1 Set free allowance for GP surgeries
This also tests that a user from an unknown organisation can pick any
of the available options and get the right allowance.
2019-08-29 17:47:14 +01:00
Andy Paine
5242f67d97 REP-340: Use PaaS hosted stats exporter
- We are running the statsd exporter on PaaS now and we can route to it
  on apps.internal
- Send metrics there instead so they end up in Prometheus
2019-08-05 13:47:53 +01:00
Pea Tyczynska
c8bad44db4 Delete references to NHS generic organisation type 2019-07-22 15:59:31 +01:00
Pea Tyczynska
77d281f44f Introduce new org types 2019-07-16 17:00:26 +01:00
Pea Tyczynska
45ac0d7812 Waiting page shows correct messages 2019-05-23 15:34:23 +01:00
Leo Hemsted
f6513613d3 bump utils to bring in redis changes
also set redis url locally to be localhost. redis is disabled by
default so this won't do anything unless you set REDIS_ENABLED=1 as an
environment variable
2019-02-15 11:44:08 +00:00
Chris Hill-Scott
dd711f51b3 Fix asset path in asset fingeprinter
The asset fingerprinter was hard coded to always point to `/static`.

It needs to change depending on which environment the app is running
in.
2018-11-29 13:14:52 +00:00
Chris Hill-Scott
fe6610c221 Fix content security policy for the CDN
The CDN URLs aren’t in included in the content security policy. So
browsers will refuse to load them.

This commit:
- adds each of the CDN URLs to the
- only prepend URLs in CSS files with `/static/` if we’re running
  locally (because the CDN URLs are like `static.example.com` not
  `example.com/static`)
2018-11-29 11:29:52 +00:00
Chris Hill-Scott
b1c0778bde Since moving to putting the admin app on Cloudfront anything on the
`www.notifications.service.gov.uk` domain is:
- not gzipped

The PaaS proxy used to GZip and set headers for anything served from a
path starting with `/static/`:
76dd511a8a/ansible/roles/paas-proxy/templates/admin.conf.j2 (L53-L64)

Anything served from `static.notifications.service.gov.uk` is:
- GZipped
- and as a bonus, cached by Cloudfront where possible (meaning the
requests won’t ever hit our app)

This commit moves to serving static asset from `/static/` to
`static.notifications.service.gov.uk`, to get the above listed benefits.

***

We could do even better by setting long cache expiry headers on the static subdomain (currently they’re only set to cache for 60 seconds). But that’s out of scope for this commit.
2018-11-28 15:50:21 +00:00
Alexey Bezhan
2f0abb9c7d Rename staging CSV uploads bucket to match other environments 2018-11-20 16:46:38 +00:00
Pea Tyczynska
e6e363ba3f Add antivirus scan to letter validation preview view 2018-10-05 16:27:57 +01:00
Chris Hill-Scott
f387f1e6ba Merge pull request #2268 from alphagov/request-to-go-live-better-data
Make the data we get from the go live requests more useful
2018-09-04 16:25:59 +01:00
Athanasios Voutsadakis
c64433b3e7 Disable paas-proxy header check on staging
See: alphagov/notifications-api#2052
2018-09-03 11:10:58 +01:00