Skip to content

Commit f3ba2cd

Browse files
committed
Added files for ubuntu server depolyment
1 parent cf93d79 commit f3ba2cd

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

env.simple

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
DATABASE_URL=
22
SECRET_KEY=
33
ALGORITHM =
4-
ACCESS_TOKEN_EXPIRE_MINUTES =
4+
ACCESS_TOKEN_EXPIRE_MINUTES =
5+
TEST_DATABASE_URL=
6+
DOCKER_ACCESS_TOKEN=

gunicorn.service

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[Unit]
2+
Description=FastAPI App Service
3+
After=network.target
4+
5+
[Service]
6+
User=cot_user
7+
Group=cot_user
8+
WorkingDirectory=/home/cot_user/app/src/
9+
Environment="PATH=/home/cot_user/app/venv/bin"
10+
EnvironmentFile=/home/cot_user/.env
11+
ExecStart=/home/cot_user/app/venv/bin/gunicron -w 4 -k uvicorn.workers.UvicornWorker app.main:app --bind 0.0.0.0:8000
12+
Restart=always
13+
RestartSec=3
14+
15+
[Install]
16+
WantedBy=multi-user.target

nginx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
server {
2+
listen 80;
3+
listen [::] 80;
4+
server_name _;
5+
6+
location / {
7+
proxy_pass http://localhost:8000;
8+
proxy_set_header Host $host;
9+
proxy_set_header X-Real-IP $remote_addr;
10+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
11+
proxy_set_header Upgrade $http_upgrade;
12+
proxy_set_header Connection "upgrade";
13+
proxy_set_header X-NginX-Proxy true;
14+
proxy_redirect off;
15+
}
16+
}

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ email_validator==2.2.0
1010
fastapi==0.115.12
1111
fastapi-cli==0.0.7
1212
greenlet==3.2.1
13+
gunicorn==23.0.0
1314
h11==0.16.0
1415
httpcore==1.0.9
1516
httptools==0.6.4

0 commit comments

Comments
 (0)