Commit Graph

59 Commits

Author SHA1 Message Date
Chris Hill-Scott
0f68d25265 Replace custom pip freeze script with pip-tools
In the past we've avoided using out-of-the-box solutions for Python
dependency resolution because a) they haven't been very mature and b)
we've had lots of issues with version conflicts. See [[1]], [[2]] for
details. Instead, we've been using a custom Python script that
under-the-hood runs `pip freeze` and saves the output to
`requirements.txt`.

This script works well for us, but it doesn't integrate well with other
tools. On the other hand [`pip-tools`](https://github.com/jazzband/pip-tools)
as of 2020 seems to be well-supported by its maintainers and other
tools; for instance, GitHub's automated update service
[Dependabot](https://dependabot.com) supports `requirements.in` files.

This commit replaces our `freeze-requirements` make command with
`pip-compile`.

The Digital Marketplace team have made this change and seem happy with
the results.
2021-01-08 17:02:39 +00:00
David McDonald
36fa31563d Use cf7 commands for the cf CLI commands
As we want to upgrade from cf6 to cf7 CLI
2020-12-08 17:59:25 +00:00
Pea Tyczynska
652b627312 Update healthcheck page and remove all travis references from the repository 2020-04-24 11:54:26 +01:00
Leo Hemsted
7df45d6cce bump deployment timeout
5 minutes isn't long enough to deploy ten instances of the admin app -
it turns out it takes marginally longer than 5 minutes to roll each
instance one after the next. this can lead to confusion as the build
fails, functional tests don't run, but the code may have deployed fine
and be running on production.
2020-03-23 14:38:01 +00:00
David McDonald
d3c8b35aa9 Rearrange makefile 2020-03-03 12:05:56 +00:00
David McDonald
162734c7a7 Remove unused makefile commands
These are either not used at all or we have superseeded them with
commands written directly into concourse jobs
2020-03-03 12:05:15 +00:00
David McDonald
aa9446f752 Remove jenkins related code 2020-03-03 12:04:32 +00:00
Chris Hill-Scott
0fc1ae63e9 Add a command to fix import order
We check import order as part of our automated tests. But fixing them
means:
- manually editing them and rechecking
- remembering the parameters to `isort`
- looking up the `isort` command from the last time you ran it

Putting it in the Makefile should make life a bit easier.
2020-01-13 10:26:11 +00:00
David McDonald
224db44a9e Remove coveralls
We aren't using it
2019-12-24 15:25:34 +00:00
David McDonald
ecac52a155 Remove venv creating in makefile
Let's developer create their own virtualenvs using virtualenvwrapper as
they already do.
2019-12-24 15:24:07 +00:00
David McDonald
74b46782ff Remove pip-accel
Not sure how much benefit we are getting from this. Pip-accel has
already not been supported for 3 years now either.
2019-12-24 15:22:42 +00:00
David McDonald
8ce1917740 Revert "Remove pip-accel" 2019-12-23 11:49:32 +00:00
David McDonald
807c83c656 Remove coveralls
We don't use it
2019-12-20 16:58:45 +00:00
David McDonald
4c9c98afb4 Remove forcing of venv
Let's developers do this themselves using virtualenvwrapper
2019-12-20 16:57:25 +00:00
David McDonald
4ea46f2c71 Remove pip-accel
Not sure how much benefit we are getting from this. Pip-accel has
already not been supported for 3 years now either.
2019-12-19 16:25:01 +00:00
Leo Hemsted
6359657db8 update manifest file to use zdt-push
https://github.com/alphagov/notifications-api/pull/2498 contains some
more info
2019-05-09 16:11:26 +01:00
Leo Hemsted
4b386d36ef default CF_APP to notify-admin
(it's overriden in the calls to generate-manifest for the prototypes)
2019-04-18 14:48:23 +01:00
Leo Hemsted
9547fedcc3 move manifest to single jinja template
uses the same pattern as other apps. Infers route based on app name,
you can declare more in the dict at the top if you need to.
2019-04-16 14:46:00 +01:00
Chris Hill-Scott
cc405d7c1a Set far-future cache headers on S3 assets
So that browsers will cache them for as long as possible. We invalidate
this cache by adding the hash of each file to the query string.

There’s no way of doing this on a whole bucket; it has to be set on each
item. Adding this flag does so at the time of uploading the items.

Value of 10 years in seconds taken from:
0ee3bcb1ee/whitenoise/base.py (L19)
2018-12-21 12:00:45 +00:00
Athanasios Voutsadakis
93db0b6817 Decouple upload-static from cf-deploy
There are some permissions issues that need to be addressed before
we chain these two together.
2018-12-18 15:48:14 +00:00
Chris Hill-Scott
54638ad2e7 Copy static files to S3 when deploying
We have a nasty bug where Cloudfront is caching old files against new
URLs because the new code rolls out gradually across the ~10 admin
instances we have in production.

The way we are going to fix this is by pointing Cloudfront at S3, which
doesn’t have the concept of ‘instances’.

This commit does the work to copy the files to the new buckets. It
depends on the beuckets being set up.
2018-12-18 11:57:52 +00:00
Leo Hemsted
f279bbbd33 bump utils to fix slow notification rendering 2018-08-09 14:07:06 +01:00
Alexey Bezhan
5bae92c738 Make pyup ignore requirements.txt
We don't want pyup.io upgrading sub-dependencies listed in the
requirements.txt file since it does it whenever a new version is
available regardless of what our application dependencies require.
2018-07-30 16:43:44 +01:00
Alexey Bezhan
2f876243ae Pin all requirements in requirements.txt
The list of top-level dependencies is moved to requirements-app.txt,
which is used by `make freeze-requirements` to generate the full
list of requirements in requirements.txt.

(See alphagov/notifications-api#1938 for details.)
2018-07-30 16:43:03 +01:00
Chris Hill-Scott
eaf1534e9a Write manifests to disk instead of redirecting
Some time between version 6.32 and 6.34 of the Cloudfoundry CLI the
ability to redirect the output of a command into `cf push -f` was
broken.

The only alternative we can think of is writing the file to disk, doing
the deploy, and then deleting it.

We’re careful to write to a directory outside the current repo to avoid:
- including secrets in the deployed package
- accidentally checking the secrets into source control

`/tmp/` seems to be a good place to put it, since, even if the delete
doesn’t run, it will get cleaned up eventually (probably when the
machine next boots).

Right now this only applies to people deploying from their local
machines. At some point it will affect Jenkins too, but isn’t now. So
this commit only fixes the problem for the commands that developers run
locally.

fixup! Write manifests to disk instead of redirecting
2018-04-12 16:41:08 +01:00
Chris Hill-Scott
c0828a891b Create manifest-prototype-2-base.yml 2018-04-12 16:40:19 +01:00
Alexey Bezhan
ab55bf49b2 Add generate_manifest.py script and update deployment tasks
Brings in the new environment variables deployment process introduced
in alphagov/notifications-api#1543.

The script is a copy of the API one and make steps are modified to
fit with the existing admin deployment targets.
2018-01-09 14:14:47 +00:00
Athanasios Voutsadakis
d9f6554956 Add make targets to enable and disable failwhale
Also add a couple of convenience targets and bring back the DNS_NAME
variable.
2018-01-03 17:17:26 +00:00
Athanasios Voutsadakis
5a9d5cd065 Remove unused targets and variables from Makefile
Remove `cf-build` and `cf-build-with-docker` as they are not being used
Remove `build-codedeploy-artifact` in favor of `build-paas-artifact`
Remove `upload-codedeploy-artifact` in favor of `upload-paas-artifact`
Remove `deploy`, `check-aws-vars`,
`deploy-suspend-autoscaling-processes`,
`deploy-resume-autoscaling-processes`,
`deploy-check-autoscaling-processes` as they are remains of the pre-paas
era.

Consequently some variables became obsolete, namely: `CODEDEPLOY_PREFIX`
`CODEDEPLOY_APP_NAME`, `DNS_NAME`, `AWS_ACCESS_KEY_ID` and
`AWS_SECRET_ACCESS_KEY` and they are removed.
2018-01-02 12:29:50 +00:00
Imdad Ahad
85a59746a0 Revert d06a72 and 6b9b1be but keep the wheel-removal changes 2017-07-21 11:21:17 +01:00
Imdad Ahad
82b8321d07 Revert "Remove vendor folder before building artefact" 2017-07-21 11:06:00 +01:00
Imdad Ahad
90dd4101b1 Remove vendor folder before building artifact 2017-07-21 10:10:31 +01:00
Imdad Ahad
6b9b1be521 Copy all the dependencies into the directory 2017-07-20 17:50:31 +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
Chris Hill-Scott
4fc98127ca Add config to deploy a prototype version of admin
Sometimes we want to make changes to the admin app for doing user
research that we don’t want all users to see (because we’re not sure if
they’re the right changes to be making).

Previously this meant doing the research using a team member’s computer,
with the app running locally. This was bad for three reasons:

- requires the time of someone who has the code running locally
- requires the participant to use an unfamiliar computer
- means the participant doesn’t have access to their own Notify account
  (or an account that we’ve set up for doing user research with)

The dream* would be to have two versions of the frontend app running
side by side in production. This commit makes the dream real – the two
versions of admin are:

- the normal admin app, accessible on
  `www.notifications.service.gov.uk`
- a prototype version meant to be pushed to from a developer’s local
  machine**, on a `cloudapps.digital` subdomain

Both of these apps share the same backing services, eg config, API
instance, queues, etc, etc. Which means that the prototype version can
be logged into with the same username and password, and the user will
see their service and all their templates when they do so.

Ideally this wouldn’t mean creating a separate base manifest. However
it’s a feature of Cloud Foundry that you can override the application
name. Which means a separate base manifest and a bit of duplication. 😞

* actually the real dream would be to have a version of admin deployed
for each branch of the admin app, but this might get a bit resource
intensive.

** by running `CF_SPACE=preview make preview cf-deploy-prototype`, where
`preview` is the name of the space you want to deploy to
2017-05-08 16:54:44 +01:00
bandesz
71b4d9eb6e Fix PaaS scaling at deploy 2017-03-23 12:29:36 +00:00
bandesz
973b6621df PaaS rollback: check if the rollback app is in a started state 2017-03-16 12:29:16 +00:00
bandesz
d3b7d1aeee Remove Docker commands for CF, clean up artifact creation 2017-02-28 12:31:56 +00:00
bandesz
16a40e526b Remove Jenkinsfiles, add PaaS artifact tasks 2017-02-27 17:04:19 +00:00
Chris Hill-Scott
d043536aaf Merge pull request #1141 from alphagov/fix-codedeploy-artifact
Remove old target directory and include any dotfiles in the zip
2017-02-20 15:25:30 +00:00
bandesz
41210a9d2b Add cf-rollback-with-docker Make task 2017-02-20 13:23:55 +00:00
Imdad Ahad
f355e7e50b Remove old target directory and include any dotfiles in the zip 2017-02-20 11:38:08 +00:00
bandesz
b148a0a6a0 Add awslogs logging for PaaS 2017-02-16 14:19:37 +00:00
bandesz
ddf657fa2b Add Jenkinsfile for PaaS deployment 2017-02-01 15:44:10 +00:00
bandesz
ed17b68330 Jenkinsfile: retry functional tests 2017-01-17 11:44:42 +00:00
bandesz
536d9a975d Don't build wheelhouse files for PAAS 2017-01-17 11:44:42 +00:00
bandesz
7eab0f411f Run Docker container with host user and group 2017-01-17 11:44:42 +00:00
bandesz
54af97767f Add quotes around Docker volume definitions 2017-01-17 11:44:42 +00:00
bandesz
10950bb8a6 Run on Paas 2017-01-17 11:44:42 +00:00
bandesz
d523ccf0d6 Fix typo: procecces -> processes 2017-01-16 17:51:46 +00:00