Merge branch 'dev' into NCBACK-35
# Conflicts: # README.md # src/main/java/ru/soune/nocopy/controller/ApiController.java # src/main/java/ru/soune/nocopy/handler/FileEntityHandler.java # src/main/java/ru/soune/nocopy/service/file/FileCleanupService.java # src/main/java/ru/soune/nocopy/service/file/FileEntityService.java # src/main/java/ru/soune/nocopy/service/file/impl/FileUploadServiceImpl.java # src/main/java/ru/soune/nocopy/service/file/impl/ProtectionFileProviderImpl.java
This commit is contained in:
@@ -152,6 +152,345 @@ INSERT INTO referral_levels (id, name, min_invitees, reward_percentage) VALUES
|
||||
('gold', 'GOLD', 16, 22),
|
||||
('platinum', 'PLATINUM', 50, 25);
|
||||
|
||||
-----------------
|
||||
Скрипт,для нумерации для уже сохданных файлов
|
||||
WITH max_id AS (
|
||||
SELECT COALESCE(MAX(support_id), 0) as max_val FROM file_entities
|
||||
),
|
||||
-- Нумеруем только NULL записи, начиная с max_val + 1
|
||||
numbered AS (
|
||||
SELECT
|
||||
f.id,
|
||||
(SELECT max_val FROM max_id) + ROW_NUMBER() OVER (ORDER BY f.created_at, f.id) as new_support_id
|
||||
FROM file_entities f
|
||||
WHERE f.support_id IS NULL
|
||||
)
|
||||
UPDATE file_entities
|
||||
SET support_id = numbered.new_support_id
|
||||
FROM numbered
|
||||
WHERE file_entities.id = numbered.id;
|
||||
|
||||
---------------------------------
|
||||
НАСТРОЙКА NGINX
|
||||
--------------------------------
|
||||
|
||||
# admin.not-copy.com
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name admin.not-copy.com;
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
server_name admin.not-copy.com;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/admin.not-copy.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/admin.not-copy.com/privkey.pem;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://localhost:3003;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:2995;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
|
||||
# workspace.not-copy.com
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name workspace.not-copy.com;
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
server_name workspace.not-copy.com;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/workspace.not-copy.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/workspace.not-copy.com/privkey.pem;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://localhost:3003;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:2998;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
|
||||
# lp.not-copy.com
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name lp.not-copy.com;
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
server_name lp.not-copy.com;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/lp.not-copy.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/lp.not-copy.com/privkey.pem;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://localhost:3003;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:2993;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
|
||||
# dev-admin.not-copy.com
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name dev-admin.not-copy.com;
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
server_name dev-admin.not-copy.com;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/dev-admin.not-copy.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/dev-admin.not-copy.com/privkey.pem;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://localhost:3001;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:2996;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
|
||||
# dev-workspace.not-copy.com
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name dev-workspace.not-copy.com;
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
server_name dev-workspace.not-copy.com;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/dev-workspace.not-copy.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/dev-workspace.not-copy.com/privkey.pem;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://localhost:3001;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:3002;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
|
||||
# dev-lp.not-copy.com
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name dev-lp.not-copy.com;
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
server_name dev-lp.not-copy.com;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/dev-lp.not-copy.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/dev-lp.not-copy.com/privkey.pem;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://localhost:3001;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:2994;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Проверяем конфиг
|
||||
ls -la /etc/nginx/sites-available/
|
||||
ls -la /etc/nginx/sites-enabled/
|
||||
|
||||
# Создание конфига
|
||||
|
||||
sudo nano /etc/nginx/sites-available/not-copy
|
||||
|
||||
# Создание симлинк
|
||||
sudo ln -s /etc/nginx/sites-available/not-copy /etc/nginx/sites-enabled/
|
||||
|
||||
# Чек
|
||||
sudo nginx -t
|
||||
|
||||
# Рестарт
|
||||
sudo systemctl reload nginx
|
||||
|
||||
|
||||
---------------------------------------------
|
||||
|
||||
# ПОЛНАЯ ИНСТРУКЦИЯ: НАСТРОЙКА ПРОКСИ ДЛЯ ОБХОДА БЛОКИРОВОК SEARCHAPI.IO
|
||||
|
||||
## Данные для подключения к прокси-серверу
|
||||
IP: 193.46.217.94
|
||||
Порт HTTP: 3128
|
||||
Порт SOCKS: 1080
|
||||
Логин SSH: root
|
||||
Пароль SSH: u7nRtsD6
|
||||
|
||||
## 1. Настройка прокси-сервера
|
||||
```bash
|
||||
# Подключаемся к серверу
|
||||
ssh root@193.46.217.94
|
||||
# Вводим пароль: u7nRtsD6
|
||||
|
||||
# Обновляем систему и устанавливаем пакеты
|
||||
yum update -y
|
||||
yum install -y epel-release net-tools nano
|
||||
yum install -y 3proxy
|
||||
|
||||
# Создаем конфигурацию
|
||||
mkdir -p /etc/3proxy
|
||||
cat > /etc/3proxy/3proxy.cfg << 'EOF'
|
||||
nserver 8.8.8.8
|
||||
nserver 8.8.4.4
|
||||
timeouts 1 5 30 60 180 1800 15 60
|
||||
daemon
|
||||
log /var/log/3proxy/3proxy.log
|
||||
logformat "- +_L%t.%. %N.%p %E %U %C:%c %R:%r %O %I %h %T"
|
||||
rotate 30
|
||||
auth none
|
||||
allow * * * * *
|
||||
proxy -p3128
|
||||
socks -p1080
|
||||
EOF
|
||||
|
||||
# Создаем папку для логов и запускаем прокси
|
||||
mkdir -p /var/log/3proxy
|
||||
/usr/bin/3proxy /etc/3proxy/3proxy.cfg
|
||||
|
||||
# Проверяем, что запустилось
|
||||
ps aux | grep 3proxy
|
||||
netstat -tulpn | grep -E '3128|1080'
|
||||
|
||||
# Настраиваем файрвол
|
||||
firewall-cmd --permanent --add-port=3128/tcp
|
||||
firewall-cmd --permanent --add-port=1080/tcp
|
||||
firewall-cmd --reload
|
||||
firewall-cmd --list-ports
|
||||
|
||||
# Проверяем локальную работу прокси
|
||||
curl -x http://127.0.0.1:3128 https://api.ipify.org
|
||||
# Должен вернуть: 193.46.217.94
|
||||
|
||||
# Настраиваем автозапуск
|
||||
echo "/usr/bin/3proxy /etc/3proxy/3proxy.cfg" >> /etc/rc.local
|
||||
chmod +x /etc/rc.local
|
||||
|
||||
|
||||
# Проверяем доступность прокси
|
||||
ping -c 4 193.46.217.94
|
||||
curl -x http://193.46.217.94:3128 https://api.ipify.org
|
||||
# Должен вернуть: 193.46.217.94
|
||||
|
||||
# Проверяем работу с SearchAPI через прокси
|
||||
curl -x http://193.46.217.94:3128 "https://www.searchapi.io/api/v1/search?engine=google_lens&api_key=5jyYZC8jSaxhZTwjMUhwtAXi&url=https://dev-workspace.not-copy.com/api/files/public/76d06557-6df1-4fcd-a273-050ec6a35faf&search_type=exact_matches" -o test.json
|
||||
ls -la test.json
|
||||
tail -20 test.json
|
||||
# Файл должен быть полным (заканчиваться на '}')
|
||||
|
||||
|
||||
|
||||
ps aux | grep 3proxy # Проверка статуса
|
||||
netstat -tulpn | grep -E '3128|1080' # Проверка портов
|
||||
tail -f /var/log/3proxy/3proxy.log # Просмотр логов
|
||||
killall 3proxy # Остановка прокси
|
||||
/usr/bin/3proxy /etc/3proxy/3proxy.cfg # Запуск прокси
|
||||
|
||||
|
||||
firewall-cmd --permanent --remove-port=3128/tcp
|
||||
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="IP_ТВОЕГО_СЕРВЕРА" port port="3128" protocol="tcp" accept'
|
||||
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="IP_ТВОЕГО_СЕРВЕРА" port port="1080" protocol="tcp" accept'
|
||||
firewall-cmd --reload
|
||||
|
||||
|
||||
На прокси-сервере:
|
||||
bash
|
||||
ps aux | grep 3proxy # Проверка статуса
|
||||
netstat -tulpn | grep -E '3128|1080' # Проверка портов
|
||||
tail -f /var/log/3proxy/3proxy.log # Просмотр логов
|
||||
killall 3proxy # Остановка прокси
|
||||
/usr/bin/3proxy /etc/3proxy/3proxy.cfg # Запуск прокси
|
||||
|
||||
На основном сервере:
|
||||
bash
|
||||
curl -x http://193.46.217.94:3128 https://api.ipify.org # Проверка прокси
|
||||
telnet 193.46.217.94 3128 # Проверка порта
|
||||
|
||||
------
|
||||
|
||||
Настройка Яндекс Клауд
|
||||
|
||||
Reference in New Issue
Block a user