docs: improvements to deployment guides (#6183)

- Add a new deployment overview page giving a general overview of how a Medusa project is deployed
- Add a new section in all backend deployment guides related to the Medusa admin.
- Add a general deployment guide for the medusa admin.
- Add a general deployment guide for the Next.js starter
This commit is contained in:
Shahed Nasser
2024-01-24 08:22:50 +00:00
committed by GitHub
parent b3d013940f
commit 75fd6b0c83
15 changed files with 718 additions and 57 deletions
@@ -94,6 +94,66 @@ Your `.gitignore` may have `yarn.lock` and `package-lock.json` in it. If so, rem
---
## (Optional) Configure the Admin
If you're using the Medusa Admin plugin, you have two options to deploy it: either with the backend or separately.
### Deploying with the Backend
To deploy the admin with the backend:
1. Your chosen plan must offer at least 2GB of RAM.
2. Enable the [autoRebuild option](../../admin/configuration.mdx#plugin-options) of the admin plugin:
```js title="medusa-config.js"
const plugins = [
// ...
{
resolve: "@medusajs/admin",
/** @type {import('@medusajs/admin').PluginOptions} */
options: {
autoRebuild: true,
// other options...
},
},
]
```
Alternatively, you can use a GitHub action to build the admin as explained [here](../index.mdx#deploy-admin-through-github-action).
### Deploying Separately
If you choose to deploy the admin separately, disable the admin plugin's [serve option](../../admin/configuration.mdx#plugin-options):
```js title="medusa-config.js"
const plugins = [
// ...
{
resolve: "@medusajs/admin",
/** @type {import('@medusajs/admin').PluginOptions} */
options: {
// only enable `serve` in development
// you may need to add the NODE_ENV variable
// manually
serve: process.env.NODE_ENV === "development",
// other options...
},
},
]
```
This ensures that the admin isn't built or served in production. You can also change `@medusajs/admin` dependency to be a dev dependency in `package.json`.
You can alternatively remove the admin plugin for the plugins array.
:::tip
Refer to the [admin deployment guides on how to deploy the admin separately](../admin/index.mdx).
:::
---
## (Optional) Use Production Modules
If you're using development modules, such as the Local Event Bus or the In-Memory Cache Modules, it's highly recommended to use a production module instead.
@@ -280,13 +340,7 @@ You can access `/health` to get health status of your deployed backend.
### Testing the Admin
:::note
Make sure to either set the `autoRebuild` option of the admin plugin to `true` or add its [build](../../admin/configuration.mdx#build-command-options) command as part of the start command of your backend.
:::
If you deployed the admin dashboard alongside the backend, you can test it by going to `<YOUR_APP_URL>/app`. If you changed the admin path, make sure to change `/app` to the path you've set.
If you deployed the [admin dashboard with the backend](#deploying-with-the-backend), you can test it by going to `<YOUR_APP_URL>/app`. If you changed the admin path, make sure to change `/app` to the path you've set.
---
@@ -304,10 +358,10 @@ If you find this error in your logs, make sure to remove `yarn.lock` or `package
To run commands on your backend, you can access the console on the Apps page by choosing the Console tab. This opens a console in your browser where you can run commands on your backend.
For example, you can run the following commands to create a new admin user:
For example, you can run the following command to create a new admin user:
```bash
npx @medusajs/medusa-cli user --email <EMAIL> --password <PASSWORD>
npx medusa user --email <EMAIL> --password <PASSWORD>
```
Make sure to replace `<EMAIL>` and `<PASSWORD>` with the credentials you want to give the user.