Skip to content
This repository has been archived by the owner on Dec 23, 2017. It is now read-only.

Making web app Cloud Foundry-ready and creating deploy script #63

Merged
merged 11 commits into from
Mar 19, 2015

Conversation

theresaanna
Copy link
Contributor

So that you don't break your local, you will need to define the HTTP username and password as environment vars FEC_WEB_USERNAME and FEC_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:

  • I'm not happy with the debug var handling, but its the best I could come up with given that CF can only receive a string, not a boolean value.
  • I know the default clause in setting the API location in the deploy script will cause the API requests to be unsuccessful. I think this is ok for now until we actually have a prod API. These are the only boxes we're deploying to.

@@ -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/'
Copy link
Contributor Author

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?

Copy link
Contributor

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.

  1. Leave the manifest without these env vars, cf push then cf set-env and restart the app
  2. Instead of cf pushing 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.

Copy link
Contributor Author

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.

@cmc333333
Copy link
Contributor

Makes sense to me.

@cmc333333
Copy link
Contributor

@LindsayYoung and @arowla also 👍'd

cmc333333 added a commit that referenced this pull request Mar 19, 2015
Making web app Cloud Foundry-ready and creating deploy script
@cmc333333 cmc333333 merged commit 6f0c068 into master Mar 19, 2015
@theresaanna theresaanna deleted the cf-config branch March 19, 2015 17:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants