Skip to content

Commit 9d42deb

Browse files
committed
config: update service urls and nginx upstream configuration
1 parent f9cc81c commit 9d42deb

File tree

3 files changed

+82
-1
lines changed

3 files changed

+82
-1
lines changed

backend/config/lexicon.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,6 @@
7979
"schedule_modal_label": "📅 Час публікації (UTC)",
8080
"schedule_success": "🕒 Пост успішно заплановано на *{scheduled_at}* UTC!\n\n_Ви можете побачити його у вкладці Home._",
8181
"schedule_no_time_error": "⚠️ Вкажіть час публікації у формі нижче.",
82+
# --- Publish Error Notification ---
83+
"publish_error_notification": "❌ *Publication error*\n\n*Platform:* {platform}\n*Draft ID:* {post_id}\n*Error:* `{error_message}`",
8284
}

backend/config/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ class Settings(BaseSettings):
5151
# Slack
5252
SLACK_BOT_TOKEN: SecretStr = Field(default=SecretStr(""))
5353
SLACK_SIGNING_SECRET: SecretStr = Field(default=SecretStr(""))
54+
SLACK_LOG_CHANNEL: str = "C077Z79HB0V"
5455
# n8n
55-
N8N_WEBHOOK_URL: str = "http://127.0.0.1:5678/webhook/publish-post"
56+
N8N_WEBHOOK_URL: str = "http://n8n:5678/webhook/publish-post"
5657
# Pydantic configuration
5758
model_config = SettingsConfigDict(
5859
env_file=".env", env_file_encoding="utf-8", extra="ignore"

infra/nginx/nginx.conf

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
upstream optifood_backend {
2+
server 127.0.0.1:8000;
3+
}
4+
5+
upstream seratonin_backend {
6+
server 127.0.0.1:8001;
7+
}
8+
9+
server {
10+
server_name optifood-ai.duckdns.org;
11+
12+
client_max_body_size 20M;
13+
14+
# Block scanners and hidden files
15+
location ~ /\.(?!well-known).* {
16+
deny all;
17+
access_log off;
18+
log_not_found off;
19+
}
20+
21+
location ~* /(vendor|phpunit|laravel|wp-admin|wp-content|backup|myadmin|setup|config) {
22+
access_log off;
23+
log_not_found off;
24+
return 444;
25+
}
26+
27+
location ~* \.php$ {
28+
access_log off;
29+
log_not_found off;
30+
return 444;
31+
}
32+
33+
# Optifood (root)
34+
location / {
35+
proxy_pass http://optifood_backend;
36+
proxy_set_header Host $host;
37+
proxy_set_header X-Real-IP $remote_addr;
38+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
39+
proxy_set_header X-Forwarded-Proto $scheme;
40+
proxy_connect_timeout 60s;
41+
proxy_read_timeout 120s;
42+
proxy_send_timeout 120s;
43+
}
44+
45+
# Seratonin — strip /seratonin prefix before passing to FastAPI
46+
location /seratonin/ {
47+
proxy_pass http://seratonin_backend/;
48+
proxy_set_header Host $host;
49+
proxy_set_header X-Real-IP $remote_addr;
50+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
51+
proxy_set_header X-Forwarded-Proto $scheme;
52+
proxy_connect_timeout 60s;
53+
proxy_read_timeout 120s;
54+
proxy_send_timeout 120s;
55+
}
56+
57+
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
58+
add_header X-Frame-Options SAMEORIGIN;
59+
add_header X-Content-Type-Options nosniff;
60+
add_header X-XSS-Protection "1; mode=block";
61+
62+
listen 443 ssl;
63+
ssl_certificate /etc/letsencrypt/live/optifood-ai.duckdns.org/fullchain.pem;
64+
ssl_certificate_key /etc/letsencrypt/live/optifood-ai.duckdns.org/privkey.pem;
65+
include /etc/letsencrypt/options-ssl-nginx.conf;
66+
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
67+
}
68+
69+
server {
70+
listen 80;
71+
server_name optifood-ai.duckdns.org;
72+
73+
if ($host = optifood-ai.duckdns.org) {
74+
return 301 https://$host$request_uri;
75+
}
76+
77+
return 404;
78+
}

0 commit comments

Comments
 (0)