JJoriping / KKuTu

글자로 놀자! 끄투 온라인
http://jjo.kr/kkutu
GNU General Public License v3.0
328 stars 266 forks source link

SSL 설정 후 KkuTu Server: null 로 뜨는 현상 아시는분 계실까요 #1072

Closed scm1400 closed 1 year ago

scm1400 commented 1 year ago

IS_SECURE = false일 때는 << KkuTu Server: 8496 >> 이라고 출력되고 접속도 됩니다. IS_SECURE = true로 설정 했을 경우에만 << KkuTu Server: null >> 이라고 표시되고 접속이 안되는 현상입니다.

Docker 환경에서 실행하고 있으며, 기본 코드에서 Secure.js 만 수정하고 나머지는 동일합니다.

node:12, postgres:11, pg: "^8.8.0" 사용 중입니다. db에 문제일 수 도 있다는 이슈를 봤는데요, 동일한 경우라고 하기엔 IS_SECURE = false 일 때는 잘 실행 되어서요.

실행 로그에서 에러가 나는 부분은 없어보여서 질문드립니다. 비슷한 문제 겪어보셨거나 어떤게 문제인지 짐작 가시는 분은 댓글 남겨주세요 ㅠ

아래는 실행 로그 입니다. 아래쪽에 << KkuTu Server: null >> 이라고 표시되는 부분이 있습니다.

Attaching to current_web_1, current_game_1, current_db_1
db_1    | 
db_1    | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1    | 
db_1    | 2023-02-18 14:48:46.350 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1    | 2023-02-18 14:48:46.350 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1    | 2023-02-18 14:48:46.353 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1    | 2023-02-18 14:48:46.374 UTC [25] LOG:  database system was shut down at 2023-02-18 14:48:40 UTC
db_1    | 2023-02-18 14:48:46.379 UTC [1] LOG:  database system is ready to accept connections
web_1   | [2023-02-18 14:48:50] << KKuTu Web >>
web_1   | [2023-02-18 14:48:50] OAuth Strategy daldalso is not loaded
web_1   | [2023-02-18 14:48:50] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 14:48:50] OAuth Strategy naver is not loaded
web_1   | [2023-02-18 14:48:50] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 14:48:50] OAuth Strategy facebook is not loaded
web_1   | [2023-02-18 14:48:50] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 14:48:50] OAuth Strategy google is not loaded
web_1   | [2023-02-18 14:48:50] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 14:48:50] OAuth Strategy twitter is not loaded
web_1   | [2023-02-18 14:48:50] OAuthStrategy requires a consumerKey option
web_1   | [2023-02-18 14:48:50] OAuth Strategy kakao is not loaded
web_1   | [2023-02-18 14:48:50] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 14:48:50] OAuth Strategy discord is not loaded
web_1   | [2023-02-18 14:48:50] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 14:48:50] OAuth Strategy twitch is not loaded
web_1   | [2023-02-18 14:48:50] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 14:48:50] OAuth Strategy github is not loaded
web_1   | [2023-02-18 14:48:50] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 14:48:50] OAuth Strategy line is not loaded
web_1   | [2023-02-18 14:48:50] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 14:48:50] OAuth Strategy instagram is not loaded
web_1   | [2023-02-18 14:48:50] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 14:48:50] OAuth Strategy spotify is not loaded
web_1   | [2023-02-18 14:48:50] OAuth2Strategy requires a clientID option
web_1   | (node:13) NOTE: The AWS SDK for JavaScript (v2) will be put into maintenance mode in 2023.
web_1   | 
web_1   | Please migrate your code to use AWS SDK for JavaScript (v3).
web_1   | For more information, check the migration guide at https://a.co/7PzMCcy
web_1   | [2023-02-18 14:48:50] Error from Redis: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
web_1   | [2023-02-18 14:48:50] Run with no-redis mode.
web_1   | [2023-02-18 14:48:50] Game server #1 connected
web_1   | [2023-02-18 14:48:51] DB is ready.
game_1  | [2023-02-18 14:48:50] << KKuTu Server:null >>
game_1  | (node:14) NOTE: The AWS SDK for JavaScript (v2) will be put into maintenance mode in 2023.
game_1  | 
game_1  | Please migrate your code to use AWS SDK for JavaScript (v3).
game_1  | For more information, check the migration guide at https://a.co/7PzMCcy
game_1  | (node:1) NOTE: The AWS SDK for JavaScript (v2) will be put into maintenance mode in 2023.
game_1  | 
game_1  | Please migrate your code to use AWS SDK for JavaScript (v3).
game_1  | For more information, check the migration guide at https://a.co/7PzMCcy
game_1  | [2023-02-18 14:48:50] Error from Redis: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
game_1  | [2023-02-18 14:48:50] Run with no-redis mode.
game_1  | [2023-02-18 14:48:50] Error from Redis: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
game_1  | [2023-02-18 14:48:50] Run with no-redis mode.
game_1  | [2023-02-18 14:48:50] DB is ready.
game_1  | [2023-02-18 14:48:50] Master DB is ready.
game_1  | [2023-02-18 14:48:50] New web server #1
lshqqytiger commented 1 year ago

<< KkuTu Server: null >>은 수 년 전부터 있던 문제이고 이것이 접속 불가 현상의 원인은 아닙니다. null 대신 포트 번호가 뜨게 하려면 slave.js를 아래와 같이 수정해주시면 되지만 접속 불가 현상은 해결되지 않습니다.

// JLog.info(`<< KKuTu Server:${Server.options.port} >>`);
JLog.info(`<< KKuTu Server:${Server.options.port || Server.options.server.port} >>`);
scm1400 commented 1 year ago

답변 감사합니다.

일단 해결은 안될거 알면서도, 말씀해주신 대로 변경해보았는데

이제는 undefined 라고 뜨네요

뭔가 문제가 있긴할지도.. 라는 생각이..

Attaching to current_web_1, current_game_1, current_db_1
game_1  | (node:1) NOTE: The AWS SDK for JavaScript (v2) will be put into maintenance mode in 2023.
game_1  | 
game_1  | Please migrate your code to use AWS SDK for JavaScript (v3).
game_1  | For more information, check the migration guide at https://a.co/7PzMCcy
game_1  | [2023-02-18 15:43:04] Error from Redis: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
game_1  | [2023-02-18 15:43:04] Run with no-redis mode.
game_1  | [2023-02-18 15:43:04] << KKuTu Server:undefined >>
game_1  | (node:14) NOTE: The AWS SDK for JavaScript (v2) will be put into maintenance mode in 2023.
game_1  | 
game_1  | Please migrate your code to use AWS SDK for JavaScript (v3).
game_1  | For more information, check the migration guide at https://a.co/7PzMCcy
game_1  | [2023-02-18 15:43:04] Master DB is ready.
game_1  | [2023-02-18 15:43:05] Error from Redis: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
game_1  | [2023-02-18 15:43:05] Run with no-redis mode.
game_1  | [2023-02-18 15:43:05] DB is ready.
db_1    | 
db_1    | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1    | 
db_1    | 2023-02-18 15:43:00.745 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1    | 2023-02-18 15:43:00.745 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1    | 2023-02-18 15:43:00.748 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1    | 2023-02-18 15:43:00.818 UTC [25] LOG:  database system was shut down at 2023-02-18 15:42:56 UTC
db_1    | 2023-02-18 15:43:00.822 UTC [1] LOG:  database system is ready to accept connections
web_1   | [2023-02-18 15:43:04] << KKuTu Web >>
web_1   | [2023-02-18 15:43:05] OAuth Strategy daldalso is not loaded
web_1   | [2023-02-18 15:43:05] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 15:43:05] OAuth Strategy naver is not loaded
web_1   | [2023-02-18 15:43:05] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 15:43:05] OAuth Strategy facebook is not loaded
web_1   | [2023-02-18 15:43:05] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 15:43:05] OAuth Strategy google is not loaded
web_1   | [2023-02-18 15:43:05] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 15:43:05] OAuth Strategy twitter is not loaded
web_1   | [2023-02-18 15:43:05] OAuthStrategy requires a consumerKey option
web_1   | [2023-02-18 15:43:05] OAuth Strategy kakao is not loaded
web_1   | [2023-02-18 15:43:05] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 15:43:05] OAuth Strategy discord is not loaded
web_1   | [2023-02-18 15:43:05] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 15:43:05] OAuth Strategy twitch is not loaded
web_1   | [2023-02-18 15:43:05] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 15:43:05] OAuth Strategy github is not loaded
web_1   | [2023-02-18 15:43:05] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 15:43:05] OAuth Strategy line is not loaded
web_1   | [2023-02-18 15:43:05] OAuth2Strategy requires a clientID option
game_1  | [2023-02-18 15:43:05] New web server #1
web_1   | [2023-02-18 15:43:05] OAuth Strategy instagram is not loaded
web_1   | [2023-02-18 15:43:05] OAuth2Strategy requires a clientID option
web_1   | [2023-02-18 15:43:05] OAuth Strategy spotify is not loaded
web_1   | [2023-02-18 15:43:05] OAuth2Strategy requires a clientID option
web_1   | (node:13) NOTE: The AWS SDK for JavaScript (v2) will be put into maintenance mode in 2023.
web_1   | 
web_1   | Please migrate your code to use AWS SDK for JavaScript (v3).
web_1   | For more information, check the migration guide at https://a.co/7PzMCcy
web_1   | [2023-02-18 15:43:05] Error from Redis: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
web_1   | [2023-02-18 15:43:05] Run with no-redis mode.
web_1   | [2023-02-18 15:43:05] Game server #1 connected
web_1   | [2023-02-18 15:43:05] DB is ready.
scm1400 commented 1 year ago

http 로 접근하면 페이지는 안뜨지만 https url로 리다이렉트 되는 부분은 동작하는게, 이 부분이 동작하는 것처럼 보이네요

이 부분 주석하면 http 연결시 화면이 표시가됩니다. 게임 시작 버튼을 눌렀을 때 연결은 안되지만요

Server.use((req, res, next) => {
    if (Const.IS_SECURED) {
        if (req.protocol == "http") {
            let url = "https://" + req.get("host") + req.path;
            res.status(302).redirect(url);
        } else {
            next();
        }
    } else {
        next();
    }
});
lshqqytiger commented 1 year ago

테스트를 잘못했었네요 아래처럼 하시면 될겁니다.

setTimeout(() => console.log(`<< KKuTu Server:${Server.options.port || Server.options.server.address().port} >>`), 100);

https로 접속이 안되는건 끄투 자체 문제는 아닌 걸로 보이고 서버 설정 문제인 것 같습니다.

scm1400 commented 1 year ago

늦은 시간까지 답변해주셔서 감사합니다 ㅠ

시간 되실 떄 진단 한번 해주시면 감사하겠습니다 ㅠㅠ http://zep-kkutu.online/?server=0 https://zep-kkutu.online/?server=0

타임아웃이 나네요.. image

scm1400 commented 1 year ago

nginx reverse proxy 사용하는 방식으로 변경해서 해결했습니다.

이슈 닫습니다!