Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 16cdb95ffc | |||
| 733660c52f | |||
| 258199bf0a |
+12
-13
@@ -1,24 +1,23 @@
|
||||
name: Deploy api_yal
|
||||
name: Deploy
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build Go binary (api_yal)
|
||||
- name: Pull latest main
|
||||
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'
|
||||
cd /home/gaziz/artefacts/tp
|
||||
git pull origin main
|
||||
|
||||
- name: Copy binary and restart service
|
||||
- name: Rebuild changed services
|
||||
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
|
||||
cd /home/gaziz/artefacts/tp/main_dc
|
||||
docker compose build
|
||||
docker compose up -d --remove-orphans
|
||||
|
||||
- name: Cleanup old images
|
||||
run: docker image prune -f
|
||||
|
||||
+17
-25
@@ -1,7 +1,4 @@
|
||||
/spa/node_modules
|
||||
.env
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
@@ -9,39 +6,34 @@ yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
*.node_modules
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
.DS_Store
|
||||
dist
|
||||
dist-ssr
|
||||
coverage
|
||||
/coverage
|
||||
/build
|
||||
*.local
|
||||
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
/cypress/videos/
|
||||
/cypress/screenshots/
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.vscode/extensions.json
|
||||
.idea
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
*.tsbuildinfo
|
||||
|
||||
# Binaries
|
||||
api/bin/
|
||||
*.node_modules
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
/coverage
|
||||
/build
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
dist
|
||||
dist-ssr
|
||||
!.vscode/extensions.json
|
||||
.vscode/extensions.json
|
||||
.gigacode/*
|
||||
.gigacode
|
||||
@@ -1,103 +0,0 @@
|
||||
# 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/`.
|
||||
@@ -1,25 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user