-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Create dockerfile for the build - Create scripts to generate the release - Use distillery instead of elixir release for the hot reload support
- Loading branch information
Samuel Manzanera
committed
May 29, 2020
1 parent
ca2f75f
commit 5115fbe
Showing
13 changed files
with
208 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/_build | ||
/cover | ||
/deps | ||
/doc | ||
/.fetch | ||
erl_crash.dump | ||
*.ez | ||
*.beam | ||
/config/*.secret.exs | ||
.elixir_ls | ||
**/doc | ||
. | ||
|
||
/apps/uniris_core/priv/crypto/c_dist | ||
/apps/uniris_core/priv/crypto/storage_nonce | ||
/apps/uniris_core/priv/storage | ||
/apps/uniris_core/priv/last_sync | ||
/apps/uniris_core/priv/p2p/test_seeds | ||
|
||
/create_release.sh | ||
/docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
mkdir -p rel/artifacts | ||
|
||
# Install updated versions of hex/rebar | ||
mix local.rebar --force | ||
mix local.hex --if-missing --force | ||
|
||
export MIX_ENV=prod | ||
|
||
# Fetch deps and compile | ||
mix deps.get | ||
|
||
# Run an explicit clean to remove any build artifacts from the host | ||
rm -Rf _build/prod | ||
|
||
# Clean the updated files during the dev (last_sync, storage_nonce, file storage) | ||
mix clean_priv_dir | ||
|
||
# Build the release | ||
mix distillery.release | ||
|
||
# Copy tarball to output | ||
cp "_build/prod/rel/uniris_node/releases/$VERSION/uniris_node.tar.gz" rel/artifacts/"uniris_node-$VERSION.tar.gz" | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM ubuntu | ||
|
||
ENV VERSION=$version | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV LANG=en_US.UTF-8 | ||
|
||
# Install Erlang,Elixir and build essentials | ||
RUN apt-get update && \ | ||
apt-get install -y wget gnupg2 build-essential -y locales git && \ | ||
locale-gen en_US.UTF-8 && \ | ||
wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && \ | ||
dpkg -i erlang-solutions_2.0_all.deb && \ | ||
apt-get update && \ | ||
apt-get install -y esl-erlang elixir | ||
|
||
# Install libsodium | ||
RUN wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz && \ | ||
tar zxvf LATEST.tar.gz && \ | ||
cd libsodium-stable && \ | ||
./configure && \ | ||
make && make check && \ | ||
make install && \ | ||
ldconfig | ||
|
||
RUN mkdir /opt/build | ||
WORKDIR /opt/build | ||
COPY . . | ||
|
||
CMD ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Check the arguments | ||
if [[ $# -eq 0 ]] ; then | ||
echo " | ||
Missing version number | ||
Usage: | ||
./docker_release [version_number] | ||
" | ||
exit 1 | ||
fi | ||
|
||
VERSION=$1 | ||
|
||
# Build an image for the release with Elixir/Erlang and Libsodium | ||
docker build -f docker/build.dockerfile -t uniris_release . | ||
|
||
# Run the create_release to generate the release with the given version | ||
docker run -v $(pwd):/opt/build --rm -it --env VERSION=$VERSION uniris_release:latest ./create_release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# 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 Distillery.Releases.Config, | ||
# This sets the default release built by `mix distillery.release` | ||
default_release: :default, | ||
# This sets the default environment used by `mix distillery.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: :"8y|aIx=xQ|1$Ip73CXG>HJz5@kWhR~OyzS?>_en(asysESIrl76Tr0H*RHV@LXK%" | ||
end | ||
|
||
environment :prod do | ||
set include_erts: true | ||
set include_src: false | ||
set cookie: :"c$^t~i5q@BHl>tHN;!*@d_n|!h|6n0~f)6q{Qk1Eg(IUJ$YH_oFUE_RCRGjGI3%G" | ||
set vm_args: "rel/vm.args" | ||
set config_providers: [ | ||
{Distillery.Releases.Config.Providers.Elixir, ["${RELEASE_ROOT_DIR}/etc/runtime_config.exs"]} | ||
] | ||
set overlays: [ | ||
{:copy, "rel/runtime_config.exs", "etc/runtime_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 distillery.release`, the first release in the file | ||
# will be used by default | ||
|
||
release :uniris_node do | ||
set version: System.fetch_env!("VERSION") | ||
set applications: [ | ||
:runtime_tools, | ||
uniris_core: :permanent, | ||
uniris_web: :permanent | ||
] | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.* | ||
!*.exs | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
import Config | ||
|
||
config :uniris_core, UnirisCore.Crypto, | ||
config :uniris_core, UnirisCore.Crypto.SoftwareKeystore, | ||
seed: System.fetch_env!("UNIRIS_CRYPTO_SEED") | ||
|
||
config :uniris_core, UnirisCore.P2P, | ||
port: System.get_env("UNIRIS_P2P_PORT", "3002") |> String.to_integer() | ||
port: 3002 | ||
|
||
config :uniris_web, UnirisWeb.Endpoint, | ||
https: [ | ||
port: System.get_env("UNIRIS_WEB_PORT", "443") |> String.to_integer(), | ||
keyfile: System.fetch_env!("UNIRIS_WEB_SSL_KEY_PATH"), | ||
certfile: System.fetch_env!("UNIRIS_WEB_SSL_CERT_PATH") | ||
], | ||
url: [port: System.get_env("UNIRIS_WEB_PORT", "443") |> String.to_integer()] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
## 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 <%= release_name %>@127.0.0.1 | ||
|
||
## Cookie for distributed erlang | ||
-setcookie <%= 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 |