Web server for viewing Poudriere results
Poudriere requires the following contents to be served:
- Static contents of Poudriere itself in
/
at:/home/poudriere/static-html
without directory index; - Logs in
/data
at:/home/poudriere/data/logs/bulk
with directory index; and - Packages in
/packages
at:/home/poudriere/data
with directory index.
Poudriere needs the following MIME types to be served:
text/plain txt log;
The above type is already specified in the MIME module of Elixir.
See lib/poudriere_elixir_web_endpoint.ex
.
- Logs must be served as static contents/assets, so use
Plug.Static
. - Logs must be served with directory index enabled, so use
PlugStaticLs
. - Use the same configuration between
Plug.Static
andPlugStaticLs
.
plug Plug.Static,
at: "/data", from: "/home/poudriere/data/logs/bulk"
plug PlugStaticLs,
at: "/data", from: "/home/poudriere/data/logs/bulk"
- Packages must be served as static contents/assets, so use
Plug.Static
. - Packages must be served with directory index enabled, so use
PlugStaticLs
. - Use the same configuration between
Plug.Static
andPlugStaticLs
.
plug Plug.Static,
at: "/packages", from: "/home/poudriere/data"
plug PlugStaticLs,
at: "/packages", from: "/home/poudriere/data"
- The directory path must be redirected to the
index.html
file of the same directory, so usePlug.Static.IndexHtml
. (Note thatPlug.Static.IndexHtml
is an independent package/module fromPlug
orPlug.Static
.) - The directory contents must be served as static contents/assets, so use
Plug.Static
. - The files must not be indexed.
plug Plug.Static.IndexHtml, at: "/"
plug Plug.Static, at: "/", from: "/home/poudriere/static-html"
Use the following code:
plug :not_found
plug :halt
def not_found(conn, _) do
Plug.Conn.send_resp(conn, 404, ["not found"," ", "here"])
end
def halt(conn, _) do
Plug.Conn.halt(conn)
end
- Copy shared static files of Poudriere to
/home/poudriere/shared-html
, by:
umask 022 # required to provide world-readable access
mkdir /home/poudriere/shared-html
cp -pr /usr/local/share/poudriere/html/* /home/poudriere/shared-html
-
Configure IP address and port in
config/dev.exs
, and copy the file toconfig/prod.exs
-
To run the server, do this:
elixir --detached -S mix do compile, run --no-halt
mix do deps.get, compile
MIX_ENV=prod mix compile
MIX_ENV=prod mix release
rel/poudriere_elixir_web/bin/poudriere_elixir_web start
- Conform hasn't been included yet: use
config
files