docs: added details about health route (#3861)

This commit is contained in:
Shahed Nasser
2023-04-18 10:43:31 +03:00
committed by GitHub
parent cd2d4f6455
commit 9836adeec7
5 changed files with 21 additions and 41 deletions

View File

@@ -116,22 +116,16 @@ After pushing the changes, you can find the files in your GitHub repository.
After logging into your account, click on the Create button at the top right, then choose App.
![Click Create button then choose Apps](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002030/Medusa%20Docs/Digital%20Ocean/PQgPZ0q_xntr2i.png)
### Choose Repository
In the Create App page, choose GitHub from the Service Provider list.
![Choose GitHub from list of providers](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002043/Medusa%20Docs/Digital%20Ocean/nBY9wGE_zyy1e6.png)
If you havent given DigitalOcean access before, click on Manage Access under Source Code. Youll then be redirected to GitHub to give DigitalOcean access.
Once DigitalOcean have access to your GitHub account, you should see a Repository input. Click on it and search for the repository you created earlier.
Once DigitalOcean has access to your GitHub account, you should see a Repository input. Click on it and search for the repository you created earlier.
Additional inputs will show up to choose the Branch, Source Directory, and Autodeploy options.
![Enter master for Branch input, backslash for Source Directory, and check Autodeploy](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002055/Medusa%20Docs/Digital%20Ocean/kjk9E2B_qpwrx4.png)
If you host your Medusa backend in a monorepo, you should change the Source Directory to the directory the backend is available in the repository. Otherwise, it can be left as is.
Once youre done, click Next to move on to the next step.
@@ -140,32 +134,22 @@ Once youre done, click Next to move on to the next step.
In the next step, youll see the resources to create.
![List of resources showing a docker resource and web service resource](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002067/Medusa%20Docs/Digital%20Ocean/6TlpWB9_wfppc7.png)
If you have a Dockerfile available in the backends codebase (which is available by default), youll have two resources showing. You can remove it by clicking on the trash icon at the right of the resource.
If you have a Dockerfile available in the backends codebase, youll have two resources showing. You can remove it by clicking on the trash icon at the right of the resource.
By default, DigitalOcean hosts the web service in a sub-path of the domain name of the created App. To change it to the root of the domain, click on the edit icon at the right of the Web Service resource.
Then, scroll to HTTP Request Routes and expand it by clicking on Edit at its right. Change the value of the Routes input to `/`.
![Enter backslash for Routes](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002076/Medusa%20Docs/Digital%20Ocean/ta0jHh4_ddcz3r.png)
Once youre done click Save. Youll be taken back to the Resources page.
### Specify Database Resources
On the same page, expand the Add Resources section, choose Database, then click Add.
![Choose Database](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002090/Medusa%20Docs/Digital%20Ocean/MfK9E8o_ensfu0.png)
In the new page, youll be shown a PostgreSQL database to be created. Notice that its important to choose a name that youll remember as youll need the name in next steps. You can leave the name as is if its not necessary to change it.
![Enter db for Choose Name input](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002099/Medusa%20Docs/Digital%20Ocean/jYxENhr_wxkspz.png)
Once youre done, click Create and Attach. Youll be redirected back to the previous page with the database added to the resources.
![Database showing in the list of resources with web service](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002109/Medusa%20Docs/Digital%20Ocean/jNZ7rxg_msmgbz.png)
Once youre done, click Next to move on to the next step.
### Set Environment Variables
@@ -174,8 +158,6 @@ In this section, youll add environment variables that are essential to your M
You should see two ways to add environment variables: Global or specific to the Web Service.
![Global environment variables and web service environment variables](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002118/Medusa%20Docs/Digital%20Ocean/VOYykPT_qoili6.png)
Click Edit on the second row to add environment variables specific to the Web Service. Add the following environment variables:
```bash
@@ -213,8 +195,6 @@ Once youre done click Save.
In the next section, youll be shown the app info and the region it will be deployed to. You can leave it all as is or make changes if you find it necessary.
![App info and region details](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002128/Medusa%20Docs/Digital%20Ocean/XVS0yej_kwmaim.png)
Once youre done, click Next to go to the next step.
In the final step, you can see a review of everything you created. If everything looks good, scroll down and click Create Resource.
@@ -225,16 +205,10 @@ While the backend is being deployed, you can create the Redis resource.
Click the Create button at the top right and choose Database from the dropdown.
![Click Create then choose Databases](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002138/Medusa%20Docs/Digital%20Ocean/8BzUzuO_bhwcpd.png)
In the new page under Choose a database engine, choose Redis.
![For the Choose a database engine input choose Redis](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002149/Medusa%20Docs/Digital%20Ocean/lninWzJ_joycrd.png)
Then, scroll down to the “Choose a name” input. Since you used the name `redis` in the `REDIS_URL` environment variables, change the value to `redis` here.
![For the choose a name input set the value to redis](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002158/Medusa%20Docs/Digital%20Ocean/E81Qc4l_gid9qa.png)
Once youre done, click on Create Database Cluster.
### Attach Redis Database
@@ -243,12 +217,8 @@ Once the Redis database is created go back to the App you created earlier by cho
Click at the white Create button at the top right and choose Create/Attach Database.
![Click at the create button and choose create/attach database](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002168/Medusa%20Docs/Digital%20Ocean/jdh702G_fjssat.png)
In the new page, click on the Previously Created DigitalOcean Database radio button. Then, under Database Cluster select the Redis database you just created.
![Choose Previously Created DigitalOcean Database then under Database Cluster choose redis](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002177/Medusa%20Docs/Digital%20Ocean/aBJ2z0B_yzwpym.png)
Once youre done click Attach Database. This will add the Redis database to the list of resources of your App and will trigger a redeploy of the App.
---
@@ -257,11 +227,11 @@ Once youre done click Attach Database. This will add the Redis database to th
Once the redeployment is complete, copy the URL of the App which can be found under the Apps name.
![Copy URL under the app name](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002186/Medusa%20Docs/Digital%20Ocean/i3ws777_ooknst.png)
Then, go to `<YOUR_APP_URL>/store/products`. If the deployment was successful, you should receive a JSON response.
![JSON response with list of products](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002196/Medusa%20Docs/Digital%20Ocean/5xTdMbY_pqwyzy.png)
### Health Route
You can access `/health` to get health status of your deployed backend.
### Testing the Admin
@@ -288,8 +258,6 @@ medusa user --email <EMAIL> --password <PASSWORD>
Make sure to replace `<EMAIL>` and `<PASSWORD>` with the credentials you want to give the user.
![Console in the DigitalOcean App](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002204/Medusa%20Docs/Digital%20Ocean/9RMfD4C_u0mdqs.png)
---
## Add Environment Variables
@@ -298,12 +266,8 @@ Youll likely need to add environment variables later such as Admin Cross-Orig
To add environment variables, on the Apps page click on Settings and choose the Web Service component.
![Choose the Settings tab then choose the web service container](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002217/Medusa%20Docs/Digital%20Ocean/qLPARaV_ocit6w.png)
Then, scroll down and find Environment Variables. You can expand the environment variables by clicking Edit on the right. Here, you can edit, add, and remove environment variables.
![Expand the Environment Variables section by clicking edit](https://res.cloudinary.com/dza7lstvk/image/upload/v1668002227/Medusa%20Docs/Digital%20Ocean/4x6JGjX_wzltiq.png)
Once you click Save, the environment variables will be saved and a redeployment will be triggered.
---

View File

@@ -239,6 +239,10 @@ The backend's URL is available under "Web URL". You can copy it and perform requ
For example, you can send a request to `<YOUR_BACKEND_URL>/store/products` and you should receive a JSON response with the products in your store.
### Health Route
You can access `/health` to get health status of your deployed backend.
### Testing the Admin
:::note

View File

@@ -96,6 +96,10 @@ Once the build process is complete, a new deployment with the infrastructure res
After the deployment is finished, navigate to Resources → [AppName] (Medusa in this example) → Overview. Then, under the Resource Outputs section you should see the "AccessUrl". This is the backend's URL that you can use to access API endpoints and test them. You can try getting the list of products using the endpoint `<AccessUrl>/store/products`.
### Health Route
You can access `/health` to get health status of your deployed backend.
### Testing the Admin
:::note

View File

@@ -191,6 +191,10 @@ If you generated a random domain, you can find it by clicking on the GitHub repo
:::
### Health Route
You can access `/health` to get health status of your deployed backend.
### Testing the Admin
:::note