Resources
10 |-
11 |
- 12 | Guides & Docs 13 | 14 |
- 15 | Source 16 | 17 |
- 18 | v1.4 Changelog 19 | 20 |
├── .tool-versions
├── .github
└── FUNDING.yml
├── test
├── test_helper.exs
├── docker_elixir_19_release_web
│ ├── views
│ │ ├── page_view_test.exs
│ │ ├── layout_view_test.exs
│ │ └── error_view_test.exs
│ └── controllers
│ │ └── page_controller_test.exs
└── support
│ ├── channel_case.ex
│ └── conn_case.ex
├── .formatter.exs
├── lib
├── docker_elixir_19_release_web
│ ├── views
│ │ ├── page_view.ex
│ │ ├── layout_view.ex
│ │ ├── error_view.ex
│ │ └── error_helpers.ex
│ ├── controllers
│ │ └── page_controller.ex
│ ├── router.ex
│ ├── gettext.ex
│ ├── channels
│ │ └── user_socket.ex
│ ├── templates
│ │ ├── page
│ │ │ └── index.html.eex
│ │ └── layout
│ │ │ └── app.html.eex
│ └── endpoint.ex
├── docker_elixir_19_release.ex
├── docker_elixir_19_release
│ └── application.ex
└── docker_elixir_19_release_web.ex
├── rel
├── env.bat.eex
├── vm.args.eex
└── env.sh.eex
├── config
├── test.exs
├── releases.exs
├── config.exs
├── dev.exs
└── prod.exs
├── priv
└── gettext
│ ├── en
│ └── LC_MESSAGES
│ │ └── errors.po
│ └── errors.pot
├── README.md
├── .gitignore
├── mix.exs
├── Dockerfile
└── mix.lock
/.tool-versions:
--------------------------------------------------------------------------------
1 | elixir 1.9.0-rc.0
2 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: [akoutmos]
2 |
--------------------------------------------------------------------------------
/test/test_helper.exs:
--------------------------------------------------------------------------------
1 | ExUnit.start()
2 |
--------------------------------------------------------------------------------
/.formatter.exs:
--------------------------------------------------------------------------------
1 | [
2 | import_deps: [:phoenix],
3 | inputs: ["*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"]
4 | ]
5 |
--------------------------------------------------------------------------------
/lib/docker_elixir_19_release_web/views/page_view.ex:
--------------------------------------------------------------------------------
1 | defmodule DockerElixir19ReleaseWeb.PageView do
2 | use DockerElixir19ReleaseWeb, :view
3 | end
4 |
--------------------------------------------------------------------------------
/lib/docker_elixir_19_release_web/views/layout_view.ex:
--------------------------------------------------------------------------------
1 | defmodule DockerElixir19ReleaseWeb.LayoutView do
2 | use DockerElixir19ReleaseWeb, :view
3 | end
4 |
--------------------------------------------------------------------------------
/rel/env.bat.eex:
--------------------------------------------------------------------------------
1 | @echo off
2 | rem Set the release to work across nodes
3 | rem set RELEASE_DISTRIBUTION=name
4 | rem set RELEASE_NODE=<%= @release.name %>@127.0.0.1
5 |
--------------------------------------------------------------------------------
/test/docker_elixir_19_release_web/views/page_view_test.exs:
--------------------------------------------------------------------------------
1 | defmodule DockerElixir19ReleaseWeb.PageViewTest do
2 | use DockerElixir19ReleaseWeb.ConnCase, async: true
3 | end
4 |
--------------------------------------------------------------------------------
/test/docker_elixir_19_release_web/views/layout_view_test.exs:
--------------------------------------------------------------------------------
1 | defmodule DockerElixir19ReleaseWeb.LayoutViewTest do
2 | use DockerElixir19ReleaseWeb.ConnCase, async: true
3 | end
4 |
--------------------------------------------------------------------------------
/lib/docker_elixir_19_release_web/controllers/page_controller.ex:
--------------------------------------------------------------------------------
1 | defmodule DockerElixir19ReleaseWeb.PageController do
2 | use DockerElixir19ReleaseWeb, :controller
3 |
4 | def index(conn, _params) do
5 | render(conn, "index.html")
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/test/docker_elixir_19_release_web/controllers/page_controller_test.exs:
--------------------------------------------------------------------------------
1 | defmodule DockerElixir19ReleaseWeb.PageControllerTest do
2 | use DockerElixir19ReleaseWeb.ConnCase
3 |
4 | test "GET /", %{conn: conn} do
5 | conn = get(conn, "/")
6 | assert html_response(conn, 200) =~ "Welcome to Phoenix!"
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/lib/docker_elixir_19_release.ex:
--------------------------------------------------------------------------------
1 | defmodule DockerElixir19Release do
2 | @moduledoc """
3 | DockerElixir19Release keeps the contexts that define your domain
4 | and business logic.
5 |
6 | Contexts are also responsible for managing your data, regardless
7 | if it comes from the database, an external API or others.
8 | """
9 | end
10 |
--------------------------------------------------------------------------------
/config/test.exs:
--------------------------------------------------------------------------------
1 | use Mix.Config
2 |
3 | # We don't run a server during test. If one is required,
4 | # you can enable the server option below.
5 | config :docker_elixir_19_release, DockerElixir19ReleaseWeb.Endpoint,
6 | http: [port: 4002],
7 | server: false
8 |
9 | # Print only warnings and errors during test
10 | config :logger, level: :warn
11 |
--------------------------------------------------------------------------------
/rel/vm.args.eex:
--------------------------------------------------------------------------------
1 | ## Customize flags given to the VM: http://erlang.org/doc/man/erl.html
2 | ## -mode/-name/-sname/-setcookie are configured via env vars, do not set them here
3 |
4 | ## Number of dirty schedulers doing IO work (file, sockets, etc)
5 | ##+SDio 5
6 |
7 | ## Increase number of concurrent ports/sockets
8 | ##+Q 65536
9 |
10 | ## Tweak GC to run more often
11 | ##-env ERL_FULLSWEEP_AFTER 10
12 |
--------------------------------------------------------------------------------
/priv/gettext/en/LC_MESSAGES/errors.po:
--------------------------------------------------------------------------------
1 | ## `msgid`s in this file come from POT (.pot) files.
2 | ##
3 | ## Do not add, change, or remove `msgid`s manually here as
4 | ## they're tied to the ones in the corresponding POT file
5 | ## (with the same domain).
6 | ##
7 | ## Use `mix gettext.extract --merge` or `mix gettext.merge`
8 | ## to merge POT files into PO files.
9 | msgid ""
10 | msgstr ""
11 | "Language: en\n"
12 |
--------------------------------------------------------------------------------
/priv/gettext/errors.pot:
--------------------------------------------------------------------------------
1 | ## This is a PO Template file.
2 | ##
3 | ## `msgid`s here are often extracted from source code.
4 | ## Add new translations manually only if they're dynamic
5 | ## translations that can't be statically extracted.
6 | ##
7 | ## Run `mix gettext.extract` to bring this file up to
8 | ## date. Leave `msgstr`s empty as changing them here has no
9 | ## effect: edit them in PO (`.po`) files instead.
10 |
11 |
--------------------------------------------------------------------------------
/config/releases.exs:
--------------------------------------------------------------------------------
1 | import Config
2 |
3 | secret_key_base = System.fetch_env!("SECRET_KEY_BASE")
4 | cool_text = System.fetch_env!("COOL_TEXT")
5 | application_port = System.fetch_env!("APP_PORT")
6 |
7 | config :docker_elixir_19_release, DockerElixir19ReleaseWeb.Endpoint,
8 | http: [:inet6, port: String.to_integer(application_port)],
9 | secret_key_base: secret_key_base
10 |
11 | config :docker_elixir_19_release,
12 | cool_text: cool_text
13 |
--------------------------------------------------------------------------------
/rel/env.sh.eex:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Sets and enables heart (recommended only in daemon mode)
4 | # if [ "$RELEASE_COMMAND" = "daemon" ] || [ "$RELEASE_COMMAND" = "daemon_iex" ]; then
5 | # HEART_COMMAND="$RELEASE_ROOT/bin/$RELEASE_NAME $RELEASE_COMMAND"
6 | # export HEART_COMMAND
7 | # export ELIXIR_ERL_OPTIONS="-heart"
8 | # fi
9 |
10 | # Set the release to work across nodes
11 | # export RELEASE_DISTRIBUTION=name
12 | # export RELEASE_NODE=<%= @release.name %>@127.0.0.1
13 |
--------------------------------------------------------------------------------
/test/docker_elixir_19_release_web/views/error_view_test.exs:
--------------------------------------------------------------------------------
1 | defmodule DockerElixir19ReleaseWeb.ErrorViewTest do
2 | use DockerElixir19ReleaseWeb.ConnCase, async: true
3 |
4 | # Bring render/3 and render_to_string/3 for testing custom views
5 | import Phoenix.View
6 |
7 | test "renders 404.html" do
8 | assert render_to_string(DockerElixir19ReleaseWeb.ErrorView, "404.html", []) == "Not Found"
9 | end
10 |
11 | test "renders 500.html" do
12 | assert render_to_string(DockerElixir19ReleaseWeb.ErrorView, "500.html", []) == "Internal Server Error"
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/lib/docker_elixir_19_release_web/views/error_view.ex:
--------------------------------------------------------------------------------
1 | defmodule DockerElixir19ReleaseWeb.ErrorView do
2 | use DockerElixir19ReleaseWeb, :view
3 |
4 | # If you want to customize a particular status code
5 | # for a certain format, you may uncomment below.
6 | # def render("500.html", _assigns) do
7 | # "Internal Server Error"
8 | # end
9 |
10 | # By default, Phoenix returns the status message from
11 | # the template name. For example, "404.html" becomes
12 | # "Not Found".
13 | def template_not_found(template, _assigns) do
14 | Phoenix.Controller.status_message_from_template(template)
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/lib/docker_elixir_19_release_web/router.ex:
--------------------------------------------------------------------------------
1 | defmodule DockerElixir19ReleaseWeb.Router do
2 | use DockerElixir19ReleaseWeb, :router
3 |
4 | pipeline :browser do
5 | plug :accepts, ["html"]
6 | plug :fetch_session
7 | plug :fetch_flash
8 | plug :protect_from_forgery
9 | plug :put_secure_browser_headers
10 | end
11 |
12 | pipeline :api do
13 | plug :accepts, ["json"]
14 | end
15 |
16 | scope "/", DockerElixir19ReleaseWeb do
17 | pipe_through :browser
18 |
19 | get "/", PageController, :index
20 | end
21 |
22 | # Other scopes may use custom stacks.
23 | # scope "/api", DockerElixir19ReleaseWeb do
24 | # pipe_through :api
25 | # end
26 | end
27 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DockerElixir19Release
2 |
3 | To start your Phoenix server:
4 |
5 | * Install dependencies with `mix deps.get`
6 | * Start Phoenix endpoint with `mix phx.server`
7 |
8 | Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
9 |
10 | Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html).
11 |
12 | ## Learn more
13 |
14 | * Official website: http://www.phoenixframework.org/
15 | * Guides: https://hexdocs.pm/phoenix/overview.html
16 | * Docs: https://hexdocs.pm/phoenix
17 | * Mailing list: http://groups.google.com/group/phoenix-talk
18 | * Source: https://github.com/phoenixframework/phoenix
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # The directory Mix will write compiled artifacts to.
2 | /_build/
3 |
4 | # If you run "mix test --cover", coverage assets end up here.
5 | /cover/
6 |
7 | # The directory Mix downloads your dependencies sources to.
8 | /deps/
9 |
10 | # Where 3rd-party dependencies like ExDoc output generated docs.
11 | /doc/
12 |
13 | # Ignore .fetch files in case you like to edit your project deps locally.
14 | /.fetch
15 |
16 | # If the VM crashes, it generates a dump, let's ignore it too.
17 | erl_crash.dump
18 |
19 | # Also ignore archive artifacts (built via "mix archive.build").
20 | *.ez
21 |
22 | # Ignore package tarball (built via "mix hex.build").
23 | docker_elixir_19_release-*.tar
24 |
25 | # Since we are building assets from assets/,
26 | # we ignore priv/static. You may want to comment
27 | # this depending on your deployment strategy.
28 | /priv/static/
29 |
--------------------------------------------------------------------------------
/lib/docker_elixir_19_release_web/gettext.ex:
--------------------------------------------------------------------------------
1 | defmodule DockerElixir19ReleaseWeb.Gettext do
2 | @moduledoc """
3 | A module providing Internationalization with a gettext-based API.
4 |
5 | By using [Gettext](https://hexdocs.pm/gettext),
6 | your module gains a set of macros for translations, for example:
7 |
8 | import DockerElixir19ReleaseWeb.Gettext
9 |
10 | # Simple translation
11 | gettext("Here is the string to translate")
12 |
13 | # Plural translation
14 | ngettext("Here is the string to translate",
15 | "Here are the strings to translate",
16 | 3)
17 |
18 | # Domain-based translation
19 | dgettext("errors", "Here is the error message to translate")
20 |
21 | See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
22 | """
23 | use Gettext, otp_app: :docker_elixir_19_release
24 | end
25 |
--------------------------------------------------------------------------------
/test/support/channel_case.ex:
--------------------------------------------------------------------------------
1 | defmodule DockerElixir19ReleaseWeb.ChannelCase do
2 | @moduledoc """
3 | This module defines the test case to be used by
4 | channel tests.
5 |
6 | Such tests rely on `Phoenix.ChannelTest` and also
7 | import other functionality to make it easier
8 | to build common data structures and query the data layer.
9 |
10 | Finally, if the test case interacts with the database,
11 | it cannot be async. For this reason, every test runs
12 | inside a transaction which is reset at the beginning
13 | of the test unless the test case is marked as async.
14 | """
15 |
16 | use ExUnit.CaseTemplate
17 |
18 | using do
19 | quote do
20 | # Import conveniences for testing with channels
21 | use Phoenix.ChannelTest
22 |
23 | # The default endpoint for testing
24 | @endpoint DockerElixir19ReleaseWeb.Endpoint
25 | end
26 | end
27 |
28 | setup _tags do
29 | :ok
30 | end
31 | end
32 |
--------------------------------------------------------------------------------
/test/support/conn_case.ex:
--------------------------------------------------------------------------------
1 | defmodule DockerElixir19ReleaseWeb.ConnCase do
2 | @moduledoc """
3 | This module defines the test case to be used by
4 | tests that require setting up a connection.
5 |
6 | Such tests rely on `Phoenix.ConnTest` and also
7 | import other functionality to make it easier
8 | to build common data structures and query the data layer.
9 |
10 | Finally, if the test case interacts with the database,
11 | it cannot be async. For this reason, every test runs
12 | inside a transaction which is reset at the beginning
13 | of the test unless the test case is marked as async.
14 | """
15 |
16 | use ExUnit.CaseTemplate
17 |
18 | using do
19 | quote do
20 | # Import conveniences for testing with connections
21 | use Phoenix.ConnTest
22 | alias DockerElixir19ReleaseWeb.Router.Helpers, as: Routes
23 |
24 | # The default endpoint for testing
25 | @endpoint DockerElixir19ReleaseWeb.Endpoint
26 | end
27 | end
28 |
29 | setup _tags do
30 | {:ok, conn: Phoenix.ConnTest.build_conn()}
31 | end
32 | end
33 |
--------------------------------------------------------------------------------
/lib/docker_elixir_19_release/application.ex:
--------------------------------------------------------------------------------
1 | defmodule DockerElixir19Release.Application do
2 | # See https://hexdocs.pm/elixir/Application.html
3 | # for more information on OTP Applications
4 | @moduledoc false
5 |
6 | use Application
7 |
8 | def start(_type, _args) do
9 | # List all child processes to be supervised
10 | children = [
11 | # Start the endpoint when the application starts
12 | DockerElixir19ReleaseWeb.Endpoint
13 | # Starts a worker by calling: DockerElixir19Release.Worker.start_link(arg)
14 | # {DockerElixir19Release.Worker, arg},
15 | ]
16 |
17 | # See https://hexdocs.pm/elixir/Supervisor.html
18 | # for other strategies and supported options
19 | opts = [strategy: :one_for_one, name: DockerElixir19Release.Supervisor]
20 | Supervisor.start_link(children, opts)
21 | end
22 |
23 | # Tell Phoenix to update the endpoint configuration
24 | # whenever the application is updated.
25 | def config_change(changed, _new, removed) do
26 | DockerElixir19ReleaseWeb.Endpoint.config_change(changed, removed)
27 | :ok
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/config/config.exs:
--------------------------------------------------------------------------------
1 | # This file is responsible for configuring your application
2 | # and its dependencies with the aid of the Mix.Config module.
3 | #
4 | # This configuration file is loaded before any dependency and
5 | # is restricted to this project.
6 |
7 | # General application configuration
8 | use Mix.Config
9 |
10 | # Configures the endpoint
11 | config :docker_elixir_19_release, DockerElixir19ReleaseWeb.Endpoint,
12 | url: [host: "localhost"],
13 | secret_key_base: "6Alpv/H1mEDDJAEarC1QwZ2mIqXZXEhpERpfP80YU6m0N16mxAd73taFlBYaSU5K",
14 | render_errors: [view: DockerElixir19ReleaseWeb.ErrorView, accepts: ~w(html json)],
15 | pubsub: [name: DockerElixir19Release.PubSub, adapter: Phoenix.PubSub.PG2]
16 |
17 | # Configures Elixir's Logger
18 | config :logger, :console,
19 | format: "$time $metadata[$level] $message\n",
20 | metadata: [:request_id]
21 |
22 | # Use Jason for JSON parsing in Phoenix
23 | config :phoenix, :json_library, Jason
24 |
25 | # Import environment specific config. This must remain at the bottom
26 | # of this file so it overrides the configuration defined above.
27 | import_config "#{Mix.env()}.exs"
28 |
--------------------------------------------------------------------------------
/lib/docker_elixir_19_release_web/channels/user_socket.ex:
--------------------------------------------------------------------------------
1 | defmodule DockerElixir19ReleaseWeb.UserSocket do
2 | use Phoenix.Socket
3 |
4 | ## Channels
5 | # channel "room:*", DockerElixir19ReleaseWeb.RoomChannel
6 |
7 | # Socket params are passed from the client and can
8 | # be used to verify and authenticate a user. After
9 | # verification, you can put default assigns into
10 | # the socket that will be set for all channels, ie
11 | #
12 | # {:ok, assign(socket, :user_id, verified_user_id)}
13 | #
14 | # To deny connection, return `:error`.
15 | #
16 | # See `Phoenix.Token` documentation for examples in
17 | # performing token verification on connect.
18 | def connect(_params, socket, _connect_info) do
19 | {:ok, socket}
20 | end
21 |
22 | # Socket id's are topics that allow you to identify all sockets for a given user:
23 | #
24 | # def id(socket), do: "user_socket:#{socket.assigns.user_id}"
25 | #
26 | # Would allow you to broadcast a "disconnect" event and terminate
27 | # all active sockets and channels for a given user:
28 | #
29 | # DockerElixir19ReleaseWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{})
30 | #
31 | # Returning `nil` makes this socket anonymous.
32 | def id(_socket), do: nil
33 | end
34 |
--------------------------------------------------------------------------------
/lib/docker_elixir_19_release_web/templates/page/index.html.eex:
--------------------------------------------------------------------------------
1 | A productive web framework that <%= Application.get_env(:docker_elixir_19_release, :cool_text) %><%= gettext "Welcome to %{name}!", name: "Phoenix" %>
3 |
does not compromise speed or maintainability.Resources
10 |
11 |
21 | Help
24 |
25 |
35 |
<%= get_flash(@conn, :info) %>
25 |<%= get_flash(@conn, :error) %>
26 | <%= render @view_module, @view_template, assigns %> 27 |