Skip to content
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

Port from SQLite to Mongodb for cache layer #81

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

robholland
Copy link
Collaborator

What was changed

Remove on-disk SQLite storage for API layer with MongoDB.

Why?

This is a more realistic deployment scenario.

Checklist

  1. Closes

  2. How was this tested:

  1. Any docs updates needed?
    Docs will need to be updated.

Copy link
Collaborator

@tomwheeler tomwheeler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. SUCCESS: I am able to run it locally with the changes exactly as I did before those changes, so the smooth out-of-the-box developer experience remains unchanged.

  2. FAIL: The make test target no longer works correctly (on rh-mongodb branch; it works fine on main) :

go test ./app/{billing,order,shipment}
ok  	github.com/temporalio/reference-app-orders-go/app/billing	0.742s
ok  	github.com/temporalio/reference-app-orders-go/app/order	0.764s
ok  	github.com/temporalio/reference-app-orders-go/app/shipment	1.032s
go test ./app/test
package github.com/temporalio/reference-app-orders-go/app/test: build constraints exclude all Go files in /Users/twheeler/temp/rob-mongodb-pr/reference-app-orders-go/app/test
make: *** [functional-test] Error 1

FWIW, the functional test worked fine when I ran it explicitly with go test ./app/test/order_test.go.

  1. SUCCESS: I successfully used MongoDB for the application cache when running locally. I prefixed the command used to start the Worker and API servers with MONGO_URL=mongodb://127.0.0.1:27017 (the MongoDB service was already running). The application started up and worked as expected when I processed an order. I then used mongosh to verify that there was an orders database containing the orders and shipments tables. I checked their contents and they matched what was shown in the Web UI, further confirming that this database was in use. There was no api-store.db file present, as there had been when I ran it without setting the MONGO_URL environment variable.

  2. FAIL?: I successfully deployed the application to a Kubernetes cluster and was able to process an order to completion. However, I got a shell on the MongoDB container, then launched mongosh, but did not find an orders database. I could not get a shell on the OMS API container (it seems that neither Bash nor Bourne shell is installed!), so I could not confirm whether it was using SQLite. I don't see where the MONGO_URL variable is set in the k8s configuration, but since the MongoDB container was running, I would have expected that would be the default for a Kubernetes deployment.

NOTE: The technical description and Kubernetes deployment documentation will both need to be updated to reflect this change. I can take care of that part.

@tomwheeler
Copy link
Collaborator

@cretz I'd like to get your review on Rob's PR, particularly for the bson config in the data structure (a leak from MongoDB into the application). Does that cause you concern, and if so, can you suggest a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants