First I created 3 droplets on digital ocean with 4-cores and 8GB of RAM. Login as root to each and run:
sysctl -w fs.file-max=12000500
sysctl -w fs.nr_open=20000500
ulimit -n 4000000
sysctl -w net.ipv4.tcp_mem='10000000 10000000 10000000'
defmodule Swarm.DynamicSupervisor do | |
use GenServer | |
require Logger | |
defstruct [ | |
:child_name, | |
:child_module, | |
:child_args, | |
:group, | |
:pid, |
# | |
# Given the ID of an Amazon public AMI in one region, figure out what the | |
# equivalent AMI IDs are for that same AMI in all other regions known. | |
# If that AMI isn't defined in a region, it prints the region's name, but | |
# comments it out. | |
# | |
from __future__ import print_function | |
import boto3 |
# How to use it: | |
# | |
# Plug it at the end of your :browser pipeline in your Phoenix app router.ex | |
# Make sure it is plugged before your session-based authentication and authorization Plugs. | |
# | |
# pipeline :browser do | |
# plug :accepts, ["html"] | |
# plug :fetch_session | |
# plug :fetch_flash | |
# plug :put_secure_browser_headers |
# app deps | |
sudo yum install git | |
# erlang deps | |
sudo yum groupinstall "Development Tools" | |
sudo yum install ncurses-devel openssl-devel | |
# erlang | |
wget http://www.erlang.org/download/otp_src_19.2.tar.gz | |
tar -zxvf otp_src_19.2.tar.gz |
If you want a run-down of the 1.3 changes and the design decisions behidn those changes, check out the LonestarElixir Phoenix 1.3 keynote: https://www.youtube.com/watch?v=tMO28ar0lW8
To use the new phx.new
project generator, you can install the archive with the following command:
$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
Phoenix v1.3.0 is a backwards compatible release with v1.2.x. To upgrade your existing 1.2.x project, simply bump your phoenix dependency in mix.exs
:
#!/usr/bin/env bash | |
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/ | |
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c | |
# https://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver | |
# https://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception | |
# https://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal | |
# https://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04 | |
# Versions | |
CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE` |
I've been interested in Command Query Responsibility Segregation and event sourcing since hearing Greg Young talk on the subject in early 2010. During the past seven years I've built an open-source Ruby CQRS library (rcqrs); worked professionally on .NET applications following the pattern; and more recently built an Event Store (eventstore) and CQRS library (commanded) in Elixir.
Building applications following domain-driven design and using CQRS feels really natural with the Elixir -- and Erlang -- actor model. An aggregate root fits well within an Elixir process, which are driven by immutable messages through their own message mailboxes, allowing them to run concurrently and in isolation.
The web application I built to implement these ideas in Elixir was [Segment Challen
defmodule Recruitee.Repo do | |
use Ecto.Repo, otp_app: :recruitee | |
import Ecto.Query | |
@doc """ | |
Stream query results | |
Example: | |
iex> Candidate | |
...> |> where([c], c.foo > 4) |
# Aggregates are just collections of command functions, which emit events, | |
# and event handlers, which mutate state. | |
# In order to hold state, they should be also structs. | |
# There is no new() function because aggregates aren't supposed to appear | |
# out of the blue, they are always the result of a command. | |
# In this case, %OpenAccount{}. | |
defmodule Bank.Account do | |
defstruct [:account_number, :balance] |