Commit Graph

318 Commits

Author SHA1 Message Date
Richard Chapman
af1ab437be Revert changes to staging for performance tests and increased rate limit
- Reverted the Gunicorn worker number to 5 (this should be investigated
further on a well baselined system to compare)
- Enabled REDIS
- Increased the rate limit to 400 req/sec as using early testing
yesterday 450+ was being achieved
2017-12-06 09:38:31 +00:00
Ken Tsang
d62b350fcb Add config for letters pdf s3 bucket different environments 2017-12-04 16:29:04 +00:00
Athanasios Voutsadakis
c2228bb7d2 Enable proxy header check on live 2017-12-04 16:14:30 +00:00
Richard Chapman
5f25d3162a Disable Redis for Staging added statsd for post methods
- Disable Redis as there is a current connection limit of 256 which
 could slow down the request if they are all used
 - Added statd to methods in the post to help spot any bottlenecks
2017-12-01 15:41:53 +00:00
Rebecca Law
3b1112d4e4 Remove SQLALCHEMY_ECHO for test 2017-11-29 15:15:03 +00:00
Rebecca Law
39950c47bc Remove \t 2017-11-29 14:30:02 +00:00
Athanasios Voutsadakis
a2aa9c7e32 Bump staging rate limit in preparation for Load Tests 2017-11-23 14:35:36 +00:00
Alexey Bezhan
5e53d781e0 Add FIRETEXT_INBOUND_SMS_AUTH config variable and auth check
Checks authentication header value on inbound SMS requests from
Firetext against a list of allowed API keys set in the application
config.

At the moment, we're only logging the attempts without aborting the
requests. Once this is rolled out to production and we've checked
the logs we'll switch on the aborts and add the tests for 401 and 403
responses.
2017-11-22 09:54:42 +00:00
Athanasios Voutsadakis
0886f6d9f9 Merge branch 'master' into add_proxy_header_check 2017-11-16 16:36:02 +00:00
Richard Chapman
e7de0c0900 Added a template_type to the rest call
Added a template type which is required for the admin UI and updated the
tests. The rest tests needed updated because of the bug fix for
aggregation.
2017-11-16 15:17:27 +00:00
Athanasios Voutsadakis
5d687d87e7 Enable header checking on preview and staging, add test 2017-11-16 12:02:09 +00:00
Richard Chapman
17d1cfe758 Reverted Config on SQLALCHEMY_ECHO
Used for debugging not needed for production so reverted.
2017-11-15 16:00:13 +00:00
Richard Chapman
1e4850b70f Add Template name to response and filter by year
The template name should be returned for the response and the user will
pick a year, so ths adds those two features to the
notifications/templates_usage/monthly endpoint and added some tests to
test the functionality.
2017-11-15 15:55:00 +00:00
Richard Chapman
c27edf5e3c Added new endpoint to get the new template stats
Added a new endpoint which combines the usage of the stats table and the
data from the notifications tables, instead of using all the data from
the notification_history table. This should speed up the query times
and improve the page performance.

- Updated to make the stats create and update function transactional as
it actually wasn't committing the data to the table
- Added the get from the stats table
- Add a a method to combine the two results
- Added the endpoint
2017-11-15 12:58:39 +00:00
Richard Chapman
b78d989d4e Updates after review
- Modified the services_dao to return an int instead of a datetime to
make usage easier and removed the BST function on year as it is not
relevant for year
- Improved tests do there is less logic by ordering the result so there
is less reliance on the template id
- Renamed variable in stats_template_usage_by_month_dao.py to make it
consistent with the method
2017-11-09 14:13:42 +00:00
Richard Chapman
ff911c30d6 Added Scheduled task to get stats for template usage
Currently some pages are timing out due to the time it takes to perform
database queries. This is an attempt to improve the performance by
performing the query against the notification history table once a day
and use the notification table for a delta between midnight and the when
the page is run and combine the results.

- Added Celery task for doing the work
- Added a dao to handle the insert and update of the stats table
- Updated tests to test the new functionality
2017-11-09 10:34:49 +00:00
Leo Hemsted
dd326ec1d3 add new template to config
and rename existing new user email verification template for clarity
2017-11-07 16:47:26 +00:00
venusbb
f81b6e9d99 add protection if the parameter route-secret does not exist 2017-11-06 12:27:48 +00:00
venusbb
f4d005c7fb initial logging for route protection 2017-11-03 14:43:56 +00:00
Richard Chapman
0509669969 Process Incomplete Jobs
- Added a new task to process incomplete jobs
- Added tests to test the new method
- Updated the check for incomplete jobs method to start the new task

This will effectively resume tasks which for some reason were interrupted
whilst they were being processed. In some cases only some of the csv
was processed, this will find the place in the csv and continue processing
from that point.
2017-10-13 16:46:17 +01:00
Rebecca Law
401e209856 Removed the new queue name as it is not needed. 2017-10-12 16:57:04 +01:00
Rebecca Law
e08690cad2 Added a new scheduled task that runs every minute, may want to run it every 3 minutes.
The tasks checks that a job is not still in progress 30 minutes after the job started processing.
2017-10-12 16:21:08 +01:00
Ken Tsang
c29fc8cfa4 Add celery task to check job finished
- celery task called after countdown of 60 minutes from start of job processing
2017-10-11 18:14:56 +01:00
Ken Tsang
7faac304f5 Update ftp tasks to send in the evening rather than the morning 2017-10-04 10:31:10 +01:00
Leo Hemsted
a74db5a80b Merge pull request #1280 from alphagov/letter-api-not-by-job
Letter api not by job
2017-09-28 10:55:58 +01:00
Leo Hemsted
aaadf09562 add tests for new sched task 2017-09-26 12:03:06 +01:00
venusbb
6a7013fa7a Enable Inbound sms IP blocking 2017-09-26 10:59:09 +01:00
Leo Hemsted
daf1dc4dca fix bucket names and change crontab param order for clarity 2017-09-26 09:57:36 +01:00
Leo Hemsted
5e230943c4 remove trailing comma from CELERY_ENABLE_UTC, a beat config option
To run beat after this, you must remove the celerybeat-schedule file from your notifications-api
project root
2017-09-26 09:57:36 +01:00
Leo Hemsted
04412fd314 update queue name 2017-09-26 09:57:35 +01:00
Leo Hemsted
17ba8db97f remove jobs from letter api and make success/error ftp callback tasks
1. No longer create jobs when creating letters from api 🎉
2. Bulk update notifications based on the notification references after
   we send them to DVLA - either as success or as error
2017-09-26 09:57:35 +01:00
Leo Hemsted
f61ccd8ff0 add run_letter_notifications scheduled task
this task grabs all notifications that are sent via the API, and
are still in created - and sends them off to DVLA.
2017-09-26 09:57:35 +01:00
Leo Hemsted
2c758cbccd use new send-jobs-to-dvla task instead of send-files-to-dvla
the tasks (on the ftp app) do the same thing, but to improve clarity
i've renamed it to jobs, because we'll be adding a notifications one
soon
2017-09-12 17:28:07 +01:00
Leo Hemsted
bd2682b521 add new performance-platform section to cf config
it's a new cf-service we've got to create, that contains endpoints
and the bearer tokens for them.
2017-08-23 18:14:35 +01:00
Leo Hemsted
89f4f5173e refactor performance platform code
so that it doesn't appear generic when it's actually specific to
sending the daily notification totals. To do this, split it out into a
separate performance_platform directory, containing the business logic,
and make the performance_platform_client incredibly thin - all it
handles is adding ids to payloads, and sending stats.

Also, some changes to the config (not all done yet) since there is one
token per endpoint, not one for the whole platform as we'd previously
coded
2017-08-23 17:37:29 +01:00
Ken Tsang
c3ce828635 Updated letter jobs schedule to 5:30pm 2017-08-23 13:22:07 +01:00
Ken Tsang
4fb5e68ce7 Refactor code
- Created TaskNames for DVLA_FILES rather than have DVLA_FILES in QueueNames
- Removed PROCESS_FTP from all_queues() as this was causing problems in picking up letter job tasks
- Created test to ensure that we don't arbitrarily add queue names to all_queues
2017-08-23 13:22:07 +01:00
Ken Tsang
41fce57932 Removed PROCESS_FTP from all_queues 2017-08-23 13:22:07 +01:00
Ken Tsang
62172ce39b Updated schedule to run at 5:15pm 2017-08-23 13:22:07 +01:00
Ken Tsang
18881cd580 Add scheduled letter jobs 2017-08-23 13:22:07 +01:00
Rebecca Law
4b33f7e987 Stop purging the DVLA response files from S3
We are not processing the data in these files yet so we need to stop deleting them until the data is recorded.
2017-08-11 12:00:20 +01:00
Leo Hemsted
83fc529cc5 fix broken cloudfoundry logs
wasn't setting log path properly
2017-08-09 16:07:35 +01:00
Leo Hemsted
e7b13e727a don't capture logs directly from stdout
previously in run_app_paas.sh, we captured stdout from the app and
piped that into the log file. However, this came up with a bunch of
problems, mainly:

* exceptions with stack traces often weren't formatted properly,
  and kibana could not parse them
* celery logs were duplicated - we'd collect both the json logs and
  the human readable stdout logs.

instead, with the updated utils library, we can use that to log json
straight to the appropriate directory directly.
2017-08-09 15:29:39 +01:00
Imdad Ahad
5b9377c697 Start populating monthly billing on a schedule 2017-08-02 15:32:32 +01:00
Leo Hemsted
3cb3cf438e remove SEND_COMBINED 2017-07-31 13:29:30 +01:00
Ken Tsang
3e6e75998b Update config to use logo cdn 2017-07-26 11:05:31 +01:00
Leo Hemsted
4d33040653 add separate send-sms and send-email queues
we're reading from those two queues as well as teh existing send queue,
however for now we don't send anything to them
2017-07-20 16:19:38 +01:00
Leo Hemsted
6c61a3fc2a Revert celery4
Revert the following three pull requests:
https://github.com/alphagov/notifications-api/pull/1085
https://github.com/alphagov/notifications-api/pull/1086
https://github.com/alphagov/notifications-api/pull/1088

celery 4.0.2 looked promising, however, on staging under mild load
(5/sec api calls) the performance was actually worse than 3.1.25
2017-07-19 15:17:19 +01:00
Martyn Inglis
0e9e8955f7 Finished celery refactor - set up config for queue prefix
LEO notes: Also made sure the Test BROKER_URL is preserved so that
tests warn you when celery isn't mocked out
2017-07-12 12:37:18 +01:00
Martyn Inglis
786adb5d71 Move Queuenames in with the celery code, revamp config to allow move to celery 4.x 2017-07-12 12:01:52 +01:00