mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
Mix releases (#13)
This commit is contained in:
parent
a81464f189
commit
527170e79b
9 changed files with 70 additions and 185 deletions
|
@ -49,7 +49,3 @@ config :logger, level: :warn
|
|||
# force_ssl: [hsts: true]
|
||||
#
|
||||
# Check `Plug.SSL` for all available options in `force_ssl`.
|
||||
|
||||
# Finally import the config/prod.secret.exs which loads secrets
|
||||
# and configuration from environment variables.
|
||||
import_config "prod.secret.exs"
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
# In this file, we load production configuration and secrets
|
||||
# from environment variables. You can also hardcode secrets,
|
||||
# although such is generally not recommended and you have to
|
||||
# remember to add this file to your .gitignore.
|
||||
import Config
|
||||
|
||||
database_url =
|
||||
System.get_env("DATABASE_URL") ||
|
||||
raise """
|
||||
environment variable DATABASE_URL is missing.
|
||||
For example: ecto://USER:PASS@HOST/DATABASE
|
||||
"""
|
||||
|
||||
config :bcrypt_elixir,
|
||||
log_rounds: String.to_integer(System.get_env("BCRYPT_ROUNDS") || "12")
|
||||
|
||||
config :philomena,
|
||||
channel_image_file_root: System.get_env("CHANNEL_IMAGE_FILE_ROOT"),
|
||||
channel_banner_file_root: System.get_env("CHANNEL_BANNER_FILE_ROOT"),
|
||||
anonymous_name_salt: System.get_env("ANONYMOUS_NAME_SALT"),
|
||||
advert_file_root: System.get_env("ADVERT_FILE_ROOT"),
|
||||
avatar_file_root: System.get_env("AVATAR_FILE_ROOT"),
|
||||
channel_url_root: System.get_env("CHANNEL_URL_ROOT"),
|
||||
badge_file_root: System.get_env("BADGE_FILE_ROOT"),
|
||||
password_pepper: System.get_env("PASSWORD_PEPPER"),
|
||||
avatar_url_root: System.get_env("AVATAR_URL_ROOT"),
|
||||
advert_url_root: System.get_env("ADVERT_URL_ROOT"),
|
||||
image_file_root: System.get_env("IMAGE_FILE_ROOT"),
|
||||
tumblr_api_key: System.get_env("TUMBLR_API_KEY"),
|
||||
otp_secret_key: System.get_env("OTP_SECRET_KEY"),
|
||||
image_url_root: System.get_env("IMAGE_URL_ROOT"),
|
||||
badge_url_root: System.get_env("BADGE_URL_ROOT"),
|
||||
mailer_address: System.get_env("MAILER_ADDRESS"),
|
||||
tag_file_root: System.get_env("TAG_FILE_ROOT"),
|
||||
tag_url_root: System.get_env("TAG_URL_ROOT"),
|
||||
proxy_host: System.get_env("PROXY_HOST"),
|
||||
camo_host: System.get_env("CAMO_HOST"),
|
||||
camo_key: System.get_env("CAMO_KEY"),
|
||||
cdn_host: System.get_env("CDN_HOST")
|
||||
|
||||
config :philomena, Philomena.Repo,
|
||||
# ssl: true,
|
||||
url: database_url,
|
||||
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "32")
|
||||
|
||||
config :philomena, Philomena.Mailer,
|
||||
adapter: Bamboo.SMTPAdapter,
|
||||
server: System.get_env("SMTP_RELAY"),
|
||||
hostname: System.get_env("SMTP_DOMAIN"),
|
||||
port: System.get_env("SMTP_PORT") || 587,
|
||||
username: System.get_env("SMTP_USERNAME"),
|
||||
password: System.get_env("SMTP_PASSWORD"),
|
||||
tls: :always,
|
||||
auth: :always
|
||||
|
||||
secret_key_base =
|
||||
System.get_env("SECRET_KEY_BASE") ||
|
||||
raise """
|
||||
environment variable SECRET_KEY_BASE is missing.
|
||||
You can generate one by calling: mix phx.gen.secret
|
||||
"""
|
||||
|
||||
config :philomena, PhilomenaWeb.Endpoint,
|
||||
http: [ip: {127, 0, 0, 1}, port: {:system, "PORT"}],
|
||||
url: [host: System.get_env("APP_HOSTNAME"), scheme: "https", port: 443],
|
||||
secret_key_base: secret_key_base,
|
||||
server: true
|
||||
|
||||
# ## Using releases (Elixir v1.9+)
|
||||
#
|
||||
# If you are doing OTP releases, you need to instruct Phoenix
|
||||
# to start each relevant endpoint:
|
||||
#
|
||||
# config :philomena, PhilomenaWeb.Endpoint, server: true
|
||||
#
|
||||
# Then you can assemble a release by calling `mix release`.
|
||||
# See `mix help release` for more information.
|
60
config/releases.exs
Normal file
60
config/releases.exs
Normal file
|
@ -0,0 +1,60 @@
|
|||
import Config
|
||||
|
||||
# ## Using releases (Elixir v1.9+)
|
||||
#
|
||||
# If you are doing OTP releases, you need to instruct Phoenix
|
||||
# to start each relevant endpoint:
|
||||
#
|
||||
# config :philomena, PhilomenaWeb.Endpoint, server: true
|
||||
#
|
||||
# Then you can assemble a release by calling `mix release`.
|
||||
# See `mix help release` for more information.
|
||||
|
||||
config :bcrypt_elixir,
|
||||
log_rounds: String.to_integer(System.get_env("BCRYPT_ROUNDS") || "12")
|
||||
|
||||
config :philomena,
|
||||
channel_image_file_root: System.fetch_env!("CHANNEL_IMAGE_FILE_ROOT"),
|
||||
channel_banner_file_root: System.fetch_env!("CHANNEL_BANNER_FILE_ROOT"),
|
||||
anonymous_name_salt: System.fetch_env!("ANONYMOUS_NAME_SALT"),
|
||||
elasticsearch_url: System.get_env("ELASTICSEARCH_URL") || "http://localhost:9200",
|
||||
advert_file_root: System.fetch_env!("ADVERT_FILE_ROOT"),
|
||||
avatar_file_root: System.fetch_env!("AVATAR_FILE_ROOT"),
|
||||
channel_url_root: System.fetch_env!("CHANNEL_URL_ROOT"),
|
||||
badge_file_root: System.fetch_env!("BADGE_FILE_ROOT"),
|
||||
password_pepper: System.fetch_env!("PASSWORD_PEPPER"),
|
||||
avatar_url_root: System.fetch_env!("AVATAR_URL_ROOT"),
|
||||
advert_url_root: System.fetch_env!("ADVERT_URL_ROOT"),
|
||||
image_file_root: System.fetch_env!("IMAGE_FILE_ROOT"),
|
||||
tumblr_api_key: System.fetch_env!("TUMBLR_API_KEY"),
|
||||
otp_secret_key: System.fetch_env!("OTP_SECRET_KEY"),
|
||||
image_url_root: System.fetch_env!("IMAGE_URL_ROOT"),
|
||||
badge_url_root: System.fetch_env!("BADGE_URL_ROOT"),
|
||||
mailer_address: System.fetch_env!("MAILER_ADDRESS"),
|
||||
tag_file_root: System.fetch_env!("TAG_FILE_ROOT"),
|
||||
tag_url_root: System.fetch_env!("TAG_URL_ROOT"),
|
||||
redis_host: System.get_env("REDIS_HOST") || "localhost",
|
||||
proxy_host: System.get_env("PROXY_HOST"),
|
||||
camo_host: System.fetch_env!("CAMO_HOST"),
|
||||
camo_key: System.fetch_env!("CAMO_KEY"),
|
||||
cdn_host: System.fetch_env!("CDN_HOST")
|
||||
|
||||
config :philomena, Philomena.Repo,
|
||||
url: System.fetch_env!("DATABASE_URL"),
|
||||
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "32")
|
||||
|
||||
config :philomena, Philomena.Mailer,
|
||||
adapter: Bamboo.SMTPAdapter,
|
||||
server: System.fetch_env!("SMTP_RELAY"),
|
||||
hostname: System.fetch_env!("SMTP_DOMAIN"),
|
||||
port: System.get_env("SMTP_PORT") || 587,
|
||||
username: System.fetch_env!("SMTP_USERNAME"),
|
||||
password: System.fetch_env!("SMTP_PASSWORD"),
|
||||
tls: :always,
|
||||
auth: :always
|
||||
|
||||
config :philomena, PhilomenaWeb.Endpoint,
|
||||
http: [ip: {127, 0, 0, 1}, port: {:system, "PORT"}],
|
||||
url: [host: System.fetch_env!("APP_HOSTNAME"), scheme: "https", port: 443],
|
||||
secret_key_base: System.fetch_env!("SECRET_KEY_BASE"),
|
||||
server: true
|
3
mix.exs
3
mix.exs
|
@ -4,7 +4,7 @@ defmodule Philomena.MixProject do
|
|||
def project do
|
||||
[
|
||||
app: :philomena,
|
||||
version: "0.1.0",
|
||||
version: "1.1.0",
|
||||
elixir: "~> 1.5",
|
||||
elixirc_paths: elixirc_paths(Mix.env()),
|
||||
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
|
||||
|
@ -61,7 +61,6 @@ defmodule Philomena.MixProject do
|
|||
{:briefly, "~> 0.3.0"},
|
||||
{:phoenix_mtm, "~> 1.0.0"},
|
||||
{:yaml_elixir, "~> 2.4.0"},
|
||||
{:distillery, "~> 2.1"},
|
||||
{:ranch_connection_drainer, "~> 0.1"},
|
||||
{:tesla, "~> 1.3"},
|
||||
{:castore, "~> 0.1"},
|
||||
|
|
1
mix.lock
1
mix.lock
|
@ -16,7 +16,6 @@
|
|||
"db_connection": {:hex, :db_connection, "2.2.2", "3bbca41b199e1598245b716248964926303b5d4609ff065125ce98bcd368939e", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm", "642af240d8a8affb93b4ba5a6fcd2bbcbdc327e1a524b825d383711536f8070c"},
|
||||
"decimal": {:hex, :decimal, "1.8.1", "a4ef3f5f3428bdbc0d35374029ffcf4ede8533536fa79896dd450168d9acdf3c", [:mix], [], "hexpm", "3cb154b00225ac687f6cbd4acc4b7960027c757a5152b369923ead9ddbca7aec"},
|
||||
"dialyxir": {:hex, :dialyxir, "1.0.0", "6a1fa629f7881a9f5aaf3a78f094b2a51a0357c843871b8bc98824e7342d00a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "aeb06588145fac14ca08d8061a142d52753dbc2cf7f0d00fc1013f53f8654654"},
|
||||
"distillery": {:hex, :distillery, "2.1.1", "f9332afc2eec8a1a2b86f22429e068ef35f84a93ea1718265e740d90dd367814", [:mix], [{:artificery, "~> 0.2", [hex: :artificery, repo: "hexpm", optional: false]}], "hexpm", "bbc7008b0161a6f130d8d903b5b3232351fccc9c31a991f8fcbf2a12ace22995"},
|
||||
"ecto": {:hex, :ecto, "3.4.5", "2bcd262f57b2c888b0bd7f7a28c8a48aa11dc1a2c6a858e45dd8f8426d504265", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "8c6d1d4d524559e9b7a062f0498e2c206122552d63eacff0a6567ffe7a8e8691"},
|
||||
"ecto_network": {:hex, :ecto_network, "1.3.0", "1e77fa37c20e0f6a426d3862732f3317b0fa4c18f123d325f81752a491d7304e", [:mix], [{:ecto_sql, ">= 3.0.0", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:phoenix_html, ">= 0.0.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:postgrex, ">= 0.14.0", [hex: :postgrex, repo: "hexpm", optional: false]}], "hexpm", "053a5e46ef2837e8ea5ea97c82fa0f5494699209eddd764e663c85f11b2865bd"},
|
||||
"ecto_sql": {:hex, :ecto_sql, "3.4.5", "30161f81b167d561a9a2df4329c10ae05ff36eca7ccc84628f2c8b9fa1e43323", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.4.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.3.0 or ~> 0.4.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.0", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "31990c6a3579b36a3c0841d34a94c275e727de8b84f58509da5f1b2032c98ac2"},
|
||||
|
|
18
post-receive
18
post-receive
|
@ -35,14 +35,14 @@ if git diff --name-only $oldrev $newrev | grep "^assets/"; then
|
|||
mix phx.digest || die "assets compile failed"
|
||||
fi
|
||||
|
||||
# TODO: fix this when I can figure out how to avoid recompiling
|
||||
# the entire project when the version changes
|
||||
#
|
||||
# # Generate release name to always be the current timestamp so that
|
||||
# # it will be considered an upgrade
|
||||
# export PHILOMENA_VERSION="0.1.$(date +%s)"
|
||||
|
||||
echo "Building release"
|
||||
mix distillery.release --quiet || die "failed to generate release"
|
||||
mix release --overwrite || die "failed to generate release"
|
||||
|
||||
_build/prod/rel/philomena/bin/philomena reboot || die "failed to upgrade app; log in to the server and restart the app manually"
|
||||
# Include a task to restart your running appserver instances here.
|
||||
#
|
||||
# In general, you should have many app instances configured on different
|
||||
# ports using the PORT environment variable, so as to allow you to roll
|
||||
# releases and deploy new code with no visible downtime.
|
||||
#
|
||||
# You can use a reverse proxy like haproxy or nginx to load balance between
|
||||
# different server instances automatically.
|
||||
|
|
|
@ -1,59 +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 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: :"5MEZn{TTU:$GyE/DgOAV0GhEWU>Gj>YwWXmo&pd3t~L8gHVrlSR>8W9API~YL=&^"
|
||||
end
|
||||
|
||||
# N.B.: this cookie has to do with how distributed Erlang authenticates
|
||||
# communication between nodes. With correct firewall configuration, you do not
|
||||
# need to change it.
|
||||
environment :prod do
|
||||
set include_erts: true
|
||||
set include_src: false
|
||||
set cookie: :";?PAn6iwn<<(~GAez2sS/|aNd{tV(k7j%0v3`eD]YN}Ii@?ws$RW|%iuBD<j%9zg"
|
||||
set vm_args: "rel/vm.args"
|
||||
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 :philomena do
|
||||
set version: current_version(:philomena)
|
||||
set applications: [
|
||||
:runtime_tools,
|
||||
philomena: :permanent
|
||||
]
|
||||
end
|
||||
|
3
rel/plugins/.gitignore
vendored
3
rel/plugins/.gitignore
vendored
|
@ -1,3 +0,0 @@
|
|||
*.*
|
||||
!*.exs
|
||||
!.gitignore
|
30
rel/vm.args
30
rel/vm.args
|
@ -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 ${NODENAME}@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
|
Loading…
Reference in a new issue