-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make deployment on cloud.gov easy #1
base: main
Are you sure you want to change the base?
Conversation
Where we're stuck: As of now we think we have set all the requisite variables for the frontend and variables for the backend correctly, and the backend status is reporting
🤔🤔🤔 |
5cff7d9
to
41cce00
Compare
41cce00
to
2a04d3d
Compare
Just redeployed after rebasing to main, and we got a better error message:
|
(I'm tearing that instance down now since the route was published and I don't want people monkeying with it while we work.) |
Current status: I am redirected to the login page, but when I try to log in with the default creds I'm told I have an invalid token... but! this is progress!
|
Current status: We were having trouble successfully logging in. I bought that back to the SpiffWorkflow Discord and they reproduced the problems we were having locally on a path-based setup. They made a fix and better documented how to host the API on a subdomain upstream. I think Cloud Foundry does the proxying/path removal as they expect, so we should be good there. We need to rebase our tree and generate a new image to see if their changes resolved the problem we're seeing! |
4120182
to
2e78298
Compare
|
Looks like I was wrong; CF doesn't strip the path element from requests delivered to an app that's on a subpath of a route. |
We should be able to strip the path from the request via judicious application of nginx to implement a proxy. Three options for that spring to mind:
Having written these out, I think that the third option is the most straightforward in terms of solving the specific problem we have right now without introducing unknowns into the |
There's an upstream PR just now:
We should see what happens with it! |
|
2e78298
to
bef2118
Compare
The upstream change was still generating bad URLs. I've got a PR in flight that should fix this sub-path case. I merged that branch into this branch so I can test it with our images, once they're built. |
Now chasing sartography#1350. Image build in progress. |
Thinking now about what I would want to add to this before we present on it... For demo purposes:
For production-readiness:
|
e292811
to
75df1d1
Compare
@asteel-gsa just rebased and force-pushed... Can you confirm this is working for you too? |
I should be clearer... It works for me to login, but I'm still getting tons of 502s and non-functional pages. Are you also able to at least login? |
This was an OOM situation... The frontend and backend need more than the 256M each we'd given them, and while cloud.gov restarted either of them we'd see blank pages and errors in the Chrome Inspector console. Now they're at 512M each (still small enough to deploy in a cloud.gov sandbox account) and everything seems to be working. |
I am only able to access |
Figured out what needed to be done |
Figured out how to get the process-models "examples" to show up.. inside
Which, seems to have worked to drop the git fork we wanted into I did however need to Not entirely sure why directly calling this script wont work? It seems executable in the repo, but has no output at all. Attempted to add it to the command block with no execution. Going to mess around with it, but this is the current blocker for me.
|
Figured it out. (i think). Current stash has the working version, but hasn't been commited, since, for whatever reason @mogul with the latest commits you did, i get a crash loop on attempting to do the connection to the database, though the Stash References: # ignore this stash, i was testing something, but of course, as I pushed and was about to wait for a build on the backend, this was unnessary
- # git init "${SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR}"
+ git init "${SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR}"
git config --global --add safe.directory "${SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR}"
- SPIFFWORKFLOW_BACKEND_GIT_USERNAME = "sartography-automated-committer"
- SPIFFWORKFLOW_BACKEND_GIT_USER_EMAIL = f"{SPIFFWORKFLOW_BACKEND_GIT_USERNAME}@users.noreply.github.com"
+ SPIFFWORKFLOW_BACKEND_GIT_USERNAME = environ.get(
"SPIFFWORKFLOW_BACKEND_GIT_USERNAME",
default="sartography-automated-committer")
+ SPIFFWORKFLOW_BACKEND_GIT_USER_EMAIL = environ.get(
"SPIFFWORKFLOW_BACKEND_GIT_USER_EMAIL",
default=f"{SPIFFWORKFLOW_BACKEND_GIT_USERNAME}@users.noreply.github.com"
)
command: |
# Get the postgres URI from the service binding. (SQL Alchemy insists on "postgresql://".🙄)
export SPIFFWORKFLOW_BACKEND_DATABASE_URI=$( echo $VCAP_SERVICES | jq -r '.["aws-rds"][].credentials.uri' | sed -e s/postgres/postgresql/ )
# export SPIFFWORKFLOW_BACKEND_DATABASE_URI=$( echo $VCAP_SERVICES | jq -r '.["aws-rds"][].credentials.uri' | sed -e s/postgres/postgresql/ )
/app/bin/clone_process_models
/app/bin/boot_server_in_docker
# VCAP_SERVICES
SPIFFWORKFLOW_BACKEND_DATABASE_URI: "sqlite:///db.sqlite3"
# Rearrange later
# https://github.com/sartography/spiff-arena/blob/293aa867a1cef056c5bee3ef037be31047fdc49e/spiffworkflow-backend/src/spiffworkflow_backend/config/default.py#L157-L179
SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL: ((git-process-models))
SPIFFWORKFLOW_BACKEND_GIT_USERNAME: "asteel-gsa"
SPIFFWORKFLOW_BACKEND_GIT_USER_EMAIL: "[email protected]"
SPIFFWORKFLOW_BACKEND_GIT_COMMIT_ON_SAVE: "true"
SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH: "main"
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR: "/app/process_models"
SPIFFWORKFLOW_BACKEND_GIT_SSH_PRIVATE_KEY: "/tmp/ssh_private_key.XXXXXX"
# https://github.com/sartography/spiff-arena/blob/main/spiffworkflow-backend/bin/clone_process_models
# https://github.com/sartography/spiff-arena/blob/main/spiffworkflow-backend/bin/find_sample_process_models
SPIFFWORKFLOW_BACKEND_DATABASE_TYPE: "sqlite"
# SPIFFWORKFLOW_BACKEND_DATABASE_TYPE: "postgres"
git-process-models: https://github.com/gsa-tts/gsa-process-models.git Live Link: Here Ill keep the stash until we figure out the postgres issue, then commit it up, but adding the code for reference for what needed to be done @mogul |
We're not tackling how to parse postgres service details out of VCAP_SERVICES just yet, sticking with sqlite for now.
* Rename stuff to be clearer that the "slug" isn't random * Include the slug in the app name to facilitate parallel deployments in the same space. * Default to 1 image, so you can fit two deployments in a 1G sandbox space
This is asking for the URL to the frontend that the backend should use, not vice-versa!
Enough to function properly, but still fits in a sandbox account
Use the bound Postgres service instead of SQLite
- Process model examples are shown - Process model edits are commited to repo - Process model publishing works
We want to make it obvious that this variable is only for the backend app
We needed to * add a network policy to enable the backend to hit the internal route * add the Cloud Foundry-provided CA cert bundle to the Docker container at startup time * ensure Python picks up added CA certs
We don't want any app to fail to start up the first time someone pushes this manifest. So we start with the connector, then the backend, then the frontend. Upstream improvement: loop when there are errors like this
4c0bbe2
to
1a93e3f
Compare
In order to justify more spike stories (and win over skeptics on diagram-as-config among government Python coders), a portfolio architect (me) demonstrate a fast, compliant path to production for spiff-arena by deploying and demoing it on the cloud.gov PaaS.
Acceptance Criteria
AND I have cloned this repository
WHEN I copy
vars.yml-template
tovars.yml
AND I replace
slug
with a custom valueAND I run
cf push --vars-file vars.yml
AND I open the URL
https://spiffworkflow[[slug]].app.cloud.gov
THEN I see the SpiffWorkflow login screen
For demo purposes:
For production-readiness: