Compare commits

14 Commits

Author SHA1 Message Date
valitovgaziz 61cffcf26c fix: correct CI/CD paths and update AGENTS.md for main_dc structure
Deploy api_yal / build-and-deploy (push) Failing after 56s
2026-06-13 04:45:32 +05:00
valitovgaziz 5ef0a861e3 merge: develop into main — unify branches, resolve conflicts 2026-06-13 04:44:16 +05:00
valitovgaziz 2132c1de14 docs: add AGENTS.md codebase map, bump Go version, clean gitignore
Deploy / build-and-deploy (push) Failing after 47s
2026-06-13 01:57:54 +05:00
valitovgaziz 165d5a5fc6 ci: test runner with network config fix
Deploy / build-and-deploy (push) Failing after 55s
2026-06-12 17:48:29 +05:00
valitovgaziz 322334e7e2 ci: trigger fresh build with DOCKER_NETWORK fix
Deploy / build-and-deploy (push) Failing after 48s
2026-06-12 17:44:09 +05:00
valitovgaziz c26f916525 ci: test runner with DOCKER_NETWORK fix
Deploy / build-and-deploy (push) Failing after 46s
2026-06-12 17:41:38 +05:00
valitovgaziz 7223ced88d ci: add Gitea Actions deploy workflow
Deploy / build-and-deploy (push) Failing after 42s
2026-06-12 17:32:03 +05:00
valitovgaziz 5de587689c security: rotate secrets, add rate limiter, validate input, harden cookies 2026-06-12 17:01:48 +05:00
valitovgaziz 9f4fb23652 set volumes for api, postgres-db, goose 2025-05-07 16:42:30 +05:00
valitovgaziz c5d10d3b5d uncomment and replace mail name and delete hiphen on init scripts 2025-05-07 16:38:35 +05:00
valitovgaziz 8a8ee12779 comment migrator 2025-05-07 16:36:03 +05:00
valitovgaziz 44a6725a8e add nginx docer image, add certbote image, set settings for 2025-05-07 16:21:30 +05:00
valitovgaziz c86d4bbf41 Merge https://gitverse.ru/valitovgaziz/tp 2025-05-07 15:58:53 +05:00
root d6a041df99 Fix the servers docker plugin 2025-05-06 15:50:53 +05:00
5 changed files with 191 additions and 15 deletions
+24
View File
@@ -0,0 +1,24 @@
name: Deploy api_yal
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Go binary (api_yal)
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace/main_dc/yalarba/api_yal \
golang:1.26.0-alpine \
sh -c 'CGO_ENABLED=0 GOOS=linux go build -o /workspace/main_dc/yalarba/api_yal/bin/api_yal ./cmd/main.go'
- name: Copy binary and restart service
run: |
cp main_dc/yalarba/api_yal/bin/api_yal /home/gaziz/artefacts/tp/main_dc/yalarba/api_yal/bin/api_yal
docker compose -f /home/gaziz/artefacts/tp/main_dc/docker-compose.yml restart api_yal
+25 -15
View File
@@ -1,4 +1,7 @@
/spa/node_modules /spa/node_modules
.env
# Logs
logs logs
*.log *.log
npm-debug.log* npm-debug.log*
@@ -6,32 +9,39 @@ yarn-debug.log*
yarn-error.log* yarn-error.log*
pnpm-debug.log* pnpm-debug.log*
lerna-debug.log* lerna-debug.log*
node_modules node_modules
*.node_modules
/node_modules
/.pnp
.pnp.js
.DS_Store .DS_Store
dist
dist-ssr
coverage coverage
/coverage
/build
*.local *.local
.env.local
.env.development.local
.env.test.local
.env.production.local
/cypress/videos/ /cypress/videos/
/cypress/screenshots/ /cypress/screenshots/
# Editor directories and files
.vscode/* .vscode/*
.vscode/extensions.json !.vscode/extensions.json
.idea .idea
*.suo *.suo
*.ntvs* *.ntvs*
*.njsproj *.njsproj
*.sln *.sln
*.sw? *.sw?
*.tsbuildinfo *.tsbuildinfo
*.node_modules
/node_modules # Binaries
/.pnp api/bin/
.pnp.js
/coverage
/build
.env.local
.env.development.local
.env.test.local
.env.production.local
dist
dist-ssr
!.vscode/extensions.json
.vscode/extensions.json
+103
View File
@@ -0,0 +1,103 @@
# YalArba (ЯлАрба) — Tourist Aggregator
**Updated:** 2026-06-13
**Branch:** main (merged develop)
## OVERVIEW
Multi-service platform: Go REST APIs + Vue3/Nuxt SPAs + Nginx reverse proxy + Certbot SSL.
All deployable code lives under `main_dc/`. Docker Compose orchestrates ~10 services across 4 Docker networks.
PostgreSQL databases, JWT auth, Gitea Actions CI/CD.
## STRUCTURE
```
main_dc/
├── docker-compose.yml # All services (nginx, certbot, db, apis, spas)
├── Makefile # Per-service build/restart targets
├── .env # Environment variables (DO NOT COMMIT)
├── certbot/ # Let's Encrypt auto-renewal
├── nginx/ # Reverse proxy + SSL termination
├── stubSite/ # Maintenance/placeholder page
├── valitovgaziz/ # Personal site + analytics
│ ├── html/ # Static site (valitovgaziz.ru)
│ └── analytics/ # Node.js analytics server
├── BB/ # «Бегущий Башкир» project
│ ├── api_bb/ # Go REST API (chi + GORM)
│ └── bbvue/ # Vue3 SPA frontend
└── yalarba/ # YalArba platform
├── api_tp/ # Go API — auth + users (chi + GORM)
├── api_yal/ # Go API — accounts, objects, ratings (DDD)
├── api_es/ # Go API — easysite102 backend
├── easySite/ # Nuxt.js SPA (easysite102.ru)
├── serv_spa/ # Vue3 SPA (yalarba.ru frontend)
└── tourism_types/ # Tourism classification data
```
## KEY SERVICES
| Service | Port | Tech | Description |
|---------|------|------|-------------|
| nginx | 80, 443 | Nginx | Reverse proxy, SSL, static files |
| certbot | — | Certbot | Auto-renew Let's Encrypt certs |
| db | 5432 | PostgreSQL 15 | Main DB (yalarba + easysite) |
| db_bb | 5433 | PostgreSQL 15 | «Бегущий Башкир» DB |
| api_tp | 8888 | Go/Chi/GORM | Auth + user management |
| api_yal | 8787 (internal) | Go/Chi/GORM | Accounts, objects, ratings |
| api_es | 8088 (internal) | Go/Chi/GORM | easysite102 backend |
| api_bb | 7777 | Go/Chi/GORM | «Бегущий Башкир» backend |
| easysite | 3000 | Nuxt.js | easysite102.ru frontend |
| analytics | 9999 | Node.js | valitovgaziz.ru analytics |
## WHERE TO LOOK
| Task | Location |
|------|----------|
| YalArba auth API | `main_dc/yalarba/api_tp/` |
| YalArba business logic (DDD) | `main_dc/yalarba/api_yal/internal/domain/` |
| Main SPA (Vue3) | `main_dc/yalarba/serv_spa/spa/vue/` |
| EasySite (Nuxt) | `main_dc/yalarba/easySite/easySite/` |
| Nginx config | `main_dc/nginx/nginx-ssl.conf` |
| Docker compose | `main_dc/docker-compose.yml` |
| CI/CD workflow | `.gitea/workflows/deploy.yml` |
| Personal site | `main_dc/valitovgaziz/html/` |
## CODE MAP — api_yal (main business logic)
| Symbol | Location | Role |
|--------|----------|------|
| `main` | `main_dc/yalarba/api_yal/cmd/main.go` | Entry point |
| `router.SetupRoutes` | `main_dc/yalarba/api_yal/internal/router/router.go` | Chi routes + middleware |
| `domain/auth` | `main_dc/yalarba/api_yal/internal/domain/auth/` | Login, Register, JWT, refresh tokens |
| `domain/account` | `main_dc/yalarba/api_yal/internal/domain/account/` | User profile CRUD |
| `domain/object` | `main_dc/yalarba/api_yal/internal/domain/object/` | Tourist objects CRUD |
| `domain/rating` | `main_dc/yalarba/api_yal/internal/domain/rating/` | Ratings (stub) |
| `domain/comment` | `main_dc/yalarba/api_yal/internal/domain/comment/` | Comments (stub) |
| `domain/feetback` | `main_dc/yalarba/api_yal/internal/domain/feetback/` | Feedback (stub) |
| `models` | `main_dc/yalarba/api_yal/internal/models/` | GORM models |
| `repository` | `main_dc/yalarba/api_yal/internal/repository/` | DB access layer |
| `middleware` | `main_dc/yalarba/api_yal/internal/middleware/` | Auth, admin, logging, context |
## CONVENTIONS
- **Go**: Chi router, GORM, PostgreSQL. DDD-layered (handler → service → repository).
- **Auth**: JWT in HttpOnly/Secure/SameSite cookies. Context key: user claims.
- **Config**: Environment variables via `.env` files, loaded by docker-compose.
- **DB Migrations**: Manual SQL in `main_dc/yalarba/api_tp/migrations/`.
- **Naming**: Go — short package names. Vue — PascalCase components.
## CI/CD
- **Trigger**: Push to `main` branch
- **Workflow**: `.gitea/workflows/deploy.yml`
- **What it does**: Builds `api_yal` Go binary → copies to server → restarts container
- **Manual deploy**: Use `make` targets from `main_dc/Makefile`:
```bash
# On server:
make api_yal # Full cycle: stop → pull → build → start api_yal
make all # Full cycle for ALL services
make restart # Quick restart all
make nginx # Rebuild nginx
```
## NOTES
- `.env` and `*.env` files contain secrets — **never commit**.
- The old `api/`, `spa/`, `migrator/` at repo root are deleted; all code is in `main_dc/`.
- `develop` branch was merged into `main` on 2026-06-13.
- Google Goose migrations were removed; migrations are plain SQL in `api_tp/migrations/`.
+25
View File
@@ -0,0 +1,25 @@
server {
listen 80;
server_name yalarba.ru www.yalarba.ru;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name yalarba.ru www.yalarba.ru;
ssl_certificate /etc/letsencrypt/live/yalarba.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yalarba.ru/privkey.pem;
location / {
root /usr/share/nginx/html;
index index.html;
}
}
+14
View File
@@ -0,0 +1,14 @@
#!/bin/sh
# Убедитесь, что домены указаны правильно
domains="yalarba.ru www.yalarba.ru"
email="valitovgaziz@yandex.ru" # Замените на реальный email
# Создаём временный контейнер Nginx для верификации
docker compose up -d nginx
# Запускаем Certbot для получения сертификатов
docker compose run --rm certbot certonly --webroot --webroot-path /var/www/certbot --email $email --agree-tos --no-eff-email -d $domains --force-renewal
# Перезапускаем Nginx с новыми сертификатами
docker compose restart nginx