Skip to content

Commit 7785010

Browse files
authored
Merge pull request #62 from tecladocode/jose/cou-99-write-rendercom-deployments-section
2 parents 978213c + d0bb585 commit 7785010

File tree

19 files changed

+522
-3
lines changed

19 files changed

+522
-3
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ __pycache__/
55
*.db
66
.DS_Store
77
venv/
8-
.venv/
8+
.venv/
9+
docs/docs/.nota/config.ini

docs/docs-upcoming/10_deploy_to_render/01_project_overview/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/docs-upcoming/10_deploy_to_render/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Overview of this section
2+
3+
In this section, we will figure out how to get our Flask app and put it on a public server so other people can interact with it! This is called "deploying".
4+
5+
There are many services we can use to deploy our app. Most of them have some sort of "free tier" so that you can try the deployment without having to pay anything. Usually, if you want better performance or unlimited usage, you have to pay.
6+
7+
Remember that just as we run the Flask app in our computers, when we deploy it the app runs in a server, somewhere in the world. For all intents and purposes, the server is just like our computer!
8+
9+
Servers usually run Linux, so we can deploy our Docker images without a performance hit as we would using Mac or Windows.
10+
11+
At the end of the section, you'll be able to access your API using a URL such as [https://rest-api-smorest-docker.onrender.com](https://rest-api-smorest-docker.onrender.com).
12+
13+
For this section, our deployment will be completely free. We will deploy our Flask app for free, and we will also get a free PostgreSQL database on the cloud using ElephantSQL.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Creating a Render.com web service
2+
3+
Let's start by going to [https://render.com](https://render.com) and signing up to an account. You can "Log in with GitHub" to make things easier.
4+
5+
Once you've logged in, you'll see in your [Dashboard](https://dashboard.render.com/services) that you can create a new service using a button at the top right of the page.
6+
7+
Click it, and select "Web Service".
8+
9+
Options other than "Web Service" are useful for different kinds of applications, and some are databases that you can use (but not for free, so we won't use Render for our database in this section).
10+
11+
Then you'll [connect your GitHub account](https://render.com/docs/github) if you haven't already, and look for your repositories.
12+
13+
Select the repository that you created during this course:
14+
15+
![Render.com screenshot showing how to search for and select a repository to connect to from GitHub](./assets/render-github-connect.png)
16+
17+
Then, give it a name and make sure the configuration is as follows:
18+
19+
![Render.com screenshot showing the web service configuration](./assets/render-service-config.png)
20+
21+
- Make sure "Docker" is selected.
22+
- Select a server location close to you. I'm near Frankfurt, but if you are in the US or Asia you might want to choose a different one so it's faster to connect to.
23+
- Select the "Free" server option.
24+
25+
At the bottom of the service there is an "Advanced" section which you can use to further configure your service. We'll talk more about that in a bit.
26+
27+
For now, hit "Create Web Service" and wait for it to deploy your code from GitHub!
28+
29+
If you navigate to your Dashboard and then click through to your newly created service, you'll be able to see the service details. If it isn't already deploying, click on the "Manual Deploy" button on the top right to initiate a deploy of the latest commit:
30+
31+
![](./assets/deploy-latest-commit.png)
32+
33+
Then you should start seeing logs appear detailing the deployment process!
34+
35+
![](./assets/render-deploy-screen.png)
36+
37+
While on the free plan, deployments are a bit slow. It has to build your image and run it! Give it a few minutes, until the deployment succeeds. You should see this:
38+
39+
![](./assets/render-deploy-finished.png)
40+
41+
Now, you can access your service URL and try it out using Insomnia or Postman!
42+
43+
![](./assets/insomnia-test-prod.png)
44+
45+
:::warning
46+
Free services in Render.com shut down after inactivity for a few minutes. If you don't use your service for a few minutes, it will shut down and it will need to restart, which can take a minute! This is one of the limitations of their free plan.
47+
:::
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)