docs: changes to deployment + remove admin deployment guides (#10345)
* docs: change headings and text in deployment * remove admin deployment guide * generate changes
This commit is contained in:
@@ -1,142 +0,0 @@
|
||||
---
|
||||
sidebar_label: "Vercel"
|
||||
---
|
||||
|
||||
import { Prerequisites } from "docs-ui"
|
||||
|
||||
export const metadata = {
|
||||
title: `Deploy Medusa Admin to Vercel`,
|
||||
}
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
In this document, you’ll learn how to deploy the Medusa Admin to [Vercel](https://vercel.com).
|
||||
|
||||
<Prerequisites items={[
|
||||
{
|
||||
text: "Medusa application’s codebase hosted on GitHub repository.",
|
||||
link: "!docs!/learn/installation"
|
||||
},
|
||||
{
|
||||
text: "Deployed Medusa application.",
|
||||
link: "../../page.mdx#medusa-application"
|
||||
},
|
||||
]} />
|
||||
|
||||
## 1. Configure Admin in Medusa
|
||||
|
||||
In `medusa-config.ts`, set the following admin configuration:
|
||||
|
||||
```ts title="medusa-config.ts"
|
||||
module.exports = defineConfig({
|
||||
// ...
|
||||
admin: {
|
||||
disable: process.env.DISABLE_MEDUSA_ADMIN === "true",
|
||||
backendUrl: process.env.MEDUSA_BACKEND_URL,
|
||||
path: process.env.MEDUSA_ADMIN_PATH,
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
Where:
|
||||
|
||||
- You set `disable` to the environment variable `DISABLE_MEDUSA_ADMIN`. In the deployed Medusa application, you set the environment variable’s value to `true` to disable the admin, and when deploying the admin you set it to `false`.
|
||||
- `backendUrl` will be the URL of the deployed Medusa backend.
|
||||
- `path` is the base path of the admin, which is `/app` by default. When you set the environment variable `MEDUSA_ADMIN_PATH` later while deploying the admin, you’ll set it to `/`.
|
||||
|
||||
---
|
||||
|
||||
## 2. Add Vercel Rewrite
|
||||
|
||||
Create the file `vercel.json` in the root directory of your Medusa application with the following content:
|
||||
|
||||
```json title="vercel.json"
|
||||
{
|
||||
"rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. Create Vercel Project
|
||||
|
||||
<Note>
|
||||
|
||||
Push all changes you’ve made in the previous step to the GitHub repository before proceeding.
|
||||
|
||||
</Note>
|
||||
|
||||
To create a Vercel project, on your Vercel dashboard:
|
||||
|
||||
1. Click on the Add New button at the top right.
|
||||
2. Choose Project from dropdown.
|
||||
3. In the list of GitHub repository shown, find the GitHub repository and click its Import button.
|
||||
4. This shows a form to configure the project:
|
||||
1. Choose Other for the Framework Preset field.
|
||||
2. Keep the root directory to `.`
|
||||
3. Expand the Build and Output Settings section:
|
||||
- Set the Build Command field to the following:
|
||||
|
||||
```bash npm2yarn
|
||||
npm run build --admin-only
|
||||
```
|
||||
|
||||
- Set the Output Directory field to `.medusa/admin`.
|
||||
- Set the Install Command field to the following:
|
||||
|
||||
```bash npm2yarn
|
||||
npm install
|
||||
```
|
||||
|
||||
4. Expand the Environment Variables section and add the following variables:
|
||||
|
||||
```bash
|
||||
DISABLE_MEDUSA_ADMIN=false
|
||||
MEDUSA_BACKEND_URL = # URL of deployed Medusa application
|
||||
MEDUSA_ADMIN_PATH=/
|
||||
```
|
||||
|
||||
|
||||
Where the value of `MEDUSA_BACKEND_URL` is the URL to your deployed Medusa application.
|
||||
|
||||
Then, click the Deploy button to deploy the admin. This takes a couple of minutes. Once the deployment is done, click the Continue to Dashboard button.
|
||||
|
||||
---
|
||||
|
||||
## 4. Set Admin URL
|
||||
|
||||
Vercel generates a random domain name for your project. You can use it or [set a custom domain name](https://vercel.com/guides/how-do-i-add-a-custom-domain-to-my-vercel-project).
|
||||
|
||||
Once you have the admin’s domain name, you must set the `ADMIN_CORS` environment variable in the Medusa application to the admin’s URL:
|
||||
|
||||
```bash
|
||||
ADMIN_CORS=https://admin-...
|
||||
```
|
||||
|
||||
And add the admin URL to the `AUTH_CORS` environment variable in the Medusa application:
|
||||
|
||||
```bash
|
||||
AUTH_CORS=<OTHER_URLS>,https://admin-...
|
||||
```
|
||||
|
||||
Where `<OTHER_URLS>` are URLs added previously to `AUTH_CORS`, such as the URL of a storefront. URLs in `AUTH_CORS` are separated by a comma.
|
||||
|
||||
Then, redeploy the Medusa application.
|
||||
|
||||
---
|
||||
|
||||
## Test the Admin
|
||||
|
||||
To test the admin, open its URL and login with an admin user’s credentials.
|
||||
|
||||
<Note>
|
||||
|
||||
If you don’t have an admin user on your Medusa application, use the [user command of the Medusa CLI tool](../../../medusa-cli/page.mdx#user).
|
||||
|
||||
</Note>
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you’re running into issues in your admin, find the logs in your Vercel project’s dashboard under the Logs tab.
|
||||
@@ -16,9 +16,8 @@ In this document, you’ll learn how to deploy your Medusa application to [Railw
|
||||
|
||||
1. PostgreSQL database.
|
||||
2. Redis database.
|
||||
3. Medusa application in server mode.
|
||||
3. Medusa application in server mode, with the Medusa Admin.
|
||||
4. Medusa application in worker mode.
|
||||
5. (Optional) Medusa Admin.
|
||||
|
||||
<Note>
|
||||
|
||||
@@ -56,18 +55,7 @@ Later, you’ll set different values of the `MEDUSA_WORKER_MODE` environment var
|
||||
|
||||
### Configure Medusa Admin
|
||||
|
||||
There are two cases where you may disable the Medusa Admin in your deployed Medusa application:
|
||||
|
||||
1. If you choose to host it separately.
|
||||
2. In the Medusa application running in worker mode, as it doesn’t need to run the admin.
|
||||
|
||||
<Note>
|
||||
|
||||
To host the admin with the Medusa application, the hosting provider and plan should offer at least 2GB of RAM.
|
||||
|
||||
</Note>
|
||||
|
||||
Add the following configuration in `medusa-config.ts`:
|
||||
You need to disable the Medusa Admin in the worker Medusa application, while keeping it enabled in the server Medusa application. So, add the following configuration in `medusa-config.ts`:
|
||||
|
||||
```ts title="medusa-config.ts"
|
||||
module.exports = defineConfig({
|
||||
@@ -225,7 +213,6 @@ JWT_SECRET=supersecret # TODO GENERATE SECURE SECRET
|
||||
STORE_CORS= # STOREFRONT URL
|
||||
ADMIN_CORS= # ADMIN URL
|
||||
AUTH_CORS= # STOREFRONT AND ADMIN URLS, SEPARATED BY COMMAS
|
||||
# change to false if you're hosting the admin with the application
|
||||
DISABLE_MEDUSA_ADMIN=true
|
||||
MEDUSA_WORKER_MODE=server
|
||||
PORT=9000
|
||||
@@ -237,9 +224,9 @@ Where:
|
||||
|
||||
- The value of `COOKIE_SECRET` and `JWT_SECRET` must be a randomly generated secret.
|
||||
- `STORE_CORS`'s value is the URL of your storefront. If you don’t have it yet, you can skip adding it for now.
|
||||
- `ADMIN_CORS`'s value is the URL of the admin dashboard. If you don’t have it yet, or you’re deploying the admin with the Medusa application, you can skip adding it for now.
|
||||
- `ADMIN_CORS`'s value is the URL of the admin dashboard, which is the same as the server Medusa application. You can add it later if you don't currently have it.
|
||||
- `AUTH_CORS`'s value is the URLs of any application authenticating users, customers, or other actor types, such as the storefront and admin URLs. The URLs are separated by commas. If you don’t have the URLs yet, you can set its value later.
|
||||
- Change `DISABLE_MEDUSA_ADMIN` to `false` if you’re hosting the admin with the Medusa application.
|
||||
- Set `DISABLE_MEDUSA_ADMIN`'s value to `false` so that the admin is built with the server application.
|
||||
- `REDIS_URL`'s value is automatically generated using Railway’s template syntax. You add the `?family=0` to the connection string to support both IPv6 and IPv4 connections.
|
||||
|
||||
Feel free to add any other relevant environment variables. Once you’re done, click the Update Variables button.
|
||||
@@ -272,11 +259,9 @@ You can either generate a random domain name or set a custom one. To do that:
|
||||
1. Choose the `9000` port.
|
||||
5. Save the changes.
|
||||
|
||||
### Additional Configuration if Deploying with Admin
|
||||
### Set Backend URL in Admin Configuration
|
||||
|
||||
If you’re deploying the Medusa application in server mode with the admin, you have to make some changes now that you’ve obtained the application’s URL.
|
||||
|
||||
First, add the following configuration to `medusa-config.ts`:
|
||||
After you’ve obtained the Medusa application’s URL, add the following configuration to `medusa-config.ts`:
|
||||
|
||||
```ts title="medusa-config.ts"
|
||||
module.exports = defineConfig({
|
||||
@@ -345,7 +330,7 @@ REDIS_URL=${{Redis.REDIS_URL}}?family=0
|
||||
Where:
|
||||
|
||||
- The value of `COOKIE_SECRET` and `JWT_SECRET` must be a randomly generated secret.
|
||||
- Keep `DISABLE_MEDUSA_ADMIN`'s value set to `true`, even if you’re hosting the admin with the Medusa application.
|
||||
- Set `DISABLE_MEDUSA_ADMIN`'s value to `true` so that the admin isn't built with the worker application.
|
||||
- `REDIS_URL`'s value is automatically generated using Railway’s template syntax. You add the `?family=0` to the connection string to support both IPv6 and IPv4 connections.
|
||||
|
||||
Feel free to add any other relevant environment variables. Once you’re done, click the Update Variables button.
|
||||
@@ -373,9 +358,7 @@ To deploy the changes of the Medusa application in working mode, click on the De
|
||||
|
||||
To test out the deployed application, go to `<APP_URL>/health`, where `<APP_URL>` is the URL of the Medusa application in server mode. If the deployment was successful, you’ll see the `OK` response.
|
||||
|
||||
### Open Deployed Medusa Admin
|
||||
|
||||
If you deployed the Medusa Admin with the application, it’ll be available at `<APP_URL>/app`.
|
||||
The Medusa Admin is also available at `<APP_URL>/app`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -8,9 +8,7 @@ export const metadata = {
|
||||
|
||||
Find guides to deploy your Medusa application, Medusa Admin, and Next.js storefront.
|
||||
|
||||
## Deploy Medusa Application
|
||||
|
||||
### Medusa Cloud
|
||||
## Medusa Cloud
|
||||
|
||||
Medusa Cloud is our managed services offering for Medusa applications. Medusa Cloud hosts your server, Admin dashboard, database, and Redis instance. The infrastructure is security-compliant and optimized for Medusa and supports:
|
||||
|
||||
@@ -28,24 +26,14 @@ With Medusa Cloud, you maintain full customization control as you deploy your ow
|
||||
|
||||
[Sign up and learn more about Medusa Cloud](https://medusajs.com/contact)
|
||||
|
||||
### Self-hosting
|
||||
---
|
||||
|
||||
## Self-hosting Medusa
|
||||
|
||||
To host and maintain Medusa on your own, check out the following guides.
|
||||
|
||||
<ChildDocs showItems={["Medusa Application"]} hideTitle={true} />
|
||||
|
||||
### Medusa Admin
|
||||
|
||||
To host and maintain on your own the Medusa Admin separately from your Medusa application, check out the following guides.
|
||||
|
||||
<Note title="Tip">
|
||||
|
||||
If you're hosting your admin dashboard with the Medusa application, then check out the [deployment guides of the Medusa application](#self-hosting) instead.
|
||||
|
||||
</Note>
|
||||
|
||||
<ChildDocs showItems={["Medusa Admin"]} hideTitle={true} />
|
||||
|
||||
---
|
||||
|
||||
## Deploy Next.js Starter Storefront
|
||||
|
||||
@@ -567,10 +567,6 @@ export const filesMap = [
|
||||
"filePath": "/www/apps/resources/app/create-medusa-app/page.mdx",
|
||||
"pathname": "/create-medusa-app"
|
||||
},
|
||||
{
|
||||
"filePath": "/www/apps/resources/app/deployment/admin/vercel/page.mdx",
|
||||
"pathname": "/deployment/admin/vercel"
|
||||
},
|
||||
{
|
||||
"filePath": "/www/apps/resources/app/deployment/medusa-application/railway/page.mdx",
|
||||
"pathname": "/deployment/medusa-application/railway"
|
||||
|
||||
@@ -9150,7 +9150,7 @@ export const generatedSidebar = [
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
"type": "category",
|
||||
"title": "Medusa Application",
|
||||
"title": "Self-Hosting",
|
||||
"children": [
|
||||
{
|
||||
"loaded": true,
|
||||
@@ -9170,23 +9170,6 @@ export const generatedSidebar = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
"type": "category",
|
||||
"title": "Medusa Admin",
|
||||
"autogenerate_path": "/deployment/admin",
|
||||
"children": [
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
"type": "link",
|
||||
"path": "/deployment/admin/vercel",
|
||||
"title": "Vercel",
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
|
||||
@@ -104,6 +104,11 @@ const nextConfig = {
|
||||
destination: "/commerce-modules/promotion/links-to-other-modules",
|
||||
permanent: true,
|
||||
},
|
||||
{
|
||||
source: "/deployment/admin/vercel",
|
||||
destination: "/deployment",
|
||||
permanent: true,
|
||||
},
|
||||
]
|
||||
},
|
||||
// Redirects shouldn't be necessary anymore since we have remark / rehype
|
||||
|
||||
@@ -2159,7 +2159,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
title: "Medusa Application",
|
||||
title: "Self-Hosting",
|
||||
children: [
|
||||
{
|
||||
type: "link",
|
||||
@@ -2173,11 +2173,6 @@ export const sidebar = sidebarAttachHrefCommonOptions([
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
title: "Medusa Admin",
|
||||
autogenerate_path: "/deployment/admin",
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
title: "Next.js Starter",
|
||||
|
||||
Reference in New Issue
Block a user