Commit Graph

4441 Commits

Author SHA1 Message Date
Chris Waszczuk
f206c5d032 Merge pull request #1561 from gov-cjwaszczuk/master
bumped utils version
2018-01-11 16:13:15 +00:00
chrisw
ccdbcf8499 bumped utils version 2018-01-11 16:03:07 +00:00
Katie Smith
79a7355da7 Merge pull request #1555 from alphagov/drop-rate-limit-database-default
Drop rate limit database default
2018-01-11 15:15:58 +00:00
Katie Smith
f6ef0ebbd7 Remove database default on rate_limit column
The default for the rate_limit column in the services and
services_history model is now set in the model, so we can remove the
default from the database.

Pivotal story: https://www.pivotaltracker.com/story/show/153992529
2018-01-11 10:37:26 +00:00
Katie Smith
e8fb9ee01e Merge pull request #1554 from alphagov/use-service-rate-limit-column
Get rate limit from service.rate_limit column (not config)
2018-01-11 10:36:43 +00:00
Katie Smith
b07db16cd1 Get rate limit from service.rate_limit column (not config)
PR #1550 added the rate_limit column to the Service table.

This PR removes the rate limits from the config and uses rate_limit from
the Service model instead. Rate limits are still separated into 'team',
'normal' and 'test', but these values are the same for a service.

Pivotal story https://www.pivotaltracker.com/story/show/153992529
2018-01-11 10:28:11 +00:00
Rebecca Law
f45469c98e Merge pull request #1556 from alphagov/template_default_address
Fix the template history when updating the reply_to for a template.
2018-01-10 13:45:35 +00:00
Rebecca Law
03deb804b0 -Fix typo
- return template from dao not the history
2018-01-10 13:32:54 +00:00
Rebecca Law
e59d6d470e Fix the problem with updating the reply_to or service_letter_contact_id for templates.
The history was not being updated properly, we think this is because the declaritive attribute is not being set propery by the property.
When reply_to: None it will update the service_letter_contact_id, but not the service_letter_contact, we think when the history_meta is build the history class and checking if the value is updated it depends which attribute it is checking first.

In order to fix this issue, there is a new dao method to update the reply_to on the Template and insert a new Template history.
2018-01-10 12:40:14 +00:00
Rebecca Law
cc839562da Fix the template history when updating the reply_to for a template.
It seems selecting the service_letter_contact in the validation method was causing SQLAlchemy to persist the object. When the dao was called to save the object nothing was different so we didn't persist the history object.

It may be time to take another look at how we version. :(
2018-01-09 16:41:58 +00:00
Alexey Bezhan
2a46ab62a3 Merge pull request #1553 from alphagov/fix-f-f-db-migration-push
Fix a typo in api-db-migration deployment make task
2018-01-09 11:53:56 +00:00
Alexey Bezhan
466166c8fb Fix a typo in api-db-migration deployment make task 2018-01-09 11:45:01 +00:00
Katie Smith
50210e5620 Merge pull request #1550 from alphagov/add-rate-limit-to-service
Add rate_limit column to service model
2018-01-09 11:32:43 +00:00
Katie Smith
649679d67f Add rate_limit column to service model
The API rate limit will be removed from the config and added to services
so that it is possible to change the rate_limit for individual services
in rare cases.

Pivotal story: https://www.pivotaltracker.com/story/show/153992529
2018-01-09 11:20:52 +00:00
Alexey Bezhan
18c60c1418 Merge pull request #1543 from alphagov/generate-manifest-env
Replaces user-provided services with manifest environment variables
2018-01-09 11:02:16 +00:00
Alexey Bezhan
40c27c6e70 Don't parse AWS credentials from VCAP_SERVICES in run_app_paas
AWS credentials are provided in the environment variables directly,
so we don't need to parse them from VCAP_SERVICES
2018-01-09 10:45:03 +00:00
Alexey Bezhan
d82801fa5d Remove unused PERFORMANCE_PLATFORM_TOKEN config variable 2018-01-09 10:45:03 +00:00
Alexey Bezhan
f2e6018512 Use generated manifest when deploying apps to PaaS
Adds a new `make generate-manifest` target which is called by
deployment steps.
2018-01-09 10:45:03 +00:00
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