-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Yet Another FileAdapter: Google Cloud Storage #708
Yet Another FileAdapter: Google Cloud Storage #708
Conversation
@mcdonamp updated the pull request. |
Still plagued by the flaky Geopoint test in #572 , but other tests will work. Also, if people are annoyed by the fact that the tests still show up (and are just listed as pending), I thought of two quick solutions:
Either solution here allows us to get rid of 3e41a21 since the tests wouldn't be run unless a developer explicitly wanted to run it. Also, I'd love to be able to contribute to the Wiki to clean up some of the Files docs: basically just add a section for each provider, as well as an overview of what's going on. What's the best way to contribute back to the Wiki (given how PRs against it aren't straightforward)? |
@mcdonamp we were discussing @nlutsenko test factories for those adapter. Those factories would allow you to keep the adapter on your repo, and use travis with your encrypted keys. this way we'll ensure the compatibility with parse-server without burdening the core repository with zillions of implementations. What do you think? |
@mcdonamp Hey - parse newbie talking. What does this mean? I deployed parse server to google app engine using mongolab. Does that mean I can use google datastore as an alternative to mongolab using this adapter? Preferably, I'd like to do that to keep all my backend activity within a single platform. |
@otymartin it means you can use Google Cloud Storage, to store and serve the PFFiles instead of the default GridFS or Amazon S3. For Now, you cant use GCP NoSQL database engine as some more changes are required to this project. |
@otymartin @flovilmart beat me to the punch by seconds! As he said, this means that you can store your Parse Files (user generated content like images, videos, audio, etc.) in Google Cloud Storage, Google's Petabyte static storage system. This is distinct from something like Cloud Datastore, which is Google's Hosted NoSQL offering. Currently Parse Server is very mongo specific and making it fully database agnostic is going to take a lot of time, though #698 is a good step in that direction. |
@flovilmart totally agree with this idea, though I've got some concerns that it'll raise the barrier to entry for creating such extensions, especially for new devs. Maybe creating a Parse Server Extension repo with a template (basically the What can I do to help this move forward? Some potential AIs I see here are:
FWIW, if folks don't care about running their own, I'd probably be OK owning a var S3Adapter = require('parse-server-file-extensions').S3Adapter(config);
var AzureBlobAdapter = require('parse-server-file-extensions').AzureBlobAdapter(config);
var GCSAdapter = require('parse-server-file-extensions').GCSAdapter(config); This might also make config a little easier, since we could try to offer a single shared config file for all these (though TBH, not sure why anyone would be using multiple file storage providers). |
We're having pretty intense discussions around that. My main concern is testability and stability. I'm refactoring the FIlesController tests now into a factory, and I uncovered 3 major issues with S3Adapter as it's completely untested. The test factories are design to be easy to use:
|
Cool--I figured, as I'm sure it's a contentious issue. Happy to weigh in if you'd like another opinion; otherwise, happy to stay out as I'm sure there are already plenty of folks more knowledgeable than me working to solve it. I found a few issues with mine that were teased out in testing, so luckily I fixed them before they saw the light of day. I thought about switching off the presence of env variables as an option as well, not sure why I didn't put it down... I'm a fan of this strategy, as well as of splitting these tests (and the adapters) out into a separate repo. Not sure if the best strategy is to merge all of these adapters in and then cut them all out at the same time and provide a major version bump, or just herd cats to pull the appropriate PRs somewhere else. Either way, let me know what you need in the way of help this moving forward! |
@flovilmart I assume we're waiting on #718 to align these and then merge? I'm happy to open an issue on the topic of File Adapter refactoring, potentially to a separate repo, if that will provide a place for us to consolidate our thoughts and gather broader community feedback. |
@mcdonamp waiting for #738 as it has just the test factories for the FileAdapters. I managed to get the testing going for external adapter for the push adapter in https://github.com/flovilmart/parse-server-urban-airship. That involves a submodule and weird stuff. The debate is open on the question of whether we should add those adapters in the core repo or not :) |
…into mcdonald-gcs-adapter Get GCSAdapter up to snuff with FilesController + FilesControllerTestFactory * 'master' of https://github.com/ParsePlatform/parse-server: (102 commits) Remove duplicated instructions Release and Changelog for 2.1.4 fixes missing coverage with sh script Fix update system schema Adds optional COVERAGE Allows to pass no where in $select clause Sanitize objectId in Fix delete schema when actual collection does not exist Fix replace query overwrite the existing query object. Fix create system class with relation/pointer Use throws syntax for errors in SchemasRouter. Completely migrate SchemasRouter to new MongoCollection API. Add tests that verify installationId in Cloud Code triggers. Propagate installationId in all Cloud Code triggers. Add test expiresAt should be a Date, not a string. Fixes #776 Fix missing 'let/var' in OneSignalPushAdapter.spec. Don't run any afterSave hooks if none are registered. Fix : remove query count limit Flatten custom operations in request.object in afterSave hooks. ...
@mcdonamp updated the pull request. |
@flovilmart ok, got this back in line with the other adapters and the new stuff in Also, of note: I chose not to implement |
@mcdonamp updated the pull request. |
@mcdonamp no problem! You need a rebase and I believe we're good to go! |
Ok, I think I may update to what's in #833 to get the proper loading from the environment, then I'll run another quick set of tests and get it in. |
…into mcdonald-gcs-adapter * 'master' of https://github.com/ParsePlatform/parse-server: Remove limit when counting results. beforeSave changes should propagate to the response Fix delete relation field when _Join collection not exist Test empty authData block on login for #413 Fix for related query on non-existing column Fix Markdown format: make checkboxes visible Fix create wrong _Session for Facebook login Modified the npm dev script to support Windows Improves tests, ensure unicity of roleIds Fix reversed roles lookup Fix leak warnings in tests, use mongodb-runner from node_modules Improves documentation, add loading tests Improves loading of Push Adapter, fix loading of S3Adapter Adds public_html and views for packaging Removes shebang for windows Better support for windows builds Fix add field to system schema Convert Schema.js to ES6 class.
@mcdonamp updated the pull request. |
Current coverage is
|
@mcdonamp updated the pull request. |
…ET from GCS_BUCKET_NAME
@mcdonamp updated the pull request. |
@flovilmart ok, this should be good to go. Lots of whitespace changes (looks like my sublime config likes that ;) Also updated the README for both, and all tests are passing. Thanks for all the hard work and guidance here. I'm also happy to help the folks working on #545 and #716 if they need to know next steps. |
@@ -149,6 +154,19 @@ S3_DIRECT_ACCESS | |||
|
|||
``` | |||
|
|||
###### Configuring `GCSAdapter` |
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.
Great you added those too!
Yet Another FileAdapter: Google Cloud Storage
Tossing my hat in the ring for building another FileAdapter, this time GCSAdapter.js for integrating Google Cloud Storage
Like all the other file adapters, you can create one like so:
Re: #545 I'm happy to wait on a redesign if that's where we're going. Agree that it's a bit hard to handle these currently, and the dependencies on AWS, Azure, and GCP Node modules is getting a little ridiculous...
On the subject of unit tests--I went ahead and modified helpers.js locally to point to GCS and tested these locally, with 21/21 passing. I also created and added a ParseFile+GCS.spec.js, which contains tests for Parse Server proxied files as well as public readable files. Note that these tests require a GCP Project, keyfile, and GCS Bucket.
I'm putting some thought into mocking out the various providers to avoid all the issues with having sets of keys for each service, as I'm sure the team doesn't want to maintain a bunch of various keys to various cloud platforms. I also have some thoughts on creating cloud provider config settings to encapsulate the AWS, Azure, GCP, etc. keys that I'd be happy to talk to someone about.