Commit Graph
88 Commits
Author SHA1 Message Date
Leo Hemsted 4aeb57567a remove flask-script
flask-script has been deprecated by the internal flask.cli module, but
making this carries a few changes with it

* you should add FLASK_APP=application.py and FLASK_DEBUG=1 to your
  environment.sh.
* instead of using `python app.py runserver`, now you must run
  `flask run -p 6012`. The -p command is important - the port must be
  set before the config is loaded, so that it can live reload nicely.
  (https://github.com/pallets/flask/issues/2113#issuecomment-268014481)
* find available commands by just running `flask`.
* run them using flask. eg `flask list_routes`
* define new tasks by giving them the decorator
  `@app.cli.command('task-name')`. Task name isn't needed if it's just
  the same as the function name. Alternatively, if app isn't available
  in the current scope, you can invoke the decorator directly, as seen
  in app/commands.py
2017-11-06 17:33:04 +00:00
Chris Hill-Scott 1530613fb4 Remove references to pycodestyle
We’re using flake8 now instead.
2017-10-20 11:02:39 +01:00
Chris Hill-Scott eb2eea2e0b Use more processors when running tests
Back on my old 2013 Macbook Pro, 2 was the optimum number of cores for the fastest test runs. Which is why I chose `-n2` when I originally introduced this flag (see 9ced677ec7).

Now I have a faster Macbook (same as every other developer), which has more cores to take advantage of.

We also use 4 cores when running the API tests.

Cores | Time taken to run tests
--- | ---
1 | 28.31s
2 | 18.15s
3 | 14.33s
4 | 12.32s
5 | 12.98s
6 | 13.49s
8 | 15.37s
2017-10-18 11:15:09 +01:00
Athanasios Voutsadakis 79752d2754 Configure gunicorn errorlog
Related: alphagov/notifications-api/pull/1274
2017-09-22 15:41:41 +01:00
Leo Hemsted 8dc9d1205b typo 2017-08-22 15:05:10 +01:00
Leo Hemsted 56746e6f0f 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 that exceptions with stack traces often weren't
formatted properly, and kibana could not parse them

instead, with the updated utils library, we can use that to log json
straight to the appropriate directory directly.
2017-08-09 15:41:33 +01:00
Imdad Ahad d06a72224e Don't create wheels for dependencies but store offline:
Previously we used AWS which meant that we could create wheels
from our requirements and then install them offline which made
deployments quicker.

We're no longer using AWS so let's remove that.

Although CloudFoundry supports installing dependencies in an offline
environment as documented here:
http://docs.cloudfoundry.org/buildpacks/python/#vendoring

To achieve this we create a vendor/ directory which will contain
the packages to install. This uses --no-index and --find-links so will
not resolve for any dependencies from pypi. For this reason there is
assumed confidence that the vendor/ directory will contain all
of the dependencies we need.
2017-07-20 14:17:10 +01:00
Martyn Inglis e233c3868d Added some whitespace 2017-04-25 17:02:06 +01:00
Martyn Inglis e7d6fd3293 updated run_tests to not use venv in the app if VIRTUAL_ENV is set 2017-04-25 15:32:12 +01:00
bandesz 0f0d567ae6 PaaS run script: redirect stderr to stdout 2017-03-21 15:04:08 +00:00
Leo Hemsted 1cacd92411 Merge pull request #1153 from alphagov/forget-me
Remove remember me cookie
2017-03-06 09:39:52 +00:00
bandesz 55f2d49e25 Add termination timeout to run_app_paas.sh 2017-02-28 17:38:50 +00:00
Leo Hemsted 9fda5d1847 remove remember_me cookie and related code 2017-02-27 15:18:18 +00:00
bandesz b148a0a6a0 Add awslogs logging for PaaS 2017-02-16 14:19:37 +00:00
Imdad Ahad 4110d06e1f Cancel uninstalling python packages 2017-02-14 12:17:03 +00:00
Imdad Ahad 4ffc6e360c Remove notify app folder and installed python packages before we deploy the app 2017-02-13 17:32:51 +00:00
Chris Hill-Scott f048b918a0 Use pycodestyle instead of PEP8
PEP8 was renamed to pycodestyle; this issue explains why:
PyCQA/pycodestyle#466

This commit changes our tests to use pycodestyle instead of pep8.

No changes to our code were required as a result.
2017-02-02 10:50:26 +00:00
Jenny Duckett 5eca69882a Generate the version file in the bootstrap script
This file needs to exist before the app can run, so create it automatically
rather than including it as an extra setup step in the README. The API app
already does this.
2016-11-29 16:25:50 +00:00
bandesz 0c00f3aae8 Add AGS elb to AWS scripts 2016-11-22 16:19:51 +00:00
Imdad Ahad 75854d91fc Use python wheels to speed up deployments 2016-11-07 17:56:08 +00:00
Leo Hemsted 008c88e42c add junit xml reporting to pytest 2016-08-31 15:15:28 +01:00
bandesz cf34aff673 Travis cleanup: remove deploy + functest trigger 2016-08-25 16:20:17 +01:00
bandesz 26ff449b77 Create Docker build image, build project with Docker 2016-08-22 17:25:05 +01:00
Leo Hemsted d5238bce5b handle if user doesn't provide name/email
also clean up usage of DESKPRO_PERSON_EMAIL and put it in the conf rather than env
2016-08-04 18:01:08 +01:00
Martyn Inglis 147069a626 Removed unused dir change 2016-07-29 10:23:27 +01:00
Martyn Inglis 19aca03aed updated python in bootstrap file 2016-07-29 10:23:27 +01:00
Martyn Inglis bf3bc1f2f7 Increase ELB timeout 2016-07-29 10:23:27 +01:00
Martyn Inglis fe84674a77 Updated start scripts to not look up envrionemnt 2016-07-29 10:20:27 +01:00
Martyn Inglis 0cc3bb5970 using python3 in falback venv 2016-07-08 14:38:59 +01:00
Chris Hill-Scott e775ea2446 Delete commented out lines
These aren’t being used, so why have them?
2016-07-05 09:28:20 +01:00
Chris Hill-Scott 9ced677ec7 Run tests on multiple CPU cores
We can make the tests run slightly faster by parallelizing them across
multiple CPU cores:

- from some casual testing locally, 2 cores gives the optimum speedup
- Travis container-based builds have 2 CPU cores available[1]
- the net gain is about 20%, or 2 seconds
- unfortunately we can’t do this on the API because each test is still
  using the same instance of the database

1. https://docs.travis-ci.com/user/ci-environment/#Virtualization-environments
2016-07-05 09:27:50 +01:00
Martyn Inglis 44b0bd3092 Scripts added to deregister admin app from ELB on deploy
- Application Stop state will deregister
- Application Start state re-registers

Ensures that the App instance is not receiving traffic before stopping the app as part of a code deploy

These scripts are from :

https://blogs.aws.amazon.com/application-management/post/Tx39X8HM93NXU47/Use-AWS-CodeDeploy-to-Deploy-to-Amazon-EC2-Instances-Behind-an-Elastic-Load-Bala

Adapted to remove notion of Autoscaling groups (which we don't use) and to use a named ELB, allows common file to be common and start/stop to be changed.
2016-05-18 13:08:51 +01:00
Chris Hill-Scott 37fff2da63 Revert "Install lxml first on ubuntu"
This reverts commit 844f9c4276.
2016-05-16 17:22:26 +01:00
Rebecca Law 844f9c4276 Install lxml first on ubuntu 2016-05-16 16:43:55 +01:00
Adam Shimali 461581d299 Only trigger dependent built for master, staging and live 2016-05-11 12:33:11 +01:00
Adam Shimali 521fdc26ab Pass branch name to dependent build 2016-05-10 14:10:08 +01:00
Adam Shimali 4d3697419a Should dependent build env var be set global? 2016-05-09 14:42:51 +01:00
Adam Shimali 506ef3a30f I think json for dependent build env var was incorrect 2016-05-09 14:10:07 +01:00
Adam Shimali 2c230fb6d8 Another attempt to trigger dependent build 2016-05-09 13:50:18 +01:00
Adam Shimali 10d5f03124 Another attempt at triggering dependent build 2016-05-09 13:33:52 +01:00
Adam Shimali 5e73fa9a2e Try to pass test env to run as part of trigger depdendent build 2016-05-09 12:57:30 +01:00
Rebecca Law 6c6dc51ea3 Revert changes to aws deployment location for master builds on preview environment 2016-04-18 14:13:38 +01:00
Rebecca Law 0b777b76a6 Update deployment files for aws 2016-04-15 16:31:31 +01:00
Nicholas Staples 6ea72182d2 Download CSV option now available. 2016-04-12 14:19:51 +01:00
Rebecca Law 02687710ae Remove commented code 2016-04-12 12:23:01 +01:00
Rebecca Law 9620d91330 Removed unused files and directory. 2016-04-11 09:35:50 +01:00
Chris Hill-Scott 5c4de3d13d Add code coverage
- generates a code coverage report
- triggers Coveralls on every Travis build
- adds a badge to the README
2016-04-07 11:03:27 +01:00
Adam Shimali 3e167c69f2 Clean up config a bit. Get values for config from environment.
Removed some old redundant config.
2016-03-23 15:07:04 +00:00
Martyn Inglis 2473b09beb Start aligning Admin app with config styles used elsewhere
- no config overrides - now all set in environment
- use different files for staging and live too allow for differently named env variables
- updates to run_app and run_tests scripts to set correct environment (test/development) so correct config picked up
- use environment file on deployed environments to pick correct config
2016-03-17 13:45:59 +00:00
Martyn Inglis 76ccb99666 Fixed up the health check page 2016-03-03 16:41:21 +00:00