Skip to content

Instantly share code, notes, and snippets.

@kaosf
Created April 1, 2022 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaosf/37b3a502f7838e116c31ac2918adfe18 to your computer and use it in GitHub Desktop.
Save kaosf/37b3a502f7838e116c31ac2918adfe18 to your computer and use it in GitHub Desktop.

tsunagu練習NOTE

動かし方

どこかのEC2なりVPSなり固定IPがあるところでserverを以下のように起動.

docker run --rm -p 18080:8080 -e TSUNAGU_TOKEN=token ghcr.io/making/tsunagu-server

token18080 は適切に変える.

手元のマシンなどで

mkdir test; cd test
echo Hello > a.html
python -m http.server

これがUPSTREAMに相当するもの.http://localhost:8000 にアクセスして動作確認しておくと良い.

次いで同じマシン上でclientを以下のように起動.

docker run --rm -e TSUNAGU_TOKEN=token -e TSUNAGU_REMOTE=ws://123.234.345.456:18080/tsunagu -e TSUNAGU_UPSTREAM=http://localhost:8000 --net host ghcr.io/making/tsunagu-client

token はserverで決めたものと合わせる.IPアドレス 123.234.345.456 はもちろん実際のサーバのグローバルIPに変える.18080 もserverで決めたものと合わせる.

--net host でコンテナがホストと同じネットワーク上で動いてくれるので localhost:8000 が先程の python -m http.server で動いているものを指してくれる.これ忘れないように (忘れたので動かなくてちょっと焦った).

参考

@kaosf
Copy link
Author

kaosf commented Apr 1, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment