1. Overview


 

원격 서버의 소스를 편리하게 작업할 수 있는 VScode "Remote VScode"를 통해 작업할 경우 원격 서버의 코드 파일이 로컬 드라이브에 저장된다.

 

 

 

2. Body


 

코드가 저장되는 경로는 다음과 같다.

C:\Users\[UserName]\AppData\Local\Temp\[랜덤명]\[remote_server_path]

 

[그림 1] 저장된 소스파일

 

 

3. Conclusion


 

당연한 사항이지만 사용자 입장에서 코드가 저장되는 사실을 인지해야하고 저장되는 경로를 파악하고 있어야 한다고 생각한다.

 

 

'개발 > Setting' 카테고리의 다른 글

VScode remote development environment settings (with rmate)  (0) 2019.04.24

1. Overview


 

VScode를 활용하면 원격 서버의 환경을 그대로 활용하여 로컬환경에서 개발할 수 있다.

본 게시글은 VScode를 활용하여 rmate를 세팅하는 방법에 대해 기록하였다. 기본적인 세팅은 References의 블로그를 참고하였다[1][2].

 

 

2. Body


 

세팅에 필요한 순서는 다음과 같다.

  1. VScode 환경 세팅 (로컬)
    • "Remote VScode" 확장 프로그램
    • "Remote.Onestartup" : True 세팅
  2. Rmate 설치 (서버)
  3. Trouble Shoothing (번외)

 

 

2.1 VScode 환경세팅

Vscode의 Extensions 탭에서 "Remote VScode"를 검색하여 설치한다. (Windows Shortcut : Ctrl + Shift + X)

[그림 1] "Remote VScode" 확장 프로그램 설치

 

설치가 완료된 후 VScode의 설정을 수정한다. (Windows Shortcut : Ctrl + ,)

(File -> Preferences -> Settings)

설정 화면 호출 후 "Remote" 검색하여 "Remote:Onestartup" 하단 메뉴를 체크한다.

[그림 2] "Remote:Onestartup" 세팅

 

 

 

2.2 Rmate 설치

서버에서의 Rmate 설치는 References에 기록한 블로그의 명령어를 활용하였다.
입력한 명령어는 다음과 같다.

$wget https://raw.githubusercontent.com/sclukey/rmate-python/master/bin/rmate
...
$chmod +x ./rmate
$mv ./rmate /usr/local/bin/rmate

 

 

 

2.3 접속

접속은 로컬 환경에서의 PowerShell을 통해 명령어를 입력하여 쉽게 접속할 수 있다.

접속에 필요한 명령은 다음과 같다. ssh 포트를 변경했을 경우 "-p" 이후의 명령을 입력하면 된다.
ssh -R 52698:127.0.0.1:52698 [Remote_Server_User]@[Remote_Server_Address] -p [Port num]

 

ssh 접속이 완료된 상태에서 작업할 파일명을 아래의 명령어 형식에 맞게 입력한다.
rmate -p 52698 [/경로/파일명.py]

 

 

 

3. Trouble Shoothing


간단한 과정이지만 중간중간 문제가 발생한 사항은 다음과 같다.

 

  1. Couldn't connect to TextMate!
  2. Exception: Could not connect to textmate : Connection refused

 

 

3.1 Couldn't connect to TextMate!

해당 문제는 한 로컬에서 ssh 를 2개 이상 접속하고 rmate 명령어를 작성했을 때 출력되는 에러이다. 해당 문제는 호출 되어 있는 여러개의 ssh를 하나만 남겨놓고 종료하고 다음 과정을 수행하면 해결할 수 있다.

 

 

Vscode에서 F1을 누른 후 Remote:Stop Server를 통해 서버를 정지하고 Remote:Start Server 를 통해 재실행한다.

[그림 3] "Couldn't connect to TextMate!" 문제 해결[3]

 

 

 

3.2 Exception: Could not connect to textmate : Connection refused

해당 문제는 로컬에서 ssh 접속 과정에서 "127.0.0.1"을 "localhost"로 입력하였을 때 발생한다. 해결 방법은 단순히 "127.0.0.1" 을 사용하면 된다.

[그림 4] "Exception: Could not connect to textmate : Connection refused" 문제 해결[4]

 

 

4. Conclusion


본 게시글에서는 VScode를 통해 원격 개발 환경을 세팅하는 과정을 기록하였다.

이를 통해 VScode를 에디터로 사용하는 사용자들에게 편리함을 줄 수 있을 것으로 기대한다.

 

 

 

5. References


[1] https://thrillfighter.tistory.com/458

[2] https://mj-youn.github.io/2018/10/12/VSCode-Remote-File-edit/

[3] "Couldn't connect to TextMate!", https://github.com/sclukey/rmate-python/issues/2

[4] "When attempting to open files via rmate file never opens", https://github.com/rafaelmaiolla/remote-vscode/issues/55

'개발 > Setting' 카테고리의 다른 글

VScode rmate 작업시 Temp 파일 저장 확인  (0) 2019.04.25

+ Recent posts