#How to deploy AdminUI separate from backend in v1 and have UI plugins and widgets at the same time?
16 messages · Page 1 of 1 (latest)
How to deploy AdminUI separate from backend and have UI plugins and widgets at the same time?
Does disabling the admin in the config not work for the backend?
I tested deploying the backend as a standalone, without including the admin plugin in the plugins array. By "disabling" you meant including it in the array, but setting "serve" option to false (maybe also "autorebuild" to false, though i would assume "serve": false would be enough?)
I should have asked previously, are you working with deploying Medusa 1.x or 2.0?
sorry i should have clarified (will add to title), it is v1
How to deploy AdminUI separate from backend in v1 and have UI plugins and widgets at the same time?
I have not actually worked with v1 before, only v2. I'd assume just setting the serve: process.env.NODE_ENV === "development", would do the trick, as in production it would be false.
i have forked admin (plugin) and admin/ui (react project with UI) to be able to customize the panel. I would assume i need to deploy my forked admin project (which should have my forked admin/ui published npm package in its dependencies). But then, if i deploy separately from backend, which has plugins in medusa-config.js and widgets in admin/widgets, how do the two things connect?
If you haven't changed any of the parts that handle extensions and your version of the two packages still work together as the ones we provide do, then I would assume it should just work. As long as you use the CLI commands to start the dev server / build. But extensions in V1 were only built with the "intended" usage in mind, so you might have to make some modifications. The code for finding and creating an entrypoint for the extensions can be found in admin-ui/src/node/utils. The "magic" happens when we call createCacheDir which copies all the admin code + any extensions into a new folder which is then used as the entrypoint for Webpack.
In V2, extensions are simply handled by a Vite plugin, where you just pass a path, and then it will find and inject all the extensions for you. So if you decide to update to V2, we have made having a separate admin project while keeping the extensibility much simpler.
hey @buoyant pawn thanks for the detailed response. I saw that function, but i understand that if i deploy backend and admin separately, for admin, i still need to include the whole backend project, as it is needed for example, to get the local widgets, routes + plugins right?
If this is the case, what would be a viable approach regarding version control and CI/CD, as i would have my backend project on one side, without serving the admin UI and separately deployed admin project, but that would need to contain the backend as well?
It's good to hear about V2, but unfortunately i need to resolve for v1, as it will be some time until we adopt / start learning v2, a lot of work has already been done in v1 and nee to launch asap
like for example in admin package utils/load-config.ts
It expects medusa-config.js to be in cwd
Yes, you need to include the entire backend project, where ever you host your admin, since your extensions are in the /src/admin folder. As an example if you host it on Vercel you would link the entire GitHub repo of your project, see our guide on deploying the admin to Vercel: https://docs.medusajs.com/deployments/admin/deploying-on-vercel
great, i wanted to confirm, as that poses my other doubt regarding how to handle version control and CI/CD pipelines. I would have like a duplication of medusa backend, between server and admin which should not remain totally in sync, for starters both their medusa-config.js would be different (on my standalone backend i would not include admin in plugins array whereas on my admin backend i would?)?
You can just use the same repo, and you don't need to have the admin package in your plugins array. You just need to have the package installed, so you can call the CLI command: npx medusa-admin build --deployment
awesome, will try that and come back to you, thanks for your help, really appreciate it