-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-info.txt
51 lines (38 loc) · 2.41 KB
/
build-info.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
> [!NOTE]
> This project, while currently in operation within my home, is considered legacy. It was
> create as part of self education fairly early on and is not intended for public use. I
> am keeping all of my old self-education projects public for transparancy about my
> educational journey and for posterity. I do not recommend attempting to deploy this
> software in the real world and while it can be used to track my personal and professional
> progress, it should not be seen as a good example of coding or devops best practice. As
> such, I do not recommend beginers use this project for educational purposes or guidance.
This application is segmented in frontend/backend, where the frontend is a react application
and the backend is a FastAPI one.
As FastAPI can serve static files, and the frontent is a single page app, the frontent can be
served by the backend to make deployment one line "uvicorn main:app --reload --host 0.0.0.0"
(or two lines for changing directory first in the daemon bash script)
When deploying, if not using the default fastapi port (8000), you must edit the uri references
within the frontend code. If the IP changes (who's running my very specific project running on
one rpi where the IP is not going to change?) then the IP/address will also need edited here.
The correct address and port info is needed in the following files:
frontend/heating-frontend/src/components/heating-data.jsx
frontend/heating-frontend/package.json
This could be handled with environment varibales but as there are only two places to make
the change and this project is not likely to grow, it would be overkill for my purposes as
of now.
(with the above statement I have just guaranteed that this software will be in production
forever, become a massive codebase and require regular, painful maintenance for the rest
of my life - lol)
https://xkcd.com/2730
With the above stated, the basic process for deployment is:
-git clone repo (containing both frontend and backend)
-cd into frontend/heating-frontend
-edit the files mentioned above with the correct ports and IP/address
-npm install package.json
-npm run build
#---------------------------------------------------------------
creat a venv in the root dir
activate venv
pip install requirements in requirements.txt
create a simple bash script which, activates the venv, and runs:
"uvicorn main:app --reload --host 0.0.0.0" - or a variation of this for your desired port etc