07:19:50.702 [info] Running RealtimeWeb.Endpoint with cowboy 2.6.3 at :::4000 (http)
07:19:50.703 [info] Access RealtimeWeb.Endpoint at http://localhost:4000
07:19:50.799 [info] Application realtime exited: Realtime.Application.start(:normal, []) returned an error: shutdown: failed to start child: Realtime.Replication
** (EXIT) an exception was raised:
** (MatchError) no match of right hand side value: {:error, {:error, :error, "42710", :duplicate_object, "replication slot \"pid0_2356_0\" already exists", [file: "slot.c", line: "251", routine: "ReplicationSlotCreate", severity: "ERROR"]}}
(realtime) lib/adapters/postgres/epgsql_implementation.ex:24: Realtime.Adapters.Postgres.EpgsqlImplementation.init/1
(stdlib) gen_server.erl:374: :gen_server.init_it/2
(stdlib) gen_server.erl:342: :gen_server.init_it/6
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Kernel pid terminated (application_controller) ({application_start_failure,realtime,{{shutdown,{failed_to_start_child,'Elixir.Realtime.Replication',{{badmatch,{error,{error,error,<<"42710">>,duplicate
{"Kernel pid terminated",application_controller,"{application_start_failure,realtime,{{shutdown,{failed_to_start_child,'Elixir.Realtime.Replication',{{badmatch,{error,{error,error,<<\"42710\">>,duplicate_object,<<\"replication slot \\"pid0_2356_0\\" already exists\">>,[{file,<<\"slot.c\">>},{line,<<\"251\">>},{routine,<<\"ReplicationSlotCreate\">>},{severity,<<\"ERROR\">>}]}}},[{'Elixir.Realtime.Adapters.Postgres.EpgsqlImplementation',init,1,[{file,\"lib/adapters/postgres/epgsql_implementation.ex\"},{line,24}]},{gen_server,init_it,2,[{file,\"gen_server.erl\"},{line,374}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,342}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,249}]}]}}},{'Elixir.Realtime.Application',start,[normal,[]]}}}"}
Crash dump is being written to: erl_crash.dump...done
๋ณต์ ์ฌ๋กฏ์ด ์ค์ ๋ก ์ด๋ฏธ ์กด์ฌํ๋ค๊ณ ๊ฐ์ ํ๊ณ ์์ธ๋ฅผ ํฌ์ฐฉํ๊ณ ๋ฌด์ํด์ผ ํ๋ค๊ณ ์๊ฐํฉ๋๋ค.
Paul Copplestone 6๋ถ ์
https://github.com/supabase/realtime/blob/04d7c1e27d8b66e9c9e6e805b6d52a256ffb4011/server/lib/adapters/postgres/epgsql_implementation.ex#L56
์๋ฒ/lib/adapters/postgres/epgsql_implementation.ex:56
defp create_replication_slot(epgsql_pid, ์ฌ๋กฏ) ์ํ
https://github.com/supabase/realtime|supabase/realtime ์ํ๋ฒ ์ด์ค/์ค์๊ฐ | GitHub์์ ์ถ๊ฐํจ
Paul Copplestone 5๋ถ ์
์ฐ๋ฆฌ๋ ์ค์ ๋ก ๊ณ ์ ID https://github.com/supabase/realtime/blob/04d7c1e27d8b66e9c9e6e805b6d52a256ffb4011/server/lib/adapters/postgres/epgsql_implementation.ex#L25
์๋ฒ/lib/adapters/postgres/epgsql_implementation.ex:25
create_replication_slot(epgsql_pid, Keyword.get(config, :slot, :temporary))
https://github.com/supabase/realtime|supabase/realtime ์ํ๋ฒ ์ด์ค/์ค์๊ฐ | GitHub์์ ์ถ๊ฐํจ
@kiwicopple ์ฐ๋ฆฌ๊ฐ ์ด๊ฒ์
ํ์ง์์๋ง ๋ณธ๊ฑฐ ๊ฐ์๋ฐ? ์ค์ ๋ก ์์ ํ ๊ธฐ์ต์ ์์ง๋ง ๋ณธ ์ ์ด ์์ผ๋ฉฐ ๋ณต์ ํ๋ ๋ฐฉ๋ฒ๋ ๋ชจ๋ฆ ๋๋ค.
์ฆ๊ฑฐ์ฐ๋ฉด ๋ฌธ์ ๋ซ๊ณ ๋ค์ ๋ณด๊ฒ๋๋ฉด ๋ค์ ๋ฐฉ๋ฌธํ ์ ์์ต๋๋ค
์ฐธ๊ณ ๋ก ์ด ๋ฒ๊ทธ๋ ์ฌ์ ํ ์กด์ฌํ๋ฉฐ ์ฝ๊ฒ ๋ณต์ ํ ์ ์์ต๋๋ค.
์ด ์ ์ฅ์์ ์ผ๋ถ์ธ Dockerfile
๋ฅผ ์ฌ์ฉํ์ฌ ์ต์ Docker ์ด๋ฏธ์ง๋ฅผ ๋น๋ํ๊ณ SLOT_NAME
env ๋ณ์๋ฅผ ์ถ๊ฐํ์ญ์์ค.
docker run \
-e DB_HOST='docker.for.mac.host.internal' \
-e DB_NAME='postgres' \
-e DB_USER='postgres' \
-e DB_PASSWORD='postgres' \
-e DB_PORT=5432 \
-e PORT=4000 \
-e HOSTNAME='localhost' \
-e SECRET_KEY_BASE='SOMETHING_SUPER_SECRET' \
-e SLOT_NAME='COOL' \
-p 4000:4000 \
supabase/realtime
์ปจํ ์ด๋๋ฅผ ์ค์งํฉ๋๋ค. ๊ทธ๋ฐ ๋ค์ ์์ Docker ๋ช ๋ น์ ๋ค์ ์คํํฉ๋๋ค.
2020-08-25 22:41:59.295 [info] Running RealtimeWeb.Endpoint with cowboy 2.6.3 at :::4000 (http)
2020-08-25 22:41:59.295 [info] Access RealtimeWeb.Endpoint at http://localhost:4000
2020-08-25 22:41:59.317 [info] Application realtime exited: Realtime.Application.start(:normal, []) returned an error: shutdown: failed to start child: Realtime.Replication
** (EXIT) an exception was raised:
** (MatchError) no match of right hand side value: {:error, {:error, :error, "42710", :duplicate_object, "replication slot \"cool\" already exists", [file: "slot.c", line: "253", routine: "ReplicationSlotCreate", severity: "ERROR"]}}
(realtime) lib/adapters/postgres/epgsql_implementation.ex:24: Realtime.Adapters.Postgres.EpgsqlImplementation.init/1
(stdlib) gen_server.erl:374: :gen_server.init_it/2
(stdlib) gen_server.erl:342: :gen_server.init_it/6
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
{"Kernel pid terminated",application_controller,"{application_start_failure,realtime,{{shutdown,{failed_to_start_child,'Elixir.Realtime.Replication',{{badmatch,{error,{error,error,<<\"42710\">>,duplicate_object,<<\"replication slot \\"cool\\" already exists\">>,[{file,<<\"slot.c\">>},{line,<<\"253\">>},{routine,<<\"ReplicationSlotCreate\">>},{severity,<<\"ERROR\">>}]}}},[{'Elixir.Realtime.Adapters.Postgres.EpgsqlImplementation',init,1,[{file,\"lib/adapters/postgres/epgsql_implementation.ex\"},{line,24}]},{gen_server,init_it,2,[{file,\"gen_server.erl\"},{line,374}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,342}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,249}]}]}}},{'Elixir.Realtime.Application',start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,realtime,{{shutdown,{failed_to_start_child,'Elixir.Realtime.Replication',{{badmatch,{error,{error,error,<<"42710">>,duplicate
https://github.com/supabase/realtime/blob/master/server/lib/adapters/postgres/epgsql_implementation.ex#L75 ์ ์ค์ {name, "SELECT 1"}
_after_ ์ด๋ฆ์ด ์ง์ ๋ ๋ณต์ ์ฌ๋กฏ "COOL"๋ก ๋ณ๊ฒฝํ๋ฉด ์์ฑ ๋. ์์๋๋ก ์๋ํฉ๋๋ค. ๋ด ์๊ฐ์๋ ์ด ์น์
์ ๋
ผ๋ฆฌ๊ฐ ์๋ชป๋์์ง๋ง ํจ์น๋ฅผ ์ ๊ณตํ ๋งํผ Elixir๋ฅผ ์ดํดํ์ง ๋ชปํฉ๋๋ค.
๋๋์ต๋๋ค. @kwakwaversal ๋ณต์ ๋จ๊ณ์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค. ์ด ๋ฌธ์ ๋ฅผ ๋ ์ฝ๊ฒ ํด๊ฒฐํ ์ ์์ต๋๋ค.
์ฐ๋ฆฌ๋ YC ๋ฐ๋ชจ ๋ฐ์ด๋ฅผ ๋ง ํต๊ณผํ๊ณ ์์ง๋ง ๊ฐ๋ฅํ ํ ๋นจ๋ฆฌ ์ด ๋ฌธ์ ์ ๋ฐ์ด๋ค๊ฒ ์ต๋๋ค.
@kiwicopple ์ด๊ฒ์ ์๋ฅผ ๋ค์ด AWS์ ECS ์์ ์์ ๊ณ์ ๋ฐ์ํ๋ ๋ฌธ์ ์ ๋๋ค. ์๋ฅผ ๋ค์ด ์ ์์ ์ด ์ด์ ์์ ์ด ์ข ๋ฃ๋๊ธฐ ์ ์ ์์๋ ๊ฒฝ์ฐ์ ๋๋ค. ์ด์ ์ฌ๋กฏ์ ๋ณต์ ์ฌ๋กฏ ID๋ฅผ ํด์ ํ์ง ์์ ๋ฐ๋ฉด ์ ์ฌ๋กฏ์ ์์ฒญํ๋ ค๊ณ ํฉ๋๋ค.
:tada: ์ด ๋ฌธ์ ๋ ๋ฒ์ 0.7.9์์ ํด๊ฒฐ๋์์ต๋๋ค.
๋ฆด๋ฆฌ์ค๋ GitHub ๋ฆด๋ฆฌ์ค์์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
์๋งจํฑ ๋ฆด๋ฆฌ์ค ๋ด :package::rocket:
@kwakwaversal ๋ ์ ๋ฉ์์ง ๋๋ถ์ ์ด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค. ๋ฌธ์ ๋ Postgres๊ฐ ์ฌ๋กฏ์ ์๋ฌธ์๋ก ์ ์ฅํ๋ค๋ ๊ฒ์ ๋๋ค.
๊ธฐ์กด ์ฌ๋กฏ์ด ์๋์ง ํ์ธํ๊ธฐ ์ ์ SLOT_NAME
var๋ฅผ ์๋ฌธ์๋ก ๋ณํํ๋๋ก ์ต์ ๋ฆด๋ฆฌ์ค๋ฅผ ์
๋ฐ์ดํธํ์ต๋๋ค.
๋ฒ์ 0.7.9์์ ํ์ธํ ์ ์์ต๋๋ค.
docker pull supabase/realtime:v0.7.9
docker run \
-e DB_HOST='docker.for.mac.host.internal' \
-e DB_NAME='postgres' \
-e DB_USER='postgres' \
-e DB_PASSWORD='postgres' \
-e DB_PORT=5432 \
-e PORT=4000 \
-e HOSTNAME='localhost' \
-e SECRET_KEY_BASE='SOMETHING_SUPER_SECRET' \
-e SLOT_NAME='COOL' \
-p 4000:4000 \
supabase/realtime:v0.7.9
๋น์ ์ ์ํด ์๋ํ์ง ์๋ ๊ฒฝ์ฐ ์์ ๋กญ๊ฒ ๋ค์ ์ฝ๋๋ค!
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
๋๋์ต๋๋ค. @kwakwaversal ๋ณต์ ๋จ๊ณ์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค. ์ด ๋ฌธ์ ๋ฅผ ๋ ์ฝ๊ฒ ํด๊ฒฐํ ์ ์์ต๋๋ค.
์ฐ๋ฆฌ๋ YC ๋ฐ๋ชจ ๋ฐ์ด๋ฅผ ๋ง ํต๊ณผํ๊ณ ์์ง๋ง ๊ฐ๋ฅํ ํ ๋นจ๋ฆฌ ์ด ๋ฌธ์ ์ ๋ฐ์ด๋ค๊ฒ ์ต๋๋ค.