|
1 | | -# Heroku Deploy |
2 | | -This sub-generator initializes a Heroku [.Net 5](https://docs.microsoft.com/pt-br/dotnet/core/dotnet-five) app that is ready to push to Heroku. |
| 1 | +# Deploying to Heroku |
| 2 | + |
| 3 | +This sub-generator allows the deployment of your JHipster .Net application to Heroku cloud. |
| 4 | + |
| 5 | +The Heroku sub-generator will always use free tiers/options. Nevertheless installing addons needs a properly verified Heroku account. |
| 6 | + |
| 7 | +Therefore to avoid any unexpected build failures, we would recommend verifying your Heroku account before starting this sub-generator. |
3 | 8 |
|
4 | 9 | ## Pre-requisites |
| 10 | + |
5 | 11 | Before running the sub-generator, you must install the [Heroku CLI](https://cli.heroku.com/). |
6 | | -You must also create a Heroku account and run: |
| 12 | + |
| 13 | +Make sure that you are logged into Heroku. |
7 | 14 | ```bash |
8 | 15 | heroku login |
9 | 16 | ``` |
| 17 | + |
10 | 18 | [Git](https://git-scm.com/) is also required to deploy to Heroku. |
11 | 19 |
|
| 20 | +Also make sure you have a working [Docker](https://docs.docker.com) installation (eg. `docker ps`) if deploying to Heroku Container Registry. |
| 21 | + |
12 | 22 | ## Deploying to Heroku |
13 | | -To deploy your .Net 5 application to Heroku, run this command: |
| 23 | + |
| 24 | +To deploy your application to Heroku, run the following command: |
14 | 25 |
|
15 | 26 | ```bash |
16 | 27 | jhipster heroku |
17 | | -git push heroku main |
18 | 28 | ``` |
19 | 29 |
|
20 | | -This will initialize a new Heroku app and git push your application to Heroku. |
21 | | -Free tier dynos and database addons are used by the generator. A verified Heroku account might be needed to add some of the resources. |
| 30 | +## Databases |
| 31 | + |
| 32 | +- Mysql ✔ |
| 33 | +- Postgres ✔ |
| 34 | +- MSSQL ✔ (requires a manual step described below) |
22 | 35 |
|
23 | | -This Heroku sub-generator is similar to its Java counterpart. Access the documentation at (https://www.jhipster.tech/heroku/). It might provide helpful insight. But keep in mind that there are some differences between both implementations of the Heroku sub-generator. |
| 36 | +Currently MySql and PostgreSQL database addons are free and automatically added by this sub-generator when deploying to Heroku. Even though those resouces are free, an accound with verified credit card is required to add them. |
24 | 37 |
|
25 | | -## Databases |
| 38 | +Heroku's [MSSQL addon](https://elements.heroku.com/addons/mssql) is not free of cost and to avoid unexpected costs It will not be provisioned automatically when deploying to Heroku. |
| 39 | + |
| 40 | +Please visit [the MSSQL addon page](https://elements.heroku.com/addons/mssql), review the pricing and add the MSSQL addon to your account with the following command: |
| 41 | +```bash |
| 42 | +heroku addons:create mssql:REPLACE_PLAN_NAME --as DATABASE --app REPLACE_YOUR_APP_NAME |
| 43 | +``` |
26 | 44 |
|
27 | | -Currently MySql and PostgreSQL are supported and automatically added by the sub-generator when deploying to Heroku. [JawsDB MySQL addon](https://elements.heroku.com/addons/jawsdb) and [Heroku Postgres addon](https://elements.heroku.com/addons/heroku-postgresql) are added to the Heroku app using the free tier. |
| 45 | +## Oauth2 |
28 | 46 |
|
29 | | -Since the [MSSQL addon](https://elements.heroku.com/addons/mssql) is not free it requires manual provisioning. This sub-generator provides instructions on how to manually install the MSSQL addon. |
| 47 | +For applications that use Oauth2 the following manual steps are required: |
30 | 48 |
|
31 | | -Heroku creates an environment variable named `DATABASE_URL` when using database addons. It contains the following structure: `dbType://user:password@server-url:db-port/db-name`. If `DATABASE_URL` is present the database credentials are parsed at `DatabaseConfiguration.cs` to create a properly formed connection string. And it takes precedence over existing connection strings. |
| 49 | + 1. Deploy the application to Heroku using `jhipster heroku`. |
| 50 | + 2. Access your (Heroku Dashboard)[https://dashboard.heroku.com/] and select the app you have just created. |
| 51 | + 3. Under `Installed add-ons` okta should be already installed. |
| 52 | + 4. Click on `okta` to open the addon's Dashboard. |
| 53 | + 5. To configure it follow the documentation (here)[https://jhipsternet.readthedocs.io/en/latest/Features/security.html#okta] |
32 | 54 |
|
33 | | -**Notes:** |
34 | | -The [heroku/nodejs buildpack](https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-nodejs) is also added to the Heroku app. It is a pre-requisite to build Angular/React client applications. |
35 | 55 |
|
36 | | -A `package.json` is automatically added to the root folder as It's required by the heroku/nodejs buildpack, otherwise the application deploy will fail. |
| 56 | +## Limitations |
37 | 57 |
|
38 | | -[Jincod's Heroku .NET Core buildpack](https://github.com/jincod/dotnetcore-buildpack) is used to deploy this .Net 5 application to Heroku. |
| 58 | +Only monolithic deploys are supported at the moment. |
0 commit comments