Add build machinery and Elixir releases instead of Distillery

This commit is contained in:
Mikko Ahlroth 2020-04-18 21:33:20 +03:00
parent 0f4d46ba8f
commit 5a541e5e1c
11 changed files with 19 additions and 109 deletions

3
.gitignore vendored
View file

@ -30,3 +30,6 @@ mebe_2-*.tar
# Built frontend assets
/priv/static
# Build machinery
.vagrant

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "elixir-vagrant-setup"]
path = elixir-vagrant-setup
url = https://gitlab.com/Nicd/elixir-vagrant-setup.git

1
Vagrantfile vendored Symbolic link
View file

@ -0,0 +1 @@
elixir-vagrant-setup/Vagrantfile

View file

@ -1,6 +1,6 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
import Config
# This configuration is loaded before any dependency and is restricted
# to this project. If another project depends on this project, this

1
elixir-vagrant-setup Submodule

@ -0,0 +1 @@
Subproject commit a46a6859539ad2be7469edda9bed807963f187c5

10
mix.exs
View file

@ -7,7 +7,15 @@ defmodule Mebe2.MixProject do
version: "0.3.0",
elixir: "~> 1.10",
start_permanent: Mix.env() == :prod,
deps: deps()
deps: deps(),
releases: [
mebe: [
steps: [:assemble, :tar],
config_providers: [
{Config.Reader, {:system, "MEBE_WORKING_DIR", "/config.prod.exs"}}
]
]
]
]
end

View file

@ -1,62 +0,0 @@
# Import all plugins from `rel/plugins`
# They can then be used by adding `plugin MyPlugin` to
# either an environment, or release definition, where
# `MyPlugin` is the name of the plugin module.
~w(rel plugins *.exs)
|> Path.join()
|> Path.wildcard()
|> Enum.map(&Code.eval_file(&1))
use Mix.Releases.Config,
# This sets the default release built by `mix release`
default_release: :default,
# This sets the default environment used by `mix release`
default_environment: Mix.env()
# For a full list of config options for both releases
# and environments, visit https://hexdocs.pm/distillery/config/distillery.html
# You may define one or more environments in this file,
# an environment's settings will override those of a release
# when building in that environment, this combination of release
# and environment configuration is called a profile
environment :dev do
# If you are running Phoenix, you should make sure that
# server: true is set and the code reloader is disabled,
# even in dev mode.
# It is recommended that you build with MIX_ENV=prod and pass
# the --env flag to Distillery explicitly if you want to use
# dev mode.
set(dev_mode: true)
set(include_erts: false)
set(cookie: :"k(2`m4yq3i$1?0<[)TwNJEVE/Qy.KA&3rl=2C}g7d0bCVx93s^7r5Y%_.&:m,%JX")
end
environment :prod do
set(include_erts: true)
set(include_src: false)
set(cookie: System.get_env("COOKIE") |> String.to_atom())
set(vm_args: "rel/vm.args")
set(
config_providers: [
{Mix.Releases.Config.Providers.Elixir, ["${CONFIG_PATH}/custom-config.exs"]}
]
)
end
# You may define one or more releases in this file.
# If you have not set a default release, or selected one
# when running `mix release`, the first release in the file
# will be used by default
release :mebe_2 do
set(version: current_version(:mebe_2))
set(
applications: [
:runtime_tools
]
)
end

View file

@ -1,12 +0,0 @@
use Mix.Config
# This file is used for configuring the Mebe2 release after release generation time. You can
# override settings that were set during release compilation time using this file by copying the
# settings over and setting a new value for them.
# Example:
# config :mebe_2,
# data_path: "/foo/bar"
# Note: Some settings can be also configured by using environment variables. The values from env
# vars will overwrite the values set here.

View file

@ -1,3 +0,0 @@
*.*
!*.exs
!.gitignore

View file

@ -1,30 +0,0 @@
## This file provide the arguments provided to the VM at startup
## You can find a full list of flags and their behaviours at
## http://erlang.org/doc/man/erl.html
## Name of the node
-name <%= System.get_env("NODENAME") || release_name %>@127.0.0.1
## Cookie for distributed erlang
-setcookie <%= System.get_env("COOKIE") || release.profile.cookie %>
## Heartbeat management; auto-restarts VM if it dies or becomes unresponsive
## (Disabled by default..use with caution!)
##-heart
## Enable kernel poll and a few async threads
##+K true
##+A 5
## For OTP21+, the +A flag is not used anymore,
## +SDio replace it to use dirty schedulers
##+SDio 5
## Increase number of concurrent ports/sockets
##-env ERL_MAX_PORTS 4096
## Tweak GC to run more often
##-env ERL_FULLSWEEP_AFTER 10
# Enable SMP automatically based on availability
# On OTP21+, this is not needed anymore.
-smp auto

1
vagrant_provision.sh Symbolic link
View file

@ -0,0 +1 @@
elixir-vagrant-setup/vagrant_provision.sh