Commit Graph

4623 Commits

Author SHA1 Message Date
Alexey Bezhan
ff8373600d Replace manifest services with lists of env variables
Removes bindings to user provided services for new application
deployments and sets the expected environment variables to `null`.

Listing variables in the manifest allows us to only inject secrets
used by the app. `null` is not a valid value for a variable in a
CloudFoundry manifest, so if any of the keys don't have a match in
the credentials file `cf push` will return an error and stop the
deployment.
2018-01-09 10:45:03 +00:00
Alexey Bezhan
0ad5c184c2 Only update existing manifest variables when adding env secrets
Changes generate manifest script to parse variables file as YAML
and only add variables to the manifest if they're already listed
in the `env` section.

This allows us to use a single variables file for all applications
and avoid duplicating secrets across multiple files while adding
only the relevant secrets to the application manifest.
2018-01-09 10:45:03 +00:00
Alexey Bezhan
e02c8339e7 Remove cloudfoundry config parsing logic
By replacing user-provided services with manifest environment variables
we avoid the need to set the application environment variables from the
service data.

Most of the variable names already match the service JSON keys, but we
need to rename the ones that don't (eg MMG and Firetext `api_key`) this
is done in a separate credentials PR.
2018-01-09 10:45:03 +00:00
Alexey Bezhan
da1a7ceb0d Add a script to generate PaaS manifest with environment variables
`./scripts/generate_manifest.py` takes a path to a PaaS manifest file
and a list of variable files and prints a single CloudFoundry manifest.

The generated manifest replaces all `inherit` keys by loading the data
from parent manifests. This allows us to pipe the script output directly
to CF CLI, without saving it to disk, which minimises the risk of it
being accidentally included in the deployment artefact. The combined
manifest might differ from the results produced by CF CLI itself, so
the original manifest shouldn't normally be used on its own.

After combining the manifests the script will load and parse all listed
variable files and add them to the manifest's `env` by merging the files
together in the order they were listed (so in case of any key conflicts
the latest file overwrites previous values), upper-casing keys and
processing any list or dictionary values with `json.dumps`, so that they
can be set as environment variables.

This gives us a full list of environment variables that were previously
parsed from the CloudFoundry user services data.
2018-01-09 10:45:03 +00:00
Rebecca Law
d1da39c388 Merge pull request #1549 from alphagov/dont-use-service-default-address
Change for template default address
2018-01-08 17:22:52 +00:00
Rebecca Law
1634bfb7ad Use the default reply_to from template 2018-01-08 17:11:41 +00:00
Rebecca Law
a052020f84 - simplify if statement
- use the template.get_reply_to_text() in send_notification, it's already using the right thing.
2018-01-08 16:54:19 +00:00
Rebecca Law
d6683d9630 If template has a default address use that address ELSE the address is blank. 2018-01-08 15:54:58 +00:00
Rebecca Law
06197478e1 Merge pull request #1548 from alphagov/populate-default_on_letter_templates
Migration script for setting a default on the template.
2018-01-08 10:58:23 +00:00
Rebecca Law
7792c18efb Migration script to update the templates and templates_history (latest version only) with the service default letter contact block. 2018-01-05 17:34:51 +00:00
Rebecca Law
46ef58ab4d Merge pull request #1544 from alphagov/revert-is_letter_contact_blank
Revert adding the is_letter_contact_blank column.
2018-01-05 17:02:31 +00:00
Rebecca Law
884b8f3990 Merge branch 'master' into revert-is_letter_contact_blank 2018-01-05 16:20:50 +00:00
Rebecca Law
acc1842df7 Merge pull request #1545 from alphagov/revert_is_blank-code
Because life is difficult today...
2018-01-05 16:20:09 +00:00
Rebecca Law
f34a380f7f Fix file name 2018-01-05 16:00:29 +00:00
Rebecca Law
0bc42d1873 Forgot script 2018-01-05 15:58:13 +00:00
Rebecca Law
5be5e17e46 Because life is difficult today...
Need to alter the column to nullable and remove reference to the column in any code. Next PR will drop column
2018-01-05 15:55:02 +00:00
Rebecca Law
9e9b8ab1a3 There was a misunderstanding about how we wanted the feature to work.
There is no need for the extra column.
If a template does not have a default address set - they address will be blank.
Otherwise use the address of the service_letter_contact.

There will be another PR to do a db migration.
Template.service_letter_contact = blank if no service_letter_contacts for service ELSE use set Template.serivce_letter_contact_id = service default service_letter_contact
2018-01-05 15:32:43 +00:00
Richard Chapman
89116d683b Merge pull request #1542 from alphagov/rc-sqlalchemy-config-updates
Moved the SQL Alchemy config from staging to all environments
2018-01-05 14:18:48 +00:00
Rebecca Law
ab96932ca0 Merge branch 'master' into rc-sqlalchemy-config-updates 2018-01-05 13:26:34 +00:00
Chris Hill-Scott
01fd43d64d Merge pull request #1541 from alphagov/pyup-update-pytest-3.3.1-to-3.3.2
Update pytest to 3.3.2
2018-01-05 12:46:49 +00:00
Richard Chapman
b90ee832a7 Moved the SQL Alchemy config from staging to all environments
During database upgrades and database fail overs there has been errors
because the database connection stays open, when a query is run the
query fails and the connection is re-established. To avoid these errors
shorter timeouts have been used to keep the connections from getting
stale.

-  SQLALCHEMY_POOL_TIMEOUT timeout idle connections after 30 secs
- Updated SQLALCHEMY_POOL_RECYCLE to recycle the connection every 5 mins

See guide on optimistic disconnect handling - using the pool recycle
as a way to manage this:
http://docs.sqlalchemy.org/en/latest/core/pooling.html#disconnect-handling-optimistic
2018-01-05 05:53:40 +00:00
pyup-bot
4ef287e8b2 Update pytest from 3.3.1 to 3.3.2 2018-01-05 00:00:16 +00:00
Rebecca Law
8ace370765 Merge pull request #1540 from alphagov/fix-reply-to
Fix the schema for reply_to and added reply_to_text.
2018-01-04 16:18:31 +00:00
Rebecca Law
0c5625fb8b Fix the schema for reply_to and added reply_to_text. 2018-01-04 15:56:58 +00:00
Rebecca Law
d9668974ae Merge pull request #1539 from alphagov/update_template_schema
Update template schema to return the contact block
2018-01-04 12:21:36 +00:00
Rebecca Law
6e6f388f88 Merge branch 'master' into update_template_schema 2018-01-04 11:45:36 +00:00
Rebecca Law
6a3831eace Added a boolean column to templates called is_letter_contact_blank.
If is_letter_contact_blank then the user has set the letter contact block to be blank on purpose
ELSE IF is_letter_contact_blank is false THEN use the template default
IF template default is blank THEN the service_letter_contact is blank use the service default
2018-01-04 11:33:10 +00:00
Katie Smith
9b18afc314 Merge pull request #1506 from alphagov/remove-delivery-receipt-callback-for-letters
Remove the delivery receipt callback for letters
2018-01-03 17:05:24 +00:00
Katie Smith
83711a9a0d Remove the delivery receipt callback for letters
This has been removed because the services only see one status.

Pivotal story: https://www.pivotaltracker.com/story/show/153674962
2018-01-03 16:41:10 +00:00
Sakis
5301a7198d Merge pull request #1532 from alphagov/clean-makefile
Clean makefile
2018-01-03 16:05:16 +00:00
Athanasios Voutsadakis
39181ba5b3 Merge branch 'master' into clean-makefile 2018-01-03 15:58:30 +00:00
Rebecca Law
33e8e55dc6 Update the tests and revert adding the service_letter_contact_id 2018-01-03 15:30:26 +00:00
Rebecca Law
8732506138 Add reply_to in the template schema 2018-01-03 15:10:16 +00:00
Athanasios Voutsadakis
48c37dcaee Merge branch 'master' into clean-makefile 2018-01-03 13:48:34 +00:00
Katie Smith
2e7f1579bb Merge pull request #1536 from alphagov/group-letters-into-max-number-of-files
Group letters into a max number of files for sending to DVLA
2018-01-03 13:27:32 +00:00
Katie Smith
440012288d Add test for max file size and file count when grouping letters 2018-01-03 11:31:22 +00:00
Katie Smith
644b110a8d Group letters into a max number of files for sending to DVLA
Grouping the letters into a maximum number of files is necessary because
the SQS task needs to be under a certain size. We also compress the task
when sending.
2018-01-03 11:31:22 +00:00
Chris Hill-Scott
609fabe206 Merge pull request #1515 from alphagov/custom-invite-urls
Allow admin to specify domain to use for invite links
2018-01-03 11:28:08 +00:00
Chris Hill-Scott
a6a44987a1 Allow admin to domain to use for invite links
When we’re doing user research we often:
- start the task by inviting the participant to a service on Notify
- have them use a prototype version of the admin app, hosted on a
  different domain

Currently we can’t do both of these things together, because the invite
emails always send people to `notifications.service.gov.uk` (because
it’s the API that sends the emails, and the prototype admin app points
at the production API).

This commit changes the API to optionally allow an instance of the admin
app to specify which domain should be used when generating invite links.
2018-01-03 10:47:16 +00:00
Alexey Bezhan
713b1eaf35 Merge pull request #1505 from alphagov/set-sms-sender-to-international-format
Set SMS sender to international format
2018-01-03 10:41:01 +00:00
Alexey Bezhan
7df9fdf42a Normalize outbound SMS sender number in notifications API
Some of the tests don't set up a service sms_sender, so we need to
check if it's None before trying to format the number.
2018-01-03 10:32:34 +00:00
Alexey Bezhan
d5b6bd85fe Normalize outbound SMS sender number in one off notifications 2018-01-03 10:32:34 +00:00
Alexey Bezhan
545ff7dda6 Normalize outbound SMS number for job notifications
Replaces 0 with 44 in UK SMS sender number to make it possible to
respond to the SMS from an international number.
2018-01-03 10:32:34 +00:00
Athanasios Voutsadakis
2470faf04b Remove unused scripts
These were referenced by appspec and have not been used since we
migrated to paas, so they can be removed.
2018-01-02 14:25:40 +00:00
Chris Hill-Scott
577fe623b0 Merge pull request #1535 from alphagov/markdown-links-emails
Enable Markdown links in emails
2018-01-02 12:20:09 +00:00
Chris Hill-Scott
45c9c084e7 Enable Markdown links in emails
Brings in:
- [ ] https://github.com/alphagov/notifications-utils/pull/293
2018-01-02 11:22:18 +00:00
kentsanggds
f4796f39b0 Merge pull request #1510 from alphagov/collate-letter-pdfs-for-day
add collate-letter-pdfs task
2018-01-02 10:56:18 +00:00
Leo Hemsted
9debc96c8c exclude non-pdfs from collate task
and fix celery kwargsg
2018-01-02 10:39:21 +00:00
Leo Hemsted
309b4d7d33 add collate-letter-pdfs task
add collate-letter-pdfs task (name pending). This retrieves a list of
letter pdf files (just the metadata, not the actual data) from s3, and
loops through them, calling the ftp task zip-and-send-letter-pdfs. It
groups them up by adding them to lists while counting the total
filesize, if it gets over a certain filesize (currently set to 500mb)
it breaks at that chunk, sends off that list of files to the ftp app,
and then starts building up a new list.

DVLA have a hard 2gb limit on how big the zip files we can send is -
however we're going to be limited by the amount of memory on the ftp
app well before we get around to handling 2gb of pdf data - so the
limit is 500mb for now. We'll adjust it after we see how ftp performs.
2018-01-02 10:39:21 +00:00
Athanasios Voutsadakis
806e880ec2 Fix .PHONY reference 2017-12-28 18:29:31 +00:00