Skip to content

Docs for how to use S3 over GridStore? #307

Closed

Description

@gateway

I see in the depo s3 adaptor but no real docs on how to set this up to work. I know their is a FilesAdapter.js, do I just change these lines.

var GridStoreAdapter = require('./GridStoreAdapter');

var adapter = GridStoreAdapter;

to

var S3Adapter = require('./S3Adapter');

var adapter = S3Adapter;

Then looking at the S3Adaptor code I see various keys that need to be set?

Could we just get a small writeup on this? Also will their be an option on data migration to move files to a s3 bucket instead?

Activity

  1. oclef commented on Feb 9, 2016

    @oclef

    You can set the FilesAdapter to use S3Adapter when you initialize the ParseServer like this

    var api = new ParseServer({
      databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
      cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
      appId: process.env.APP_ID || 'myAppId',
      masterKey: process.env.MASTER_KEY || 'myMasterKey',
      clientKey: process.env.CLIENT_KEY || 'myClientKey',
      restAPIKEY: process.env.RESTAPI_KEY || 'myRestKey',
      fileKey: process.env.FILE_KEY || 'myFileKey',
      filesAdapter: new S3Adapter(
        process.env.AWS_ACCESS_KEY,
        process.env.AWS_SECRET_ACCESS_KEY,
        {bucket: process.env.AWS_BUCKET_NAME, bucketPrefix: "", directAccess: true}
      ),
      pushAdapter: new SNSAdapter(
        process.env.AWS_ACCESS_KEY,
        process.env.AWS_SECRET_ACCESS_KEY,
        {region: "us-east-1"}
      )
    });
  2. gateway commented on Feb 9, 2016

    @gateway
    Author

    @oclef thanks, have you tested it and do pffile saves go to s3 and a reference url goes in the database?

  3. oclef commented on Feb 9, 2016

    @oclef

    Yes, I've tested. files goes to s3 and reference goes to mongo

  4. gateway commented on Feb 9, 2016

    @gateway
    Author

    @oclef thanks, I feel a bit stoopid right now maybe its due to me coding all way and switching between js, php and python but where do I put my aws keys in.. ?

    Also I just saw this when trying to deploy the latest parse example..

    2016-02-09T01:36:19.232819+00:00 app[web.1]: > [email protected] start /app
    2016-02-09T01:36:19.232821+00:00 app[web.1]: > node index.js
    2016-02-09T01:36:19.232822+00:00 app[web.1]: 
    2016-02-09T01:36:20.517814+00:00 app[web.1]: /app/index.js:21
    2016-02-09T01:36:20.517819+00:00 app[web.1]:   filesAdapter: new S3Adapter(
    2016-02-09T01:36:20.517820+00:00 app[web.1]:                     ^
    2016-02-09T01:36:20.517821+00:00 app[web.1]: 
    2016-02-09T01:36:20.517823+00:00 app[web.1]:     at Object.<anonymous> (/app/index.js:21:21)
    2016-02-09T01:36:20.517822+00:00 app[web.1]: ReferenceError: S3Adapter is not defined
    2016-02-09T01:36:20.537757+00:00 app[web.1]: npm ERR! Linux 3.13.0-71-generic
    2016-02-09T01:36:20.517823+00:00 app[web.1]:     at Module._compile (module.js:413:34)
    2016-02-09T01:36:20.517824+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:422:10)
    2016-02-09T01:36:20.517825+00:00 app[web.1]:     at Module.load (module.js:357:32)
    2016-02-09T01:36:20.517826+00:00 app[web.1]:     at Function.Module._load (module.js:314:12)
    2016-02-09T01:36:20.517826+00:00 app[web.1]:     at Function.Module.runMain (module.js:447:10)
    2016-02-09T01:36:20.517827+00:00 app[web.1]:     at startup (node.js:139:18)
    
  5. gnz00 commented on Feb 9, 2016

    @gnz00

    @gateway You need to import the S3Adapter.

    var S3Adapter = require('parse-server').S3Adapter;
    var ParseServer = require('parse-server').ParseServer;
    ...
    filesAdapter: new S3Adapter({
        /** options **/
    });
    ...
  6. oclef commented on Feb 18, 2016

    @oclef

    An adapter I wrote to use AWS SNS as the push server. I've since setup my
    own push server so I don't use it anymore. You can find it here

    https://github.com/oclef/parseServer

    Cheers,
    Phong Le

    On Thu, Feb 18, 2016 at 3:45 AM, Michael Bina [email protected]
    wrote:

    @oclef https://github.com/oclef What is SNSAdapter and where can I find
    it?

    —
    Reply to this email directly or view it on GitHub
    #307 (comment)
    .

    Predestination was doomed from the start.

  7. michaelbina commented on Feb 18, 2016

    @michaelbina

    @oclef Looks useful. Did you consider making a pull request? I haven't tried to incorporate ParsePushAdapter which I just looked into, but this looks easier.

  8. oclef commented on Feb 18, 2016

    @oclef

    Actually, this is what you will want to use

    https://github.com/oclef/parse-server/tree/f2c6cc829927e084fb0a695c30ab701f1c923860

    On Thu, Feb 18, 2016 at 3:45 AM, Michael Bina [email protected]
    wrote:

    @oclef https://github.com/oclef What is SNSAdapter and where can I find
    it?

    —
    Reply to this email directly or view it on GitHub
    #307 (comment)
    .

    Predestination was doomed from the start.

  9. michaelbina commented on Feb 18, 2016

    @michaelbina

    Looks like it was forked a bit behind 2.0.8 so it's gonna take some merging.

  10. oclef commented on Feb 18, 2016

    @oclef

    It worked, but it doesn't really conform with the architecture. TBH, it's better to just setup your own push server using the latest release.

  11. gfosco commented on Feb 20, 2016

    @gfosco
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions