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:
@@ -1,5 +1,5 @@
|
||||
---
|
||||
description: "General steps for all hosting providers."
|
||||
description: "General steps for deploying the backend."
|
||||
addHowToData: true
|
||||
---
|
||||
|
||||
@@ -59,13 +59,73 @@ Once you set up your PostgreSQL database, make sure to have the connection URL t
|
||||
|
||||
---
|
||||
|
||||
## (Optional) Step 5: Setup Architectural Services
|
||||
## (Optional) Step 5: 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 hosting provider and 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) Step 6: Setup Architectural Services
|
||||
|
||||
Aside from PostgreSQL, you may be using modules or plugins that require some additional architectural setup. For example, if you’re using the [Redis Events Module](../../development/events/modules/redis.md), you must set up a Redis database and obtain a connection URL to it.
|
||||
|
||||
---
|
||||
|
||||
## Step 6: Deploy your Backend
|
||||
## Step 7: Deploy your Backend
|
||||
|
||||
You can deploy your backend now to your hosting provider. During or after the deployment process, based on your hosting provider, you need to add the following environment variables:
|
||||
|
||||
@@ -87,12 +147,12 @@ Make sure to also add any other environment variables relevant to your backend.
|
||||
|
||||
---
|
||||
|
||||
## Step 7: Test it Out
|
||||
## Step 8: Test it Out
|
||||
|
||||
After you’ve deployed your backend, you can test it out in different ways:
|
||||
|
||||
- Go to `<BACKEND_URL>/health`, where `<BACKEND_URL>` is the URL to your deployed backend. If the deployment was successful, you should see `OK` printed in your browser.
|
||||
- If you deployed the admin dashboard, you can go to `<BACKEND_URL>/app` to view the admin dashboard. If you changed the value of the admin plugin’s `path` configuration, make sure to replace `app` with that instead.
|
||||
- If you deployed the [admin dashboard with the backend](#deploying-with-the-backend), you can go to `<BACKEND_URL>/app` to view the admin dashboard. If you changed the value of the admin plugin’s `path` configuration, make sure to replace `app` with that instead.
|
||||
|
||||
---
|
||||
|
||||
@@ -109,4 +169,3 @@ If your hosting provider gives you access to execute commands in your deployed M
|
||||
```bash
|
||||
npx medusa user --email admin@medusa-test.com --password supersecret
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user