From d953bc412489e7bc5df18432ceac9bfa8b408a7a Mon Sep 17 00:00:00 2001
From: parsa aghaei
Date: Sun, 12 Jul 2026 15:16:34 +0330
Subject: [PATCH] chore: prepare for production deployment
---
.gitea/workflows/deploy.yml | 28 ++++++++++++++++++++++++++++
nginx.conf | 32 +++++++++++++++++++++++++++++++-
2 files changed, 59 insertions(+), 1 deletion(-)
create mode 100644 .gitea/workflows/deploy.yml
diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml
new file mode 100644
index 00000000..b07a4f79
--- /dev/null
+++ b/.gitea/workflows/deploy.yml
@@ -0,0 +1,28 @@
+name: Deploy Canina
+on:
+ push:
+ branches: [main]
+
+jobs:
+ deploy:
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ shell: sh
+ steps:
+ - name: Install SSH client
+ run: |
+ V=$(cut -d'.' -f1-2 /etc/alpine-release)
+ echo "https://dl-cdn.alpinelinux.org/alpine/v$V/main" > /etc/apk/repositories
+ echo "https://dl-cdn.alpinelinux.org/alpine/v$V/community" >> /etc/apk/repositories
+ apk add --no-cache openssh-client
+ - name: Setup SSH key
+ env:
+ SSH_KEY: ${{ secrets.DEPLOY_KEY }}
+ run: |
+ mkdir -p ~/.ssh
+ echo "$SSH_KEY" > ~/.ssh/id_ed25519
+ chmod 600 ~/.ssh/id_ed25519
+ ssh-keyscan -p 2234 -H 172.17.0.1 >> ~/.ssh/known_hosts
+ - name: Deploy
+ run: ssh -p 2234 devops@172.17.0.1 'bash /opt/services/scripts/depcanina.sh main'
diff --git a/nginx.conf b/nginx.conf
index 324eb5c2..4181926d 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -1,6 +1,6 @@
server {
listen 8080;
- server_name localhost;
+ server_name canina.parsaaghayi.ir;
root /usr/share/nginx/html;
index index.html;
@@ -27,3 +27,33 @@ server {
proxy_cache_bypass $http_upgrade;
}
}
+
+server {
+ listen 8080;
+ server_name admin.canina.parsaaghayi.ir;
+ root /usr/share/nginx/html/admin;
+ index index.html;
+
+ # Security Headers
+ server_tokens off;
+ add_header X-Frame-Options "SAMEORIGIN" always;
+ add_header X-XSS-Protection "1; mode=block" always;
+ add_header X-Content-Type-Options "nosniff" always;
+ add_header Referrer-Policy "no-referrer-when-downgrade" always;
+ add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline' 'unsafe-eval' https://images.unsplash.com https://canina.de;" always;
+
+ # Support for SPA routing
+ location / {
+ try_files $uri $uri/ /index.html;
+ }
+
+ # Proxy API requests to backend
+ location /api {
+ proxy_pass http://backend:3000;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection 'upgrade';
+ proxy_set_header Host $host;
+ proxy_cache_bypass $http_upgrade;
+ }
+}