- https://echobind.com/blog/using-phoenix-with-docker/
- I completed this entirely and then went to the next...
- http://teamon.eu/2017/deploying-phoenix-to-production-using-docker/ and https://github.com/Recruitee/mix_docker
- I got here from https://github.com/Nebo15/renew, so will go back to that.
- I was unable to
mix docker.build
command inside dcr web bash because obviously docker isn't installed inside the container. I had to install Elixir in the host and run it from there. :-( - It looks like "sibling containers" are a possible solution to this http://stackoverflow.com/a/33003273/34315.
- Created the repository on Docker Hub first
- Use the name of that repository in
config/config.exs
mix docker.init
mix docker.build
mix docker.release
mix docker.publish
- It pushes and tags the docker image https://hub.docker.com/r/gabrieljoelc/elixir-of-love/tags/. This is the deployment artifact.
docker run -e PORT=4000 gabrieljoelc/elixir-of-love:0.0.1.1-d2412f7f2e foreground
is failing with a "failed to connect: ** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused". I'm assuming it's because the image doesn't know how to connect to the database image.- Once I get this working I'm going to look into deploying the image to Heroku or to GCP.
- Found additional documentation specifically for Phoenix, but
mix docker.customize
is missing. - Realized that I using
0.2.2
ofmix_docker
because I copied and pasted from http://teamon.eu/2017/deploying-phoenix-to-production-using-docker/. Updated to0.4.2
anddocker.customize
worked. - Updated many things per the
mix_docker
Phoenix FAQ - Now getting "npm ERR! addLocal Could not install /opt/app/deps/phoenix
npm ERR! addLocal Could not install /opt/app/deps/phoenix_html" when running
mix docker.build
- It's because there is a path mismatch between
Dockerfile.build
- It's because there is a path mismatch between
WORKDIR /opt/app
ENV MIX_ENV=prod
# Cache node deps
COPY package.json ./
RUN npm install
and package.json
:
"dependencies": {
"phoenix": "file:deps/phoenix",
"phoenix_html": "file:deps/phoenix_html"
}
I've tried lots of things but still can't figure it out.
- I figured it out. The
npm install
line needed to be aftermix deps.get
runs so thatdeps/phoenix
anddeps/phoenix_html
exist. - I got
Dockerfile.release
working with Docker Compose, but now I'm stuck on how to create a database forDockerfile.release
. I'm trying to create the prod database from within thedocker-compose.yml
web
service:
# host
docker run -it --rm -e MIX_ENV=prod -e DB_HOST=db a540246dbcc5 /bin/bash
# container
MIX_ENV=prod mix deps.get
MIX_ENV=prod mix compile
MIX_ENV=prod mix ecto.create
07:10:27.256 [error] GenServer #PID<0.178.0> terminating
** (DBConnection.ConnectionError) tcp connect (${DB_HOST}:5432): non-existing domain - :nxdomain
(db_connection) lib/db_connection/connection.ex:148: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
** (Mix) The database for HelloWorld.Repo couldn't be created: an exception was raised:
** (DBConnection.ConnectionError) tcp connect (${DB_HOST}:5432): non-existing domain - :nxdomain
(db_connection) lib/db_connection/connection.ex:148: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Following the config steps on here.
Output: PR
I'm going to try and use this
web_1 | [error] backend port not found: :inotifywait
- phoenixframework/phoenix#776 (comment)- vim for elixir - https://github.com/elixir-lang/vim-elixir depends on https://github.com/junegunn/vim-plug. Had to update
.vimrc
forvim-plug
andvim-elixir
.
-
Don't know the difference between https://github.com/PagerDuty/docker_distiller and https://github.com/Recruitee/mix_docker
-
https://blog.bensarmiento.com/2016/07/19/Deploying-an-Elixir-app-to-Google-App-Engine/
-
https://github.com/sashaafm/nomad - Cloud deployment tool.
-
http://davidanguita.name/articles/dockerizing-a-phoenix-project/
-
https://devcenter.heroku.com/articles/container-registry-and-runtime
-
https://floriank.github.io/post/using-phoenix-with-docker-part-3-containerization/
-
http://davidanguita.name/articles/dockerizing-a-phoenix-project/
-
http://teamon.eu/2017/setting-up-elixir-cluster-using-docker-and-rancher/