jswny
Hello everyone, I recently redesigned my entire deployment process for Phoenix apps based on Docker. I really like the strategy that I came up with and it’s working very well for me so far. I have a new VPS which I’ve vowed to only install Docker on, and this strategy is perfect for my goal.
In addition, my strategy is optimized for:
- Running multiple apps on the same server
- Being compatible with deployment of any other kind of app (not just Elixir/Phoenix)
- Compilation completely separate from deployment so you can compile anywhere and deploy anywhere else
In the interest of helping others who might be struggling with the same thing, I’ve documented my entire process in a Gist. I would love to contribute to this wonderful community on what seems to be one of the most popular difficulties when it comes to Phoenix (deployment).
Please let me know if you have any thoughts. The post is here: Flexible Dockerized Phoenix Deployments.
Trending in Guides/Tuts
You probably already know that <span>{nil}</span> in a HEEX template produces <span> </span> when rendered. I fin...
New
# ~/src/livebook/.iex.exs
System.cmd("xdg-open", [ LivebookWeb.Endpoint.access_url() ] )
Because Livebook requires a unique passcode on ...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #blog-post
- #ai
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
juhalehtonen
Hey! Just wanted to drop a quick note saying thanks for the write-up
I followed the guide last night and everything seemed to work fine. I’ll perform some tests and alterations and will comment back further if I find anything specific to talk about.
jswny
Awesome! I’m Glad that you found the guide useful! I look forward to hearing your comments
jswny
Just added another section on how to (kind of) hot upgrade the server container without touching the database container. This should be pretty useful to people using this kind of Docker configuration because being able to swap out containers individually when your app changes is a huge advantage.
nelson687
Hey, I’ve been following this guide, but can’t make it work, I’m not using a database, just using a genserver to store data, so I skipped all the DB parts, also don’t want to use nginx. So I got to this point:
and everything seems to be fine, I can see some logs from the app, but I can’t access from the browser, tried 0.0.0.0:5000 but can’t see anything, the only thing I added was:
ENV PORT=4000in Dockerfile.run, as I’m using phoenix 1.3, is there anything I’m missing?idi527
So you are listening on 4000, but mapping
-p 5000:50005000 to 5000? I don’t think that would work.You can try changing either
ENV PORT=4000toENV PORT=5000or-p 5000:5000to-p 4000:5000(which would map tcp port 4000 in the container to port 5000 on the host).nelson687
Tried with that and rebuilt everything but still can’t access, is it right to try to access on my mac on
0.0.0.0:5000? I’ve changed the phoenix port to 5000 by addingENV PORT=5000and using the param-p 5000:5000on docker run. I’m running this on my mac as a host machine.idi527
I’ve followed the tutorial up to
and it hasn’t mentioned that you should uncomment one of the lines below in order for “phoenix in a release” to work.
config/prod.exsOtherwise cowboy is not started. AFAIK it is not uncommented by default so as not to start cowboy on any other task like
phx.digest.Maybe that’ll help you. Don’t forget to re
./build.shthe release.EDIT:
server: trueis mentioned later in section 7.emoragaf
Thanks for putting this guide up. I have some questions about other options in the release building process, and the docker-compose setup.
Have you looked at generating the release tarball using multi-stage builds rather than your current build script?
Shouldn’t the db service in the docker-compose be using a volume for the data in case the container dies?
OvermindDL1
If accessing it locally you instead want
http://127.0.0.1:5000for note.jswny
Thanks for reading! That should work. If you have
ENV PORT=5000in yourDockerfile.runand you are running the container with-p 5000:5000you should be able to access it from your host machine onlocalhost:5000or127.0.0.1:5000.I would make sure that you completely rebuild everything by deleting all of the images first just so you know Docker isn’t using any cached stages. You can do this with
docker rmi myapp-build myapp-release.However, I think at that stage in the guide you still won’t be able to run the server because you haven’t changed the config which is not explained until step 7. I will try and update the guide accordingly so that running things manually comes after that.