Thanks for creating Phoenix.
I have a little issue with docker-compose.
I am not really sure what is causing this, but it's reproducibile hence the issue.
phoenix 1.3.0 (Hex package) (mix)
locked at 1.3.0 (phoenix) 1c01124c
ok
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
mix phx.new todo
dev.exsconfig :todo, Todo.Repo,
adapter: Ecto.Adapters.Postgres,
username: (case System.get_env("DB_USERNAME") do
nil -> "postgres"
val -> val
end),
password: (case System.get_env("DB_PASSWORD") do
nil -> "postgres"
val -> val
end),
database: (case System.get_env("DB_NAME") do
nil -> "todo_dev"
val -> val
end),
hostname: (case System.get_env("DB_HOST") do
nil -> "localhost"
val -> val
end),
pool_size: 10
docker-compose.yml (dockerfile of the image: kkweon/phoenix)version: "3.1"
services:
web:
image: kkweon/phoenix:latest
ports:
- "4000:4000"
environment:
DB_USERNAME: postgres
DB_PASSWORD: postgres
DB_NAME: todo_dev
DB_HOST: db
volumes:
- .:/code
depends_on:
- db
command: ["mix", "phx.server"]
db:
image: postgres:10.0
volumes:
- db-data:/var/lib/postgresql/data
volumes:
db-data:
docker-compose run web mix deps.get
docker-compose run web mix compile
docker-compose run web mix ecto.create
and
docker-compose run web bash
# inside of container
cd assets && npm i
exit
docker-compose up
I am getting the following error, but can't figure out what causing it since all I have done was to set up a scaffold through mix phx.new
Thank you in advance.
web_1 | [error] an exception was raised:
web_1 | ** (RuntimeError) Channel join is expected to return one of:
web_1 |
web_1 | {:ok, Socket.t} |
web_1 | {:ok, reply :: map, Socket.t} |
web_1 | {:error, reply :: map}
web_1 |
web_1 | got :ignore
web_1 |
web_1 | (phoenix) lib/phoenix/channel/server.ex:197: Phoenix.Channel.Server.init/1
web_1 | (stdlib) gen_server.erl:365: :gen_server.init_it/2
web_1 | (stdlib) gen_server.erl:333: :gen_server.init_it/6
web_1 | (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
@chrismccord at best we need to improve the runtime error on channel join to include the channel name. I assume this is coming from live reload but i am not sure.
@josevalim Thank you! Indeed it was the live loading.
I didn't think it was relevant since the error message was saying channel.
I included inotify-tools in the docker image, and now it works without the error.
Feel free to close it though I also agree with that the channel join error message should be a little more verbose.
web_1 | [error] `inotify-tools` is needed to run `file_system` for your system, check https://github.com/rvoicilas/inotify-tools/wiki for more information about how to install it. If it's already installed but not be found, appo
int executable file with `config.exs` or `FILESYSTEM_FSINOTIFY_EXECUTABLE_FILE` env.
web_1 | [warn] Could not start Phoenix live-reload because we cannot listen to the file system.
web_1 | You don't need to worry! This is an optional feature used during development to
web_1 | refresh your browser when you save files and it does not affect production.
web_1 |
web_1 | [info] Running TodoWeb.Endpoint with Cowboy using http://0.0.0.0:4000
web_1 | 08:03:29 - info: compiled 6 files into 2 files, copied 3 in 509 ms
web_1 | [info] GET /
web_1 | [debug] Processing with TodoWeb.PageController.index/2
web_1 | Parameters: %{}
web_1 | Pipelines: [:browser]
web_1 | [info] Sent 200 in 23ms
web_1 | [error] an exception was raised:
web_1 | ** (RuntimeError) Channel join is expected to return one of:
web_1 |
web_1 | {:ok, Socket.t} |
web_1 | {:ok, reply :: map, Socket.t} |
web_1 | {:error, reply :: map}
web_1 |
web_1 | got :ignore
web_1 |
web_1 | (phoenix) lib/phoenix/channel/server.ex:197: Phoenix.Channel.Server.init/1
web_1 | (stdlib) gen_server.erl:365: :gen_server.init_it/2
web_1 | (stdlib) gen_server.erl:333: :gen_server.init_it/6
web_1 | (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
If anyone finds this error, ensure that you install inotify-tools
apt-get install -y inotify-tools
Most helpful comment
@josevalim Thank you! Indeed it was the live loading.
I didn't think it was relevant since the error message was saying channel.
I included
inotify-toolsin the docker image, and now it works without the error.Feel free to close it though I also agree with that the channel join error message should be a little more verbose.
Solution
If anyone finds this error, ensure that you install
inotify-tools