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

Create new apps using dashboard #188

Closed
khafagy opened this issue Mar 27, 2016 · 44 comments
Closed

Create new apps using dashboard #188

khafagy opened this issue Mar 27, 2016 · 44 comments

Comments

@khafagy
Copy link

khafagy commented Mar 27, 2016

I was using Parse.com to host about 7 or 8 apps and I was creating new app every 2 weeks,
I was using it mainly to send push notification as it's very easy to integrate,
And like a lot of app developers I don't have experience to deal with "Node, MongoDB, ..." ,
So it will be very useful if you can add the ability to:

  1. Create new applications using parse-dashboard.
  2. Auto generate application keys and save it to parse-dashboard database.
  3. Upload Apple push certificates through parse-dashboard.
  4. "Add/configure" GCM key through parse-dashboard.

So we could easily "create apps -> get keys -> integrate -> 'add certificates / GMC' -> Push"

Thanks

@davimacedo
Copy link
Member

You can use a Parse Hosting solution to do it for you. You can find the actual options here:
https://github.com/ParsePlatform/parse-server#parse-server-sample-application

@drew-gross
Copy link
Contributor

Parse Server doesn't support multiple apps on one server, so this is a long way off. One thing we could do is allow you to add apps to your configuration file in a dialog on the dashboard.

@khafagy
Copy link
Author

khafagy commented Mar 28, 2016

I think this will be very useful,
So if I can:

  1. Add apps configuration through dashboard.
  2. Upload Apple push certificates through dashboard.
  3. "Add/configure" GCM key through dashboard.

That will be about 80% of the work that I should do manually now,
And this will be awesome.

@flovilmart
Copy link
Contributor

Upload Apple push certificates through dashboard.
"Add/configure" GCM key through dashboard.

This is not supported in parse-server.

@khafagy
Copy link
Author

khafagy commented Mar 28, 2016

@flovilmart What about that:
https://github.com/ParsePlatform/parse-server/wiki/Push

var server = new ParseServer({ databaseURI: '...', cloud: '...', appId: '...', masterKey: '...', push: { android: { senderId: '...', apiKey: '...' }, ios: { pfx: '/file/path/to/XXX.p12', bundleId: '', production: false } } });

@flovilmart
Copy link
Contributor

That is how to initialize Parseserver, but you can't swap this configuration at runtime based on some configuration from parse-dashboard

@khafagy
Copy link
Author

khafagy commented Mar 28, 2016

What about new instance of parse server,
So instead of creating new apps dashboard should create new instances like:

var app1 = new ParseServer({
  databaseURI: 'mongodb://localhost:27017/app1',
  cloud: '/home/app1/cloud/main.js', // Provide an absolute path
  appId: 'myAppId',
  masterKey: 'mySecretMasterKey',
  fileKey: 'optionalFileKey',
  push: {
      android: {
        senderId: '...',
        apiKey: '...'
      },
      ios: {
        pfx: '/file/path/to/XXX.p12',
        bundleId: '',
        production: false
      }
   }
});

// Serve the Parse API on the /parse URL prefix
app.use('/app1', app1);

var app2 = new ParseServer({
  databaseURI: 'mongodb://localhost:27017/app2',
  cloud: '/home/app2/cloud/main.js', // Provide an absolute path
  appId: 'myAppId',
  masterKey: 'mySecretMasterKey',
  fileKey: 'optionalFileKey',
  push: {
      android: {
        senderId: '...',
        apiKey: '...'
      },
      ios: {
        pfx: '/file/path/to/XXX.p12',
        bundleId: '',
        production: false
      }
   }
});

// Serve the Parse API on the /parse URL prefix
app.use('/app2', app2);

@flovilmart
Copy link
Contributor

That won't work correctly due to the Parse SDK being a singleton.

@khafagy
Copy link
Author

khafagy commented Mar 28, 2016

wow :(
This was to be very useful

@flovilmart
Copy link
Contributor

what do you mean? Multiple apps support could theoretically work, but without Cloud Code. I've worked on it for a while and had a functional proposal, in the end, we decided not to support it.

@khafagy
Copy link
Author

khafagy commented Mar 28, 2016

I mean that me and all developers moved from parse.com hosted solution are looking for an easy GUI to work with,
It's not easy to create parse server for every new app and run the server manually then upload apple certificates to be able to send push notifications,
That scenario might work with single app but what about 10 or 50 apps?

@flovilmart
Copy link
Contributor

you can run it with just a command line tool and a config.json file. It basically takes 10 minutes to configure and deploy heroku.

there is also parse-server/bootstrap.sh that you can run in a clean folder that would build the basic parse-server folder structure.

wget --quiet https://raw.githubusercontent.com/ParsePlatform/parse-server/master/bootstrap.sh && sh bootstrap.sh 

@agilekevin
Copy link

We (Buddy) are thinking of handling this case as well, with some kind of a webhook that ultimately calls our devops code to create the server.

I don't think anybody would want our devops code, but we could certainly submit a PR that does what @drew-gross describes, along with some kind of "create server instance" adapter that accepts the necessary values, and the UI to collect them. Other folks could plug in their own heroku or aws solution.

Would this be welcome?

@flovilmart
Copy link
Contributor

I believe this is really overkill, but that's my take on it.

@drew-gross
Copy link
Contributor

@agilekevin that sounds pretty sweet, I'd happily accept a PR that puts "pluggable app creation" into the dashboard. A nice simple way to do that might be to put the "create new app" webhook URL into the dashboard config, and if the dashboard detects the presence of this URL, it enables the "create new app" button, and sends requests to that URL. There would probably need to be some sort of auth, too, which might be a harder problem. I look forward to seeing what you come up with!

#23 removed the code for the "create new app" button, reverting that PR in your fork would probably be a good starting point.

@davimacedo
Copy link
Member

Hey guys, in my opinion this feature only make sense if in the creation process the user is able to setup all parameters of parse server (databaseURI, cloud, appId, etc...). Otherwise the user will have to change the code anyway and restart the app process. If you think by this same way, I can contribute in this task. I have been writing my own UI to setup these parameters. So I can stop doing it alone and help you (if you think it is a good idea).

@drew-gross
Copy link
Contributor

Yeah that makes sense. For the fully managed parse hosting services, they may only need an app name, since they can generate a master key, app id, and database for you. Cloud code would need it's own process, of course. Maybe the dashboard config can include a list of parameters and their description alongside the webhook, and the dashboard can dynamically create the "create an app" dialog from that list. Maybe I'm dreaming too much though :p any PR that helps companies offering Parse Hosting do a better job, I would accept, as long as it doesn't degrade the experience for people hosting Parse themselves.

@flovilmart
Copy link
Contributor

On parse-server side, it would be fairly easy to load the parse config from a JSON and live reload.

@davimacedo
Copy link
Member

We should create a new project just called Parse (or Parse Proxy, or Parse Manager, or whatever) which would initialy have the responsibility of:

  1. Run a single instance of Parse Dashboard
  2. Run multiple instances of Parse Server
  3. Receive requests from Parse Dashboard to create, delete, update, restart instances of Parse Server
  4. Receive API requests of all Parse Sever instances in a single endpoint and route them to the right Parse Server instance based on App Id.

It would obviously be written in node.js/express.js and installed globally. It would have a script called "parse generate" to create a new parse project and a "parse run" to start this project.

Therefore the developer locally should only do:
npm install -g parse
parse generete myProject
cd myProject
parse run

Then, open the dashboard using a web browser and start visually creating the apps.

You can imagine I have big part of the required code already written. I can remove the pieces there are specific to my case, share it to community and help to turn it real.

What do you think?

@davimacedo
Copy link
Member

@drew-gross @flovilmart ?

@agilekevin
Copy link

Back on the original idea of creating new apps within the UI, here's what I think we're seeing that there are two interests here: folks who want to be able to /specify/ the several values for a server they just set up themselves, and folks (like me) who want a way to call out to some code that /creates/ these values.

For both of these experiences, we have to consider the other operations: The specified values will want for the ability to edit them. And both the specified and created entries will need to be deleted, so there's overlap there.

What I'm thinking is that the first thing that goes into the config file would be the names of React components/apps to use for each of the three operations (possibly none): NewAppDialog, EditAppConfigDialog, and DeleteAppDialog.

The main parse code can display these (if configured) in the right context, but dedicate their operation to the component itself. For example, the NewAppDialog will probably be triggered from the top right, while the Edit and Delete components would appear on each line.

In my create approach, where the creation only needs a name and then calls out to a webhook, I'll specify a component with that simple UI, and it also will have a config value for the webhook to call. Delete will also have a simple UI and a webhook, and I wouldn't specify Edit at all since it doesn't apply.

In the /specify/ approach, the Create dialog will show the more complicated UI, and have perhaps a config value for the file to edit, which is shared by the Edit and Delete components.

If that sounds good, I'll get started on a PR for that.

@drew-gross
Copy link
Contributor

@agilekevin sounds like a good approach, I'd suggest doing them each in a separate PR to keep things nice and isolated.

@felipeandradebezerra
Copy link
Contributor

I'm not sure if I'm following the right direction but I've been working on a new Parse app that has only three classes: Apps, Users and Installation. After some tweaks and with some minor dashboard adaptations I think I will be able to include new apps as simple as adding a new row to the Apps' class.

To create a new app I've done the following steps:

  • Create an empty mongo database
  • Restore this database from a previous dumped app (template)
  • Create keys with a random algorithm

If you are using Amazon:

  • Get the next available port from your Load Balacer
  • Create a listener for the new port on your Load Balancer
  • Update your httpd.conf with a proxy to the port number
  • Restart Apache

My parse server loops a configuration file served from the app above and start each app in a different port number. The downside of this approach is that all apps will be unavailable for a few moments while the apache is restarting, so my next goal is to separate each parse server and have only one api.myserver.com redirecting each request to the right port. In my current environment I've a proxy for each app in my httpd.conf but unfortunately I still have an issue removing rows.

Despite the deadline I've moved 22 apps to a self hosted MongoDB, created automation scripts to backup and restore and replicated the data on a local MongoDB server so we can test our apps in a sandbox mode.

@HamedMP
Copy link

HamedMP commented May 5, 2016

I looked through this long conversation and also searched a lot, but I could find answer to my question:

Is it possible to create new apps using Parse Server/Dashboard?
If not, will there be such feature in near future?

Thanks

@pankaj9492
Copy link

Why is not showing few feature in parse dashboard in local installation?
Can anyone help me regarding this,
I have installed on local everything is working fine but i have not getting create app, analytics etc button

how can i got this thing?

@dv336699
Copy link

dv336699 commented May 13, 2016

@felipemobile approach seems the way to go.
I'm ok to have one parse server per port/process as long as I don't have to create 10 dashboard for 10 servers.

If there is anyone willing to share any code, I'll be glad to help getting it production ready.

@YousefAlsbaihi
Copy link

YousefAlsbaihi commented Jun 20, 2016

i already success doing it after a lot of work 👍

if you haven't done it yet, just let me know i'll explain how to do it 💯

@dv336699
Copy link

@YousefAlsbaihi looks nice. If you could share your repository or rise a PR it would be nice to have a look on how that was implemented.

Thank you

@FreedomKnight
Copy link

Did @YousefAlsbaihi send a PR ?

@rhutchison
Copy link

Was this feature removed when they OS the project?

https://parseplatform.github.io/docs/rest/guide/#apps
https://parseplatform.github.io/docs/rest/guide/#installations

@YousefAlsbaihi or @felipemobile have you made any progress?

@mikegazzaruso
Copy link

Hi, at the moment just creating ONE express (app) listen directive (upon ONE single port) and MULTIPLE ParseServer() DO the work. I'm able to create how many parse apps I want, and I'm able to have them working in my dashboard.

Tell me if you want support for this, please.

Cheers

@flovilmart
Copy link
Contributor

It will fail lamentably with cloud code when you'll have concurrent async requests. So no, it doesn't work...

@mikegazzaruso
Copy link

Oh ok, so there is not a way to host multiple apps on the same server? I mean, am I supposed to use Parse-Server with only one app at maximum? Thanks

@flovilmart
Copy link
Contributor

You can run multiple node processes, on different ports. But no, ATM (and probably for a while), it's dangerous to run multiple apps in the Same process.

@mikegazzaruso
Copy link

mikegazzaruso commented Nov 27, 2016

@flovilmart
first thing first, thanks for your replies.

I think this is a deep limitation, I should bind a separate express.js server (one-per-app) listening on a separate port? On Heroku, furthermore, with Free Plan, having more than 1 Web Dyno is not possible (Ok, it's a sandbox environment, I know.. but.....).

So should I mount, in example:

APP1: Parse Server XXXX running on port WWWW with its own dashboard etc.
APP2: Parse server YYYY running on port ZZZZ with its own dashboard etc.

Would at least one MongoDB server be enough for all apps or should i have a separate instante-per-server?

And, at last. You mentiond cloud issues, due to Singleton nature of Parse Server actually.

But what if I use only GridStore as file adapter? Might I in that case use more apps on same server ?

Thank you so much

@flovilmart
Copy link
Contributor

No, you need process level isolation due to the singleton nature of the JS Sdk. Parseserver iself is fine with multiple app ID's. And we don't explicitly support that feature, as such, I won't go to the extend to describe a way to make it work, as it may break in future updates.

@MatrixSenpai
Copy link

Just saying, I disagree. I run separate apps using PM2, and right now I have two running on the same server. They're created in different directories, as such

/var/www
  ecosystem.js
  app1/
    index.js (Parse config for APP1)
    cloud/
    -> APP1:1337
  app2/
    index.js (Parse config for APP2)
    cloud/
    -> APP2:1338
  dashboard/
    index.js (Config for dashboard)
    -> DASH:1340

@flovilmart
Copy link
Contributor

Yes, that work, because you have process isolation. Each app is running in a separate node process.

@flovilmart
Copy link
Contributor

Again, creating a new app on an existing process won't work correctly, that's why this issue is closed.

If you want to achieve that, you need something to spawn a process for each app, which is what PM2 is doing as it's just a process manager.

@MatrixSenpai
Copy link

So why can't Parse just append a new instance of itself?

@MatrixSenpai
Copy link

MatrixSenpai commented Nov 27, 2016

In other words, cause Parse to spawn a new PM2 process

(Psuedocode)
user create(new app())
Parse generate(keys)
Parse create(dir, name)
  Parse create(index.js)
  Parse write(keys, db connection)
Parse write(pm2 ecosystem.json)
Parse spawn(new pm2())

@flovilmart
Copy link
Contributor

It could, but I don't like being tied to PM2. So it won't. You can very well write this externally, it doesn't have to be done inside parse-server.

@MatrixSenpai
Copy link

Can you suggest how to to do this? I'm not extremely Node/Express savvy

@flovilmart
Copy link
Contributor

Your pseudo code seems to be ok, I believe you can figure it out. You'd probably need to store the configurations somewhere à user can retrieve them etc... the best part is that you can pretty much write that in any language of your choice, as this is just writing some Json as the parse config and reconfigure pm2

douglasmuraoka pushed a commit that referenced this issue Nov 29, 2019
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

No branches or pull requests