-
Notifications
You must be signed in to change notification settings - Fork 31
Making web app Cloud Foundry-ready and creating deploy script #63
Conversation
@@ -3,3 +3,7 @@ applications: | |||
- name: fec-web | |||
host: fec | |||
buildpack: python_buildpack | |||
env: | |||
FEC_WEB_DEBUG: True | |||
FEC_WEB_API_URL: 'http://fec-api-dev.cf.18f.us/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need input: should the deploy script change the API URL to match the app we're deploying?
If so, it should default to the production API. It should also change the debug setting to true only if we're on dev.
If not, how should this be managed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense to me for the deploy script to set the DEBUG
and apis based on the second parameter (assuming you have enough information from "fec-web-dev" to convert to "fec-api-dev" etc.).
I see two ways to do this.
- Leave the manifest without these env vars,
cf push
thencf set-env
and restart the app - Instead of
cf push
ing with this manifest, do something like:
cp manifest.yml /tmp/
echo "env:" >> /tmp/manifest.yml
echo " FEC_WEB_DEBUG: Some Determined Value" >> /tmp/manifest.yml
echo " FEC_WEB_API_URL: Some Other Value" >> /tmp/manifest.yml
cf push "$2" -f /tmp/manifest.yml
There might also be a way to set env vars at push
time, but I didn't see one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't think of using set-env
. I will experiment with this.
Makes sense to me. |
@LindsayYoung and @arowla also 👍'd |
Making web app Cloud Foundry-ready and creating deploy script
So that you don't break your local, you will need to define the HTTP username and password as environment vars
FEC_WEB_USERNAME
andFEC_WEB_PASSWORD
. Locally, you can set these to whatever you want.local_config.py is no longer needed or supported. Set environment variables if necessary for debug, api location, port and host. You don't need to, though, because the app sets defaults.
Defaults:
debug = False
api_location = http://localhost:5000
host = 0.0.0.0
port = 3000
username and password that should be used for deploy are the ones currently used for the staging site.
Environment vars (app var = environment var):
port = VCAP_APP_PORT
debug = FEC_WEB_DEBUG
api_location = FEC_WEB_API_URL
host = FEC_WEB_HOST
username = FEC_WEB_USERNAME
password = FEC_WEB_PASSWORD
If you want to deploy to Cloud Foundry, use
deploy.sh
, which builds JS and pushes to CF. It takes four args: CF space, CF app, HTTP auth username and password.Notes: