Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Loan Laux
    @loan-laux
    @m5ingh The API actually support multi-shop usage out of the box. The docs warn that there’s no full-circle, end-to-end support for marketplaces (as in, the admin UI won’t necessarily have all the features you’d want from a vendor UI, and the example storefront is single-shop only). But these are UIs, and you’re supposed to replace them with your own anyways. As far as the API goes, everything you need should be there.
    Sebastian Franco - Devops Engineer
    @jhonsfran1165
    @m5ingh if you want multi-shop support you also have to take a look at the hydra implementation. If you want to support multiple shops you have to create a hydra client record for each shop you want to connect to the API to grant access to each shop to generate access tokens. That's one of the biggest problems when you are dealing with multi tenant architecture. Also, keep in mind that your tenant ID is the shopId, so you can identify each tenant with that.
    m5ingh
    @m5ingh
    @loan-laux @jhonsfran1165 huge shout out to both of you for all your help. I have a question. As i understand reaction admin is being replaced with admin that will have lego like structure for core, etc. basically replacing meteor parts. does this mean that reaction identity which also has meteor parts are being replaced? i ask this because i want to have clarity if i should do multi shop work on reaction-admin or the upcoming admin alongwith hydra and identity
    Sebastian Franco - Devops Engineer
    @jhonsfran1165
    I'm not sure, maybe @loan-laux has more context about that. What I know is the identity service can get a lot better. Right now is using meteor but in my way of think, if the reaction team is going to create another admin the identity service also has to be replaced. I was thinking to use ORY kratos and ORY keto to create a universal login that allows me to handle permissions and user management cleaner. I know is a little complex but I like to use the ORY ecosystem.
    Loan Laux
    @loan-laux
    @m5ingh I agree with @jhonsfran1165 on all the points here. As far as what’s planned: AFAIK, discussions are happening on a new auth system. No decisions made now, but it’s starting to be discussed.
    B D
    @bayareacoder
    Interesting discussion. We also have a potential need to go to multi-shop from a single Docker deployment i.e. 1 Hydra instance would need to give tokens for multiple storefronts. Right now we have done our own admin integrated with the Firebase custom auth system we use. We developed our own admin with logins integrated with our auth system that uses "Firebase custom token" auth flow for "store owner/manager" accounts. When such a user signs up on our system, we write directly into the reaction MongoDB collection to create the user there as well (not using Hydra). Since the user will be auth with a token from Firebase, we developed reaction api middleware to check the token with Firebase. To ensure compatibility with example-storefront where we use the existing reaction Hydra auth for "shopper" user accounts, we basically add our token from our admin client under another HTTP header. When the middleware detects that header, it will use Firebase for auth check; when it sees the reaction token header it will use the original reaction Hydra check. So how to support multiple shops for a retail chain (assume within same Docker container) that can be controlled from same admin in this case? Seems as simple as making a single reaction user owner of multiple shops, and then creating multiple storefront instances in the Docker container, each with its own subdomain (store1.<domain>, store2.<domain>) or am I missing something? The only issue I see is that shoppers would need to create separate accounts for each shop. Not sure if the current user schema would allow a shopper user account to be associated with multiple shops?
    I guess ours is not a "marketplace" (1 storefront covering multiple shops) but a "single-chain multi-shop" (multiple independent storefronts that are centrally managed) scenario.
    Sebastian Franco - Devops Engineer
    @jhonsfran1165

    @bayareacoder That's exactly the multi tenant architecture. The good thing about RC is that the multi shop support is already done by just doing a couple of things. What I did to accomplish that was to use the shopId as the owner of the data. Meaning the shopId is the Tenant ID.

    One of the biggest problems you probably will face is tenant identification. There are some strategies to do it.

    In the admin you can identify the shop with the account that logs in into the app. There is a key in the Mongo Accounts collection that you can use to handle more than one shop per Account (adminUIShopIds). To do that you have to make some changes in the admin. Switching between shops in the admin can be accomplished by changing the shopId parameter in the URL. This approach is known as a URL-based identification and I think it fits very well in the admin. Also, keep in mind to grant the proper permissions to each account to handle multiple shops. But you can start handling one shop per account and see if that fits your needs.

    So that way you have a single point of administration to all shops.

    On the other hand to identify the storefronts you can use the hydra configuration. As you know, there are a couple of public queries in the API. That means that you don't need a token to fetch the data, so you can use the shopId to get the corresponding data to each shop. You can pass that data through environment variables.

    But if you want to identify user on each storefront you have to send the shopId (Tenant Id) to the identity service and also create a record in hydra service that allows the storefront to create the login_challenge necessary to interact with the login service.

    Before you deploy your storefront you have to add to the .env file those variables OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET. You have to do some changes to the identity service as well to create an account from the storefront in the corresponding shopId.

    But the way, Hydra doesn't create users, just authorize third apps to connect with the login in order to generate access tokens. You don't want unknown apps trying to fetch sensitive data from your API directly.

    Security is very serious in this multitenat approach.

    If you want to automate the creation of shops, you can use vercel to create deployments depending on a provided configuration. That way you just focus your effort in maintain the API infrastructure and give the accountability to handle storefronts infrastructure to a third service. And another reason is that vercel is amazing and has a very well documented API :D

    That's it, I think that's a good summary of all the things you need to implement multitenant architecture.

    B D
    @bayareacoder
    @jhonsfran1165 I'm not sure I understand a few things: 1. "the shopId is the Tenant ID" and "In the admin you can identify the shop with the account that logs in into the app"? You seem to have a 1-1 relation between users and shops? You have users with a role of store owner/manager. Each user needs to be associated with one or more shops since one person may need to have permissions for multiple shops, but not all of them. How do you handle that in your case? A limitation of 1 account per shop is not good I think 2. "Switching between shops in the admin can be accomplished by changing the shopId parameter in the URL" So a user would need to manually change the URL to manage another shop? Seems not practical in real-world. And how does this work with the 1-1 relation between shop & user? But since we did our own admin and are not using reaction-admin, it should be possible for us to add a shop selection box, if we can query the API for all shops belonging to a shop owner/manager account. 3. "If you want to identify user on each storefront you have to send the shopId (Tenant Id) to the identity service and also create a record in hydra service that allows the storefront to create the login_challenge necessary to interact with the login service." As mentioned we do not use Hydra for shop manager/owner accounts so seems we can avoid that complexity. But since we use Hydra for 'shopper' accounts, we do need to understand how a user, i.e. 1 email address, could be associated with multiple shops via Hydra. Seems it should be a simple change to schema of user accounts to associate it with multiple shopIds (possibly all shops of that retail chain, or maybe just the shopIds managed by this same store owner/manager)
    The automated generation of shops is interesting. Can you elaborate more on that how you would use Vercel to do that? We use a deployment similar to reaction-development-platform ie. Docker hosted on DigitalOcean.
    B D
    @bayareacoder
    Seems it should be possible to use a DO API in combination with the Ansible script to modify the Docker deployment to add a store but curious to your implementation how you used Vercel to do this, e..g are you using Vercel just for the storefront and then running the rest in a Docker container elsewhere? If so, how do you handle the communication between Hydra and storefront since I think some of that is supposed to run on internal ports within Docker. Also how do you setup the SSL if using admin and storefront in different deployments: they'd be on different domains I assume?
    1 reply
    Sebastian Franco - Devops Engineer
    @jhonsfran1165
    1. For us, the shopId is the owner of the data. We have a 1-1 relation between accounts and shops, but we support multiple shops per account using the adminUIShopIds. The shopId in the accounts collection indicates what tenant it belongs to. We manage permissions by granting the proper groups to each account when it's created.

    2. Yes we are using a select component that allows us to administrate each shop that the account has assigned. For instance, if an account has, lets say four shops, the select component list each shop, and the user can select the shop and the admin fetch the corresponding data to that shop. It's very practical indeed, but for now, our use case for this functionality is for the primary shop that handles other shops. It's working very well at the moment.

    3. You are right I'm not sure if that works in your case since you are not using Hydra. But your implementation sounds very tricky, so I can't help without having more specific details.

    4. We use vercel to deploy shops. We created a plugin to integrate a vercel with RC. The problem with deploying storefronts in your infrastructure is that you are charged for resources that do not core for your business. At least that's how we see it in our case. So we just want to have the core services in our infrastructure and depending on each client we use logflare and sentry to monitor each storefront from vercel.

    I hope that helps you.

    m5ingh
    @m5ingh
    @jhonsfran1165 your insights are pure gold. cant thank you enough. the summary you provided helped me immensely in understanding the intricacies of the platform and provided me clarity that i needed. i will worry about new auth system when it arrives. hopefully it will be ory keto and kratos as they indeed make permissions and user management cleaner.
    Sebastian Franco - Devops Engineer
    @jhonsfran1165
    @m5ingh you're welcome!
    B D
    @bayareacoder
    @jhonsfran1165 i read up on HashiCorp Consul that you mentioned and their TLS proxies are indeed an elegant solution for secure networking between Dockerized app and an outside app (your storefront instances on Vercel). In our case I think we’ll run everything on DO with storefronts in separate droplets that we can scale so then we should be able to use an overlay network with Docker Swarm for secure comms.
    alfred-godoy
    @alfred-godoy:matrix.org
    [m]
    Hey y'all! Is there a nice way to get "hot reloading" working when coding api plugins? Running bin/package-link on every change is sooo tiresome! ;)
    Loan Laux
    @loan-laux
    @alfred-godoy:matrix.org no straightforward and easy way as far as I know :(
    alfred-godoy
    @alfred-godoy:matrix.org
    [m]
    Ok, maybe I'll set up some hook in my editor then. Thanks for your response!
    Loan Laux
    @loan-laux
    That might be the best solution indeed
    nomad-lw
    @nomad-lw
    Hi! Just popped in to check on which release of the development-platform can be considered stable enough for a small production deployment?
    Last I checked, 3.9.0 was stable and 3.11 broke the admin UI a bit
    Loan Laux
    @loan-laux
    @nomad-lw There was a good number of bugs fixed in the latest version of the admin. I’d say latest version of everything will get you the most stable experience.
    4 replies
    Alan Ng
    @DeveloperAlan
    @jhonsfran1165 by any chance that plugin is open sourced? would like to use vercel for my reaction commerce configuration
    Sebastian Franco - Devops Engineer
    @jhonsfran1165
    @DeveloperAlan Hi! Yes, It's going to be open sourced soon. We are fixing some bugs and working in the provider to use vercelcommerce :D
    ahsanazeem313
    @ahsanazeem313
    hey guys,i am new to use reaction and i am unable to get stored products in storefront.i deployed reaction from https://github.com/reactioncommerce/reaction-development-platform on AWS vm. i changed localhost into vm ip.
    i have changed the localhost into vm ip but graphql still running on http://localhost:3000/graphql .please guide me.
    image.png
    claptonorioste
    @claptonorioste
    how to deploy Reaction Commerce in Lightsail ? can i use this https://github.com/reactioncommerce/reaction-development-platform ?
    Loan Laux
    @loan-laux
    @claptonorioste the development platform is just a way for developers to get the whole environment started easily on their work machines. It shouldn’t be used for deployments, even for dev environments. I’m not sure about Lightsail specifically, but deploy Reaction like any other set of Docker containers. Something like Portainer could help, depending on your use case.
    claptonorioste
    @claptonorioste
    @loan-laux i found the docker images but where can i setup the mongo db url.. im using ubuntu 18.04 VM
    Loan Laux
    @loan-laux
    @claptonorioste pass MONGO_URL as an environment variable in your container configuration
    claptonorioste
    @claptonorioste
    @loan-laux how to add authorize net as a payment ?
    Loan Laux
    @loan-laux
    @claptonorioste you’ll have to build your own plug-in for it
    claptonorioste
    @claptonorioste
    Hello @loan-laux is it ok to use the older version since it is easier to deploy using meteor galaxy
    Loan Laux
    @loan-laux
    Hi @claptonorioste. No, versions prior to 3.0 are deprecated, don’t receive security updates anymore and represent a huge risk being used in production. Not only that, but they’re also a huge pain to work with (dev experience has improved a lot since then).
    If you need assistance for a deployment of Reaction 3, my team at out:grow would be happy to help. We do turnkey deployments for clients on AWS ECS for a fixed price. Feel free to e-mail me at loan@outgrow.io if you’re interested.
    claptonorioste
    @claptonorioste
    hello @loan-laux i successfully installed reaction commerce 3.0 using traefik i followed the tutorial but i cant seem to drag and drop the navigation
    Screenshot from 2021-05-06 14-22-14.png
    alfred-godoy
    @alfred-godoy:matrix.org
    [m]
    To what extent can I scale up the reaction api process in parallell? Can I run multiple instances, just pointing them all to the same database, and it will work out of the box?
    (I.e. load balancing requests over multiple servers.)
    claptonorioste
    @claptonorioste
    also how to apply the plugins in prod ?
    Loan Laux
    @loan-laux
    @claptonorioste which version of reaction-admin are you running? This bug was fixed a while ago
    @alfred-godoy:matrix.org Indeed, just run multiple instances pointed at the same database and load-balance them. You can run as many of these parallel instances as you want. Reaction was built with this use case in mind.
    claptonorioste
    @claptonorioste
    reaction-admin v3.0.0-beta.13
    Loan Laux
    @loan-laux
    @claptonorioste any errors in the container logs or the browser console?
    Jithin Paul
    @jithinpaul-sm2010
    Hi, I'm new to the reaction. It would be very helpful if anyone tel me how to set up reacts store and reaction-admin locally in UI. So i can edit and add my templates to UI part.
    claptonorioste
    @claptonorioste
    Screenshot from 2021-05-09 10-40-45.png
    getting that error in reactin-admin
    Loan Laux
    @loan-laux
    @jithinpaul-sm2010 The docs at mailchimp.com/developer/open-commerce should cover the process of getting started. Let me know if there’s anything missing in there!
    Akarshit Wal
    @Akarshit
    Hello everyone!
    This is Akarshit from Mailchimp and I had a news to share with you all. We are officially moving off Gitter and will be migrating to Discord.
    Here is the invite to the server: https://discord.gg/Bwm63tBcQY
    I request you all to deprecate this channel and move conversations to the Discord server.