Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: changes to deployment + remove admin deployment guides #10345

Merged
merged 3 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 8 additions & 24 deletions www/apps/book/app/learn/deployment/general/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ When you deploy your Medusa application, make sure your chosen hosting provider
1. PostgreSQL database: If your hosting provider doesn't support database hosting, you must find another hosting provider for the PostgreSQL database.
2. Redis database: If your hosting provider doesn't support database hosting, you must find another hosting provider for the Redis database.
3. Medusa application in server and worker mode. This means your hosting provider should support deploying two applications or instances from the same codebase.
5. If you're also hosting the Medusa Admin with the server, the hosting provider and plan should offer at least 2GB of RAM.
4. For optimal experience, the hosting provider and plan must offer at least 2GB of RAM.

---

Expand Down Expand Up @@ -68,18 +68,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>

So, 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({
Expand Down Expand Up @@ -208,7 +197,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
Expand All @@ -220,9 +208,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.
- Set the PostgreSQL database's connection URL as the value of `DATABASE_URL`
- Set the Redis database's connection URL as the value of `REDIS_URL`.

Expand All @@ -240,11 +228,9 @@ If your hosting provider doesn't support setting a current-working directory, se
cd .medusa/server && npm run predeploy && npm run start
```

### 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 after 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({
Expand Down Expand Up @@ -299,7 +285,7 @@ REDIS_URL= # REDIS DATABASE URL
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.
- Set the PostgreSQL database's connection URL as the value of `DATABASE_URL`
- Set the Redis database's connection URL as the value of `REDIS_URL`.

Expand All @@ -323,9 +309,7 @@ cd .medusa/server && npm run predeploy && npm run start

Once the application is deployed and live, 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`.

---

Expand Down
52 changes: 8 additions & 44 deletions www/apps/book/app/learn/deployment/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,22 @@ A standard Medusa project is made up of:

![Diagram showcasing the connection between the three deployed components](https://res.cloudinary.com/dza7lstvk/image/upload/v1708600807/Medusa%20Book/deployment-options_ceuuvo.jpg)

You can either deploy the Medusa application fully (server with the admin), or deploy the Medusa Admin separately. The storefront is always deployed separately.
You deploy the Medusa application, with the server and admin, separately from the storefront.

---

## Deploying the Medusa Server
## Deploying the Medusa Application

You must deploy the Medusa server before the admin or storefront, as both of them connect to it and won’t work without a deployed Medusa server URL.
You must deploy the Medusa application before the storefront, as it connects to the server and won’t work without a deployed Medusa server URL.

![Diagram showcasing how the Medusa server and its associated services would be deployed](https://res.cloudinary.com/dza7lstvk/image/upload/v1708600972/Medusa%20Book/backend_deployment_pgexo3.jpg)

The Medusa server must be deployed to a hosting provider supporting Node.js server deployments, such as Railway, DigitalOcean, AWS, Heroku, etc…

<Note title="Tip">

For optimal experience, make sure that the hosting provider and plan offer at least 2GB of RAM.
The Medusa application must be deployed to a hosting provider supporting Node.js server deployments, such as Railway, DigitalOcean, AWS, Heroku, etc…

</Note>
![Diagram showcasing how the Medusa server and its associated services would be deployed](https://res.cloudinary.com/dza7lstvk/image/upload/v1708600972/Medusa%20Book/backend_deployment_pgexo3.jpg)

Your server connects to a PostgreSQL database, Redis, and other services relevant for your setup. Most hosting providers support deploying and managing these databases along with your Medusa server (such as Railway and DigitalOcean).

When you deploy your Medusa application, you also deploy the Medusa Admin. For optimal experience, your hosting provider and plan must offer at least 2GB of RAM.

### How to Deploy Medusa?

Medusa Cloud is our managed services offering that makes deploying and operating Medusa applications possible without having to worry about configuring, scaling, and maintaining infrastructure. Medusa Cloud hosts your server, Admin dashboard, database, and Redis instance.
Expand All @@ -48,39 +44,7 @@ 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)

To self-host Medusa, the [next chapter](./general/page.mdx) explains the general steps to deploy your Medusa application.

Refer to [this reference](!resources!/deployment) to find how-to deployment guides for general and specific hosting providers.

---

## Deploying the Medusa Admin

### Deploy Admin with the Server

The Medusa Admin can be deployed on the same hosting with the server.

In this scenario, make sure the hosting provider and plan of your choice provide at least 2GB of RAM, as the admin build requires high RAM usage.

![Diagram showcasing how the admin would be deployed along with the Medusa server.](https://res.cloudinary.com/dza7lstvk/image/upload/v1708601021/Medusa%20Book/admin_deployment_1_lyg4cp.jpg)

<Note title="Tip">

The [server deployment guides](!resources!/deployment) mention details on how to deploy the admin with the Medusa server.

</Note>

### Deploy Admin Separately

You can deploy the admin into a separate hosting provider or instance. The admin can be hosted on providers that support front-end websites and frameworks, such as Vercel.

<Note title="Important">

Per Vercel’s [license and plans](https://vercel.com/pricing), their free plan can only be used for personal, non-commercial projects. So, you can deploy the Medusa Admin on the free plan for development purposes, but for commercial projects, you must update your Vercel plan.

</Note>

Refer to [this reference](!resources!/deployment) to find how-to deployment guides for specific hosting providers.
To self-host Medusa, the [next chapter](./general/page.mdx) explains the general steps to deploy your Medusa application. Refer to [this reference](!resources!/deployment) to find how-to deployment guides for general and specific hosting providers.

---

Expand Down
142 changes: 0 additions & 142 deletions www/apps/resources/app/deployment/admin/vercel/page.mdx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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`.

---

Expand Down
Loading
Loading