Skip to content

Commit cb90058

Browse files
authored
Merge pull request #99 from Capstone-Projects-2025-Spring/omarshakir8-patch-hostingDOC
Update Hosting.md
2 parents 20633a0 + 9f1cef6 commit cb90058

File tree

1 file changed

+122
-1
lines changed

1 file changed

+122
-1
lines changed
Lines changed: 122 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,125 @@
11
---
22
sidebar_position: 10
33
---
4-
# Hosting for Feedstack
4+
# Hosting for Feedstack
5+
Step 1: Authenticate with Fly.io
6+
--------------------------------
7+
8+
```
9+
flyctl auth login
10+
```
11+
12+
* * * * *
13+
14+
Step 2: Initialize the Application
15+
----------------------------------
16+
17+
If deploying for the first time, initialize the app from the project root:
18+
19+
```
20+
flyctl launch
21+
```
22+
23+
This will:
24+
25+
- Generate a `fly.toml` configuration file
26+
27+
- Register the application name
28+
29+
- Allow you to choose a deployment region
30+
31+
If already initialized, this step can be skipped.
32+
33+
* * * * *
34+
35+
Step 3: Configure Environment Variables
36+
---------------------------------------
37+
38+
Feedstack requires several secrets to function. These are set securely using the Fly.io CLI:
39+
40+
```
41+
flyctl secrets set\
42+
OPENAI_API_KEY=your_openai_key\
43+
DJANGO_SECRET_KEY=your_django_secret_key\
44+
FRONTEND_URL=https://feedstack.fly.dev\
45+
ALLOWED_HOSTS=.fly.dev
46+
```
47+
48+
* * * * *
49+
50+
Step 4: Deploy the Application
51+
------------------------------
52+
53+
To build and deploy the containerized application:
54+
55+
```
56+
flyctl deploy
57+
```
58+
59+
This command will:
60+
61+
- Build the Docker image using the provided `Dockerfile`
62+
63+
- Upload it to Fly.io
64+
65+
- Deploy it to the specified region
66+
67+
- Expose it at a live HTTPS URL
68+
69+
* * * * *
70+
71+
Step 5: Monitor Logs
72+
--------------------
73+
74+
You can monitor the live output of your application using:
75+
76+
```
77+
flyctl logs
78+
```
79+
80+
This is useful for real-time debugging and validation.
81+
82+
* * * * *
83+
84+
Step 6: `fly.toml` Configuration (Example)
85+
------------------------------------------
86+
87+
The `fly.toml` file defines the Fly.io app settings. Here is a sample:
88+
89+
```
90+
app = "feedstack"
91+
92+
[build]
93+
dockerfile = "Dockerfile"
94+
95+
[env]
96+
DJANGO_SETTINGS_MODULE = "feedstack.settings.production"
97+
PYTHONUNBUFFERED = "1"
98+
99+
[[services]]
100+
internal_port = 8000
101+
protocol = "tcp"
102+
103+
[[services.ports]]
104+
handlers = ["http"]
105+
port = 80
106+
107+
[[services.ports]]
108+
handlers = ["tls", "http"]
109+
port = 443
110+
```
111+
112+
* * * * *
113+
114+
Step 7: Redeployment
115+
--------------------
116+
117+
After making updates to the codebase (either backend or frontend), re-deploy the application with:
118+
119+
```
120+
flyctl deploy
121+
```
122+
123+
This rebuilds the image and pushes it live with zero downtime.
124+
125+
* * * * *

0 commit comments

Comments
 (0)