Skip to content

HostingOnRender

Vianney Doleans edited this page Feb 28, 2023 · 2 revisions

Hosting on Render

This tutorial explain how to host the API on Render.

ℹ️ Render has a free host option for "For hobbyists, students, and indie hackers".

We will create a WebService with Docker option and a PostgreSQL database.

Render

  • Render is a popular option to host apps.
    • Render can also provide the database for free.
  • Render is easy to use (automatic deployment from github repository, not much configuration to do).
    • In case of personal project, perfect for saving time.

Configuration

  • Create a PostgreSQL database on Render. You can use the latest version.
  • Then, Create a Web Service on Render.
  • Connect the repository with GitHub option.
    • You just have to fork the GitHub repository first and then you can interconnect it with your web service.
  • Give a name, select a region, select Master branch as branch and Docker as runtime.
    • Before going to next page, click on Advanced button and specify :
      • Dockerfile Path : ./Dockerfile
      • Environment variables :
        ASPNETCORE_ENVIRONMENT: production
        CONNECTIONSTRINGS__DEFAULT: [your database, ex: Host=(...)-postgres.render.com;Port=5432;Database=(database name);Username=(username);Password=(password);]
        DatabaseProvider: PostgreSQL
        JWT__SECRET: [the secret you want]
        (...) (other settings from appsettings.json inside BlogCoreApi folder of the github project can be changed with the same pattern : uppercase and "__")
        
  • Wait the time needed for Render to deploy the app and then you can open the site https://[YourAppName].onrender.com/swagger.

ps: Render take some time to wake up after a moment of inactivity with free tier

Clone this wiki locally