mirror of
https://git.hmsn.ink/kospo/helptalk/api.git
synced 2026-03-20 00:22:26 +09:00
first
This commit is contained in:
223
readme.md
Normal file
223
readme.md
Normal file
@@ -0,0 +1,223 @@
|
||||
# nginx.conf 설정
|
||||
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 4096;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
|
||||
types_hash_max_size 4096;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
||||
|
||||
|
||||
# default.conf 설정
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
location /js/service-worker.js {
|
||||
alias /appl/module/talk/js/service-worker.js;
|
||||
}
|
||||
|
||||
location /manual {
|
||||
alias /appl/manual/;
|
||||
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
location /stomp {
|
||||
proxy_pass http://ap-block;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
# websocket connection alive
|
||||
proxy_read_timeout 36000s;
|
||||
proxy_send_timeout 36000s;
|
||||
|
||||
# websocket buffer setting
|
||||
proxy_buffer_size 128k;
|
||||
proxy_buffers 8 256k;
|
||||
proxy_busy_buffers_size 512k;
|
||||
|
||||
# large data process setting
|
||||
client_max_body_size 16M;
|
||||
client_body_buffer_size 16M;
|
||||
|
||||
#temp file setting
|
||||
proxy_max_temp_file_size 16M;
|
||||
proxy_temp_file_write_size 256k;
|
||||
|
||||
# request buffer disable
|
||||
proxy_request_buffering off;
|
||||
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://ap-block;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
|
||||
proxy_set_header Cookie $http_cookie;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
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;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
}
|
||||
|
||||
location / {
|
||||
expires 1s;
|
||||
root /appl/module;
|
||||
|
||||
index index.html index.htm;
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
add_header Pragma "no-cache";
|
||||
add_header Expires 0;
|
||||
}
|
||||
}
|
||||
|
||||
upstream ap-block {
|
||||
least_conn;
|
||||
server hmsn.ink:8010;
|
||||
server hmsn.ink:8020;
|
||||
}
|
||||
|
||||
# k6 부하테스트
|
||||
|
||||
docker run --rm -v /volume5/dev/k6:/k6 k6-stomp --console-output=/k6/output.log /k6/k6.js
|
||||
|
||||
docker run --name xk6-stomp -v "/volume5/dev/k6:/xk6" grafana/xk6 build \
|
||||
--with github.com/walterwanderley/xk6-stomp
|
||||
|
||||
|
||||
docker run --rm -v "/volume5/dev/k6:/xk6" -w /xk6 grafana/xk6 build --with github.com/walterwanderley/xk6-stomp
|
||||
|
||||
docker run --rm -v "/volume5/dev/k6:/xk6" -w /xk6 debian:bullseye-slim ./k6 run /xk6/script.js
|
||||
|
||||
|
||||
# rabbitmq stomp 실행
|
||||
|
||||
rabbitmq-plugins enable rabbitmq_stomp
|
||||
|
||||
# rabbitmq 포트 설명
|
||||
5672 - AMQP:
|
||||
|
||||
기본 AMQP (Advanced Message Queuing Protocol) 포트
|
||||
클라이언트 애플리케이션이 메시지를 주고받는 데 사용
|
||||
5671 - AMQP/SSL:
|
||||
|
||||
SSL을 통한 암호화된 AMQP 연결에 사용
|
||||
15672 - HTTP API 및 관리 UI:
|
||||
|
||||
RabbitMQ 관리 플러그인용 웹 인터페이스
|
||||
HTTP API 엔드포인트
|
||||
61613 - STOMP:
|
||||
|
||||
STOMP (Simple Text Oriented Messaging Protocol) 클라이언트 연결용
|
||||
STOMP 플러그인이 활성화되어 있어야 함
|
||||
61614 - STOMP/SSL:
|
||||
|
||||
SSL을 통한 암호화된 STOMP 연결에 사용
|
||||
1883 - MQTT:
|
||||
|
||||
MQTT (Message Queuing Telemetry Transport) 클라이언트 연결용
|
||||
MQTT 플러그인이 활성화되어 있어야 함
|
||||
8883 - MQTT/SSL:
|
||||
|
||||
SSL을 통한 암호화된 MQTT 연결에 사용
|
||||
15674 - STOMP over WebSockets:
|
||||
|
||||
웹 브라우저에서 STOMP 프로토콜을 사용하기 위한 WebSocket 연결
|
||||
15675 - MQTT over WebSockets:
|
||||
|
||||
웹 브라우저에서 MQTT 프로토콜을 사용하기 위한 WebSocket 연결
|
||||
25672 - 노드 간 및 CLI 도구 통신:
|
||||
|
||||
RabbitMQ 노드 간 통신 및 rabbitmqctl 같은 CLI 도구와의 통신에 사용
|
||||
4369 - epmd (Erlang Port Mapper Daemon):
|
||||
|
||||
Erlang 노드 검색을 위해 사용
|
||||
이 중에서 STOMP 관련 포트는 다음과 같습니다:
|
||||
|
||||
61613: 일반 STOMP 연결
|
||||
61614: SSL을 통한 STOMP 연결
|
||||
15674: WebSocket을 통한 STOMP 연결
|
||||
|
||||
# 외부 연계 api
|
||||
url: http://{url}/api/message
|
||||
method: post
|
||||
|
||||
parameter
|
||||
{
|
||||
"type": "MESSAGE",
|
||||
"talkId": "0b98e848d5c548a086a9ebf67223416c",
|
||||
"message": "작업지시번호 [ORD2024828912] 진행 완료"
|
||||
}
|
||||
|
||||
result
|
||||
200 : success
|
||||
|
||||
|
||||
# pg_bigm 설치
|
||||
빌드 도구
|
||||
postgresql-devel build-essential gcc make
|
||||
|
||||
git pg_bigm tar.gz 파일 다운로드
|
||||
make
|
||||
sudo make install
|
||||
|
||||
postgresql.conf
|
||||
shared_preload_libraries = 'pg_bigm'
|
||||
|
||||
postgresql 재시작
|
||||
|
||||
모듈 활성화
|
||||
create extension pg_bigm;
|
||||
|
||||
활성화 된 모듈 조회
|
||||
select * from pg_extension
|
||||
|
||||
index 생성
|
||||
create index idx_talk_message_full_search on talk_message(message text_pattern_ops);
|
||||
|
||||
Reference in New Issue
Block a user