Closed konklone closed 9 years ago
@dlapiduz pointed me to this: https://github.com/yuvadm/heroku-periodical
Which can be run as a separate app in the same space to handle scheduled tasks. I haven't tried it out yet but I will be when I re-deploy Discovery into CF.
There should probably be some tests associated with this pull request.
OK, I think this one is merge-ready.
Can I get a merge :hammer:?
This does a few things!
Deploying the app with a script instead of a Procfile
It changes the deploy command to use a script,
cf.sh
, instead of theProcfile
. I modeledcf.sh
on @kaitlin'sinitdb.sh
script for Hourglass. The launch command for the app is now:Personally, I find that janky and un-ideal. But Cloud Foundry doesn't have real task running support like Heroku does (
heroku run
). This is simpler in some ways, though, since if we were to use acf run
-like command, we'd have to make some kind of script to run that for us after deploys. This faces that head-on and has Cloud Foundry do the script-running for us.Loading script now clones the data itself
The
load_agency_contacts
script now defaults to cloning the data fromhttps://github.com/18f/foia.git
into a directory namedtemp-data
in the project root, and loads in the YAMLs from there. The repo location is defined in source control, in the base settings file.If the
temp-data
directory is already there, it will be deleted first and replaced clean. (Nogit pull
.)temp-data
has been ignored in.gitignore
and.cfignore
.I tested this out by temporarily deploying a version of the app that pulled from a personal fork of the data, and confirmed that if I changed some values in the
master
branch of the repo, and then deployed the app, the new version of the app displayed the changes correctly:We have to live without requirements-prod.txt
Without modifications to the Cloud Foundry buildpack we use, we have to merge
requirements-prod.txt
back intorequirements.txt
, which this PR does. CF is currently configured to only install things inrequirements.txt
, and so we were having busted deploys whenwaitress
couldn't be found, and so the app didn't even get a chance to properly start.There's a secondary issue, which is that when deploying in that situation, the logs were very uninformative. That's been triaged and reported to DevOps, and it's in their non-blocker sprint candidates.
Further work
One more note: in our previous system, when we deployed new data, we assumed it would make its way onto the site before much longer. Now, no contact data updates will appear on the site without a deploy. However, I would argue that the new configuration is better than the previous way, because it ensures that migrations will always be run just prior to data loading.
Fixes #511.