docs: improved digitalocean docs (#1889)

This commit is contained in:
Shahed Nasser
2022-07-21 15:22:29 +03:00
committed by GitHub
parent ef84b104e6
commit b2602fa9ed
4 changed files with 261 additions and 143 deletions
@@ -33,7 +33,7 @@ Furthermore, your Medusa server should be configured to work with PostgreSQL and
- Gits CLI tool. You can follow [this documentation to learn how to install it for your operating system](../../tutorial/0-set-up-your-development-environment.mdx#git).
- Heroku's CLI tool. You can follow [Heroku's documentation to learn how to install it for your operating system](https://devcenter.heroku.com/articles/heroku-cli).
## How to Deploy Your Medusa Server on Heroku
## Deploy to Heroku
### 1. Login to Heroku from your CLI
@@ -226,17 +226,41 @@ git push heroku HEAD:master
This triggers a redeploy of the Medusa server with all the new configurations.
## Troubleshooting: Inspect Build Logs
## Test your Server
To test your server, run the following command to retrieve the server's URL:
```bash
heroku apps:info -a <APP_NAME>
```
Where `<APP_NAME>` is the name of the app. You should see as the output a bunch of info of the app.
The server's URL is available under "Web URL". You can copy it and perform requests to it to test it out.
For example, you can send a request to `<YOUR_SERVER_URL>/store/products` and you should receive a JSON response with the products in your store.
### Troubleshooting: Inspect Build Logs
If an error occurs during the deployment, you can explore your Heroku app build logs using the following command in the root directory of your Medusa server:
```bash
heroku logs -n 500000 --remote heroku --tail
heroku logs -n 500000 --remote heroku --tail -a <APP_NAME>
```
## Create a User
Where `<APP_NAME>` is the name of the app.
As an optional extra step, you can create a user to use when your admin dashboard is up and running:
## Run Commands on Your Server
To run commands on your server, you can use the following command:
```bash
heroku run -a <APP_NAME> -- <COMMAND>
```
Where `<APP_NAME>` is the name of the app and `<COMMAND>` is the command you want to run.
For example, to create an admin user you can run the following command:
```bash
heroku run -a <APP_NAME> -- medusa user -e "<EMAIL>" -p "<PASSWORD>"
@@ -244,6 +268,18 @@ heroku run -a <APP_NAME> -- medusa user -e "<EMAIL>" -p "<PASSWORD>"
Where `<APP_NAME>` is the name of your Heroku app, and `<EMAIL>` and `<PASSWORD>` are the credentials you want to use to log in to the Medusa admin dashboard.
## Add Environment Variables
Youll likely need to add environment variables later such as Admin CORS and Store CORS variables.
To set or change an environment variable's value, you can use the following command:
```bash
heroku config:set <ENV_NAME>=<ENV_VALUE> -a <APP_NAME>
```
Where `<APP_NAME>` is the name of your Heroku app, `<ENV_NAME>` is the name of the environment variable, and `<ENV_VALUE>` is the value.
## What's Next :rocket:
- Learn how to [deploy your Medusa admin](../admin/index.mdx).