School of Elixir 2020
Rafał Słota: rafal.slota@gmail.com
- “Pointing Poker” - https://www.pointingpoker.com/
- Elixir - https://elixir-lang.org/install.html
- Phoenix - https://hexdocs.pm/phoenix/installation.html
- LiveView - https://hexdocs.pm/phoenix_live_view/installation.html
- Docker - https://docs.docker.com/get-docker/
- Bootstrap - https://getbootstrap.com/docs/4.0/components
mix local.hexmix archive.install hex phx_new 1.5.1mix phx.new pointing_poker --live
cd pointing_poker
npm install bootstrap jquery popper.js --prefix assets
npm install sass-loader node-sass webpack --prefix assets
npm install --prefix assetsRemove PointingPoker.Repo child from PointingPoker.Application
In assets/js/app.js add:
import "bootstrap"
In assets/css/app.scss replace:
@import "./phoenix.css";
with:
@import "~bootstrap/scss/bootstrap";
mix phx.serverBuilt in Dashboard: http://localhost:4000/dashboard
We can prepare the release by:
# Generate release boot scripts
mix release.init
# Initial setup
mix deps.get --only prod
MIX_ENV=prod mix compile
# Install / update JavaScript dependencies
npm install --prefix ./assets
# Compile assets
npm run deploy --prefix ./assets
mix phx.digestNext, we need to create config/releases.exs file as primary release configuration file.
After we do that, we can generate the release with:
MIX_ENV=prod mix releaseWe can run it with:
export SECRET_KEY_BASE=`mix phx.gen.secret`
_build/prod/rel/pointing_poker/bin/pointing_poker startPlace Dockerfile that you can find next to this README.md in you project's root.
docker build . -t pointing_poker:latestWe can try to run the container by:
docker run -e SECRET_KEY_BASE=`mix phx.gen.secret` -p 8080:4000 -it pointing_poker:latestAdd the following to project dependencies:
{:syn, "~> 2.1"}Next, we need to replace Registry with :syn.
Add the following to project dependencies:
{:libcluster, "~> 3.2"}Add to Application supervisor:
{Cluster.Supervisor, [cluster_config(), [name: PointingPoker.ClusterSupervisor]]}
# With the following function definition:
defp cluster_config() do
[
gossip: [
strategy: Cluster.Strategy.Gossip,
config: [
port: 45892,
if_addr: "0.0.0.0",
multicast_addr: "230.1.1.251",
multicast_ttl: 1
]
]
]
endIn rel/vm.args.eex:
-kernel inet_dist_listen_min 4370
-kernel inet_dist_listen_max 4370In rel/env.sh/eex:
export RELEASE_DISTRIBUTION=name
export RELEASE_NODE=<%= @release.name %>@`hostname -i`