mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
Merge pull request #3 from CloudFire-LLC/mix-release-runtime-config
Upgrade Phoenix to 1.5.1
This commit is contained in:
@@ -7,3 +7,4 @@ Makefile
|
||||
README*
|
||||
LICENSE
|
||||
test/
|
||||
node_modules
|
||||
|
||||
19
.github/workflows/build.yml
vendored
Normal file
19
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
name: Build
|
||||
description: 'Build and push docker images.'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build-app-image:
|
||||
runs-on: ubuntu:18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
docker build -t cloudfirellc/cloudfire:${GITHUB_SHA::8} .
|
||||
- name: Push Docker Image
|
||||
run: |
|
||||
docker push cloudfirellc/cloudfire:latest
|
||||
12
.github/workflows/deploy.yml
vendored
12
.github/workflows/deploy.yml
vendored
@@ -1,16 +1,8 @@
|
||||
name: Deploy
|
||||
description: "Deploy images"
|
||||
|
||||
on:
|
||||
release: created
|
||||
|
||||
jobs:
|
||||
build-image:
|
||||
runs-on: ubuntu:18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
docker build -t cloudfirellc/cloudfire:latest .
|
||||
- name: Push Docker Image
|
||||
run: |
|
||||
docker push cloudfirellc/cloudfire:latest
|
||||
|
||||
|
||||
50
Dockerfile
50
Dockerfile
@@ -2,52 +2,64 @@ FROM elixir:1.10.2-alpine AS builder
|
||||
|
||||
MAINTAINER docker@cloudfire.network
|
||||
|
||||
ARG MIX_ENV=prod
|
||||
ARG PHOENIX_DIR=./apps/cloudfire
|
||||
ENV MIX_ENV=prod
|
||||
ARG PHOENIX_DIR=./apps/cf_phx
|
||||
|
||||
# These are used only for building and won't matter later on
|
||||
# ENV DATABASE_URL=ecto://dummy:dummy@dummy/dummy
|
||||
# ENV SECRET_KEY_BASE=dummy
|
||||
|
||||
# Install dependencies
|
||||
RUN apk add npm
|
||||
RUN apk add --update build-base npm git
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN mix do local.hex --force, local.rebar --force
|
||||
# Install hex + rebar
|
||||
RUN mix local.hex --force
|
||||
RUN mix local.rebar --force
|
||||
|
||||
COPY config/ .
|
||||
COPY mix.exs ./
|
||||
COPY config config
|
||||
COPY mix.* ./
|
||||
|
||||
COPY apps/cf_phx/mix.exs ./apps/cf_phx/
|
||||
COPY apps/system_engine/mix.exs ./apps/system_engine/
|
||||
COPY $PHOENIX_DIR/mix.* $PHOENIX_DIR/
|
||||
COPY apps/system_engine/mix.* ./apps/system_engine/
|
||||
|
||||
RUN mix do deps.get --only $MIX_ENV, deps.compile
|
||||
|
||||
COPY . .
|
||||
RUN mix deps.get
|
||||
RUN mix deps.compile
|
||||
|
||||
# Build assets
|
||||
COPY $PHOENIX_DIR/assets $PHOENIX_DIR/assets
|
||||
COPY priv priv
|
||||
COPY $PHOENIX_DIR/priv $PHOENIX_DIR/priv
|
||||
RUN npm install --prefix $PHOENIX_DIR/assets
|
||||
RUN npm run deploy --prefix $PHOENIX_DIR/assets
|
||||
RUN mix phx.digest
|
||||
|
||||
# Build project
|
||||
COPY $PHOENIX_DIR/lib $PHOENIX_DIR/lib
|
||||
COPY apps/system_engine/lib ./apps/system_engine/
|
||||
RUN mix compile
|
||||
|
||||
# Build release
|
||||
RUN mix release bundled
|
||||
|
||||
# The built application is now contained in _build/
|
||||
|
||||
# This is what the builder image is based on
|
||||
FROM alpine:3.11
|
||||
|
||||
RUN apk add --no-cache \
|
||||
ncurses-dev \
|
||||
openssl-dev
|
||||
|
||||
# --------------------------------------------------
|
||||
FROM alpine:3.11 AS app
|
||||
RUN apk add --update bash openssl
|
||||
|
||||
EXPOSE 4000
|
||||
ENV PORT=4000 \
|
||||
MIX_ENV=prod \
|
||||
SHELL=/bin/bash
|
||||
|
||||
RUN mkdir /app
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/_build/prod/rel/bundled .
|
||||
|
||||
CMD ["bin/bundled", "start"]
|
||||
COPY --from=builder /app/_build/prod/rel/bundled .
|
||||
RUN chown -R nobody: /app
|
||||
USER nobody
|
||||
|
||||
ENV HOME=/app
|
||||
|
||||
4
apps/cf_phx/assets/package-lock.json
generated
4
apps/cf_phx/assets/package-lock.json
generated
@@ -5164,10 +5164,10 @@
|
||||
}
|
||||
},
|
||||
"phoenix": {
|
||||
"version": "file:../deps/phoenix"
|
||||
"version": "file:../../../deps/phoenix"
|
||||
},
|
||||
"phoenix_html": {
|
||||
"version": "file:../deps/phoenix_html"
|
||||
"version": "file:../../../deps/phoenix_html"
|
||||
},
|
||||
"pify": {
|
||||
"version": "4.0.1",
|
||||
|
||||
@@ -10,6 +10,8 @@ defmodule CfPhx.Application do
|
||||
children = [
|
||||
# Start the Ecto repository
|
||||
CfPhx.Repo,
|
||||
# Start the PubSub system
|
||||
{Phoenix.PubSub, name: CfPhx.PubSub},
|
||||
# Start the endpoint when the application starts
|
||||
CfPhxWeb.Endpoint
|
||||
# Starts a worker by calling: CfPhx.Worker.start_link(arg)
|
||||
|
||||
24
apps/cf_phx/lib/cf_phx/release.ex
Normal file
24
apps/cf_phx/lib/cf_phx/release.ex
Normal file
@@ -0,0 +1,24 @@
|
||||
defmodule CfPhx.Release do
|
||||
@app :cf_phx
|
||||
|
||||
def migrate do
|
||||
load_app()
|
||||
|
||||
for repo <- repos() do
|
||||
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: true))
|
||||
end
|
||||
end
|
||||
|
||||
def rollback(repo, version) do
|
||||
load_app()
|
||||
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :down, to: version))
|
||||
end
|
||||
|
||||
defp repos do
|
||||
Application.fetch_env!(@app, :ecto_repos)
|
||||
end
|
||||
|
||||
defp load_app do
|
||||
Application.load(@app)
|
||||
end
|
||||
end
|
||||
@@ -24,7 +24,7 @@
|
||||
<main role="main" class="container">
|
||||
<p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
|
||||
<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
|
||||
<%= render @view_module, @view_template, assigns %>
|
||||
<%= @inner_content %>
|
||||
</main>
|
||||
<script type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
|
||||
</body>
|
||||
|
||||
@@ -37,8 +37,8 @@ defmodule CfPhx.MixProject do
|
||||
# Type `mix help deps` for examples and options.
|
||||
defp deps do
|
||||
[
|
||||
{:phoenix, "~> 1.4.12"},
|
||||
{:phoenix_pubsub, "~> 1.1"},
|
||||
{:phoenix, "~> 1.5.1"},
|
||||
{:phoenix_pubsub, "~> 2.0"},
|
||||
{:phoenix_ecto, "~> 4.0"},
|
||||
{:ecto_sql, "~> 3.1"},
|
||||
{:ecto_network, "~> 1.3.0"}, # Exposes Postgres inet, cidr, macaddr types
|
||||
@@ -47,7 +47,7 @@ defmodule CfPhx.MixProject do
|
||||
{:phoenix_live_reload, "~> 1.2", only: :dev},
|
||||
{:gettext, "~> 0.11"},
|
||||
{:jason, "~> 1.0"},
|
||||
{:plug_cowboy, "~> 2.0"}
|
||||
{:plug_cowboy, "~> 2.1"}
|
||||
]
|
||||
end
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@ defmodule CfPhxWeb.ConnCase do
|
||||
using do
|
||||
quote do
|
||||
# Import conveniences for testing with connections
|
||||
use Phoenix.ConnTest
|
||||
import Plug.Conn
|
||||
import Phoenix.ConnTest
|
||||
alias CfPhxWeb.Router.Helpers, as: Routes
|
||||
|
||||
# The default endpoint for testing
|
||||
|
||||
@@ -27,7 +27,7 @@ config :cf_phx, CfPhxWeb.Endpoint,
|
||||
url: [host: "localhost"],
|
||||
secret_key_base: "5OVYJ83AcoQcPmdKNksuBhJFBhjHD1uUa9mDOHV/6EIdBQ6pXksIhkVeWIzFk5SD",
|
||||
render_errors: [view: CfPhxWeb.ErrorView, accepts: ~w(html json)],
|
||||
pubsub: [name: CfPhx.PubSub, adapter: Phoenix.PubSub.PG2]
|
||||
pubsub_server: [name: CfPhx.PubSub]
|
||||
|
||||
# Configures Elixir's Logger
|
||||
config :logger, :console,
|
||||
|
||||
@@ -52,4 +52,3 @@ config :logger, level: :info
|
||||
|
||||
# Finally import the config/prod.secret.exs which loads secrets
|
||||
# and configuration from environment variables.
|
||||
import_config "prod.secret.exs"
|
||||
|
||||
6
mix.lock
6
mix.lock
@@ -11,13 +11,13 @@
|
||||
"gettext": {:hex, :gettext, "0.17.4", "f13088e1ec10ce01665cf25f5ff779e7df3f2dc71b37084976cf89d1aa124d5c", [:mix], [], "hexpm", "3c75b5ea8288e2ee7ea503ff9e30dfe4d07ad3c054576a6e60040e79a801e14d"},
|
||||
"jason": {:hex, :jason, "1.2.0", "10043418c42d2493d0ee212d3fddd25d7ffe484380afad769a0a38795938e448", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "116747dbe057794c3a3e4e143b7c8390b29f634e16c78a7f59ba75bfa6852e7f"},
|
||||
"mime": {:hex, :mime, "1.3.1", "30ce04ab3175b6ad0bdce0035cba77bba68b813d523d1aac73d9781b4d193cf8", [:mix], [], "hexpm", "6cbe761d6a0ca5a31a0931bf4c63204bceb64538e664a8ecf784a9a6f3b875f1"},
|
||||
"phoenix": {:hex, :phoenix, "1.4.16", "2cbbe0c81e6601567c44cc380c33aa42a1372ac1426e3de3d93ac448a7ec4308", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.8.1 or ~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "856cc1a032fa53822737413cf51aa60e750525d7ece7d1c0576d90d7c0f05c24"},
|
||||
"phoenix": {:hex, :phoenix, "1.5.1", "95156589879dc69201d5fc0ebdbfdfc7901a09a3616ea611ec297f81340275a2", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 2.13", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.1.2 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "fc272b38e79d2881790fccae6f67a9fbe9b790103d6878175ea03d23003152eb"},
|
||||
"phoenix_ecto": {:hex, :phoenix_ecto, "4.1.0", "a044d0756d0464c5a541b4a0bf4bcaf89bffcaf92468862408290682c73ae50d", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.9", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "c5e666a341ff104d0399d8f0e4ff094559b2fde13a5985d4cb5023b2c2ac558b"},
|
||||
"phoenix_html": {:hex, :phoenix_html, "2.14.1", "7dabafadedb552db142aacbd1f11de1c0bbaa247f90c449ca549d5e30bbc66b4", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "536d5200ad37fecfe55b3241d90b7a8c3a2ca60cd012fc065f776324fa9ab0a9"},
|
||||
"phoenix_live_reload": {:hex, :phoenix_live_reload, "1.2.1", "274a4b07c4adbdd7785d45a8b0bb57634d0b4f45b18d2c508b26c0344bd59b8f", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "41b4103a2fa282cfd747d377233baf213c648fdcc7928f432937676532490eee"},
|
||||
"phoenix_pubsub": {:hex, :phoenix_pubsub, "1.1.2", "496c303bdf1b2e98a9d26e89af5bba3ab487ba3a3735f74bf1f4064d2a845a3e", [:mix], [], "hexpm", "1f13f9f0f3e769a667a6b6828d29dec37497a082d195cc52dbef401a9b69bf38"},
|
||||
"phoenix_pubsub": {:hex, :phoenix_pubsub, "2.0.0", "a1ae76717bb168cdeb10ec9d92d1480fec99e3080f011402c0a2d68d47395ffb", [:mix], [], "hexpm", "c52d948c4f261577b9c6fa804be91884b381a7f8f18450c5045975435350f771"},
|
||||
"plug": {:hex, :plug, "1.10.0", "6508295cbeb4c654860845fb95260737e4a8838d34d115ad76cd487584e2fc4d", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "422a9727e667be1bf5ab1de03be6fa0ad67b775b2d84ed908f3264415ef29d4a"},
|
||||
"plug_cowboy": {:hex, :plug_cowboy, "2.1.2", "8b0addb5908c5238fac38e442e81b6fcd32788eaa03246b4d55d147c47c5805e", [:mix], [{:cowboy, "~> 2.5", [hex: :cowboy, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "7d722581ce865a237e14da6d946f92704101740a256bd13ec91e63c0b122fc70"},
|
||||
"plug_cowboy": {:hex, :plug_cowboy, "2.2.1", "fcf58aa33227a4322a050e4783ee99c63c031a2e7f9a2eb7340d55505e17f30f", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "3b43de24460d87c0971887286e7a20d40462e48eb7235954681a20cee25ddeb6"},
|
||||
"plug_crypto": {:hex, :plug_crypto, "1.1.2", "bdd187572cc26dbd95b87136290425f2b580a116d3fb1f564216918c9730d227", [:mix], [], "hexpm", "6b8b608f895b6ffcfad49c37c7883e8df98ae19c6a28113b02aa1e9c5b22d6b5"},
|
||||
"postgrex": {:hex, :postgrex, "0.15.3", "5806baa8a19a68c4d07c7a624ccdb9b57e89cbc573f1b98099e3741214746ae4", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "4737ce62a31747b4c63c12b20c62307e51bb4fcd730ca0c32c280991e0606c90"},
|
||||
"ranch": {:hex, :ranch, "1.7.1", "6b1fab51b49196860b733a49c07604465a47bdb78aa10c1c16a3d199f7f8c881", [:rebar3], [], "hexpm", "451d8527787df716d99dc36162fca05934915db0b6141bbdac2ea8d3c7afc7d7"},
|
||||
|
||||
Reference in New Issue
Block a user