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

Use Firebase for future features #33

Open
Anexon opened this issue May 13, 2020 · 9 comments
Open

Use Firebase for future features #33

Anexon opened this issue May 13, 2020 · 9 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@Anexon
Copy link

Anexon commented May 13, 2020

I guess you have already considered but I think that community.json and communities logos may be moved to a more dynamic place such as database or to firebase even, so it can be modified without any project updates.

In addition, it could be used to develop a simple API service to allow Angular Community Managers to claim the control of their information so they can update it when necessary, as you do on Google My Business. Also, it can be used for getting new communities applications that only need to be reviewed and accepted, without any repository changes.

This may seems quite ambitious, but at the very first step would be only moving the data to a more dynamic place and init the connection to the database so many other features may be proposed around this capability in the future; login, subscribing, notifying events, getting sponsor offers, etc...

In specifics, I would update CommunityService so it retrieves the information from a firebase project or any other database that may be proposed. However, a firebase account with limited access should be created and the data structure instantiated with the current data in communities.json.

I don't know if this is out of scope, what do you think?
I would be happy to help by doing this feature or helping on creating the Firebase project or considering other options as well!

@NyaGarcia
Copy link
Member

Sounds good, we were actually considering using Firebase, since there's a couple of new features that we were thinking about adding, that would have to make use of DB.

However, adding a database makes us face the issue of authentication. Have you considered this? Because right now, new communities are added by PR, and Github takes care of authentication. Nevertheless, if we use a Firebase project with a DB to store the communities data, we'd have to handle it ourselves. I've never created a Firebase project before, so I have no idea of what it has to offer regarding authentication. Any suggestions?

@Anexon
Copy link
Author

Anexon commented May 17, 2020

Firebase has a great amount of authentication features, in fact you may still use Github account to log in.
Alternatives would be using a DB maybe MySQL hosted on a server. That would required developing an OAuth and APIRest or configuring a firewall by IP so you can have control of who can access to the data base and with which privileges.

Using firebase you may set some basic rules about writing and reading capabilities for some known users (administrators for instance) or that only if you own certain data you are allow to modify it without writing any API.
A part from that, Firebase is a non-relational DB that would bring enough flexibility for start a new database and change it over time "without taking care of" heavy migrations.

However, firebase offers a free service until you cross a number of queries per month. It is a generous threshold though.

I've created a couple of projects based on a firebase database using firestore, however it implies creating an account that will own the project and I don't know how are you handling this at the moment. I would be happy to have a videochat with you guys and see what would it implies and what other options you were considering so may just discard this option or plan it better as it has an important organizational first step.

@moi-j
Copy link

moi-j commented May 17, 2020

Hi all. In case you think about firestore take into account that if in near future you plan to add more features related to geolocation could be helpfull to use a mongodb database instead as it has a lot of good methods for querying geodata.

@Caballerog
Copy link
Member

Hi everybody,

I speak with @Anexon who started a first prototype using Firebase to move the json to the database and he'll create a basic authentication using https://github.com/angular/angularfire (official package).

I think that in the next step, we can build a minimalist backend wich will be use MongoDB as @mjimenezmartin said. We want to develop interesting features using the map because this will be the heart component in this proyect.

Thanks for your time! :-)

Anexon pushed a commit to Anexon/angular-communities that referenced this issue May 22, 2020
…-firebase script

In order to achieve this, a google storage bucket has been created and set it as public
so any document can be accessed anonymously from a public URL. This can be done through
the google cloud console by adding 'allUsers' with reader role to the IAM control.

In the next steps community service would privide images with update url instead of
getting it from local files.

Related issue: voidcosmos#33
@Anexon
Copy link
Author

Anexon commented May 22, 2020

Hi there!

I got some news. Here you may find a working example of using firebase to retrieve communities and images.

I included a script that replicates the current communities.json local file to firebase and upload all generate images in pre-deploy process to google storage.

Before ng serve

Before to get it working you will need to create a new project using firestore on firebase, get the credentials and put them in the mentioned script file (see package.json) and in environment.ts file.

Also you will need to go to Google Cloud Console and make the bucket public so anyone can access to the images.

Now you can execute the script to replicate the content to firebase. Remember to generate images first!

Conclusion

It may seems a little bit tricky to get all of this working but it is only firebase configuration. We may use an "official" account and I would left it configured and running and I would document the process just in case.

If you want to try it by your self first, please let me know if you get stucked in some of the processes of creating firebase elements.

@Caballerog Caballerog added the enhancement New feature or request label May 22, 2020
@Caballerog Caballerog added this to the 1.0 milestone May 22, 2020
Anexon pushed a commit to Anexon/angular-communities that referenced this issue May 23, 2020
@Anexon
Copy link
Author

Anexon commented May 24, 2020

Hi everyone!

Here you may get a working example of the web as official credentials are set for the default environment.
Credentials are public as they are needed for the app to get proper reference to firebase and read content from there, there is "no risk" (better explained here).

I set reading permissions to anonymous requests and writing permissions to admin users that are set manually. So anybody is able to edit the database but the admins and this is the key point, we should decide how would be the adding community procedure as it would not be possible by editing the json file anymore.
I would recommend using google forms to get add-communities requests and let some of the admin to update the database using a custom script that I included in the project.

From this point, I would plan a bunch of new features that may be needed to give control to community managers to update their info without editing original repository, all by accessing an user area and so many other features!

Let me know what you think

@Caballerog
Copy link
Member

Hi @Anexon !

I have started to raise new issues that could be interesting features in which we need a Firebase store like the one you have raised.

The point is that I think this PR could be integrated when we have a form in angular-communities that allows sending new communities to anyone. What do you think of that?

I would like the community to be able to supply their community information at all times and not to place the burden on the administrators of Angular-Communities.

So what do you think if we develop your issue and proposal as a slightly richer PR in which we will integrate the following features:

  • New community submission form
  • Notifications to administrators to check that the community information is correct (and you only have to accept it).

Later, I think that with this feature we could open new ones like the ones I have proposed:

  • Organizers login and edition.
  • Record event information from the meetup API.
  • Any great idea we can think of.

What do you think if we get down to work creating a PR in which we integrate the basic functionalities that I have described and work on it to be able to create something of greater value without losing what we have now?

A greeting!

@tonivj5 @NyaGarcia

@Anexon
Copy link
Author

Anexon commented Jun 25, 2020

Hey @tonivj5 and @NyaGarcia ,
I think is a great idea. Let's break milestone into smaller pieces.
I'll try to attach myself to some of those new issues you just created so we may get to a functional point as soon as possible :D

@tonivj5
Copy link
Member

tonivj5 commented Jun 25, 2020

Yeah, we should break it 👍 I love the idea to level up communities! Thanks @Anexon for your involvement on this, #55 is a good start. I like some functionalities that firebase can offer us.

I think we should follow using community.json to add communities like we have done until now meanwhile we implement new features around firebase and get more confident with it. We could add a new github action to perform the inserting into firebase, and reduce too the amount of deployments we're doing on each commit 👀

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

No branches or pull requests

5 participants