mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
add extra applications and post-receive hook
This commit is contained in:
parent
d655a24808
commit
8065a9b742
4 changed files with 45 additions and 3 deletions
|
@ -14,7 +14,7 @@ config :philomena, PhilomenaWeb.Endpoint,
|
||||||
cache_static_manifest: "priv/static/cache_manifest.json"
|
cache_static_manifest: "priv/static/cache_manifest.json"
|
||||||
|
|
||||||
# Do not print debug messages in production
|
# Do not print debug messages in production
|
||||||
config :logger, level: :info
|
config :logger, level: :warn
|
||||||
|
|
||||||
# ## SSL Support
|
# ## SSL Support
|
||||||
#
|
#
|
||||||
|
|
2
mix.exs
2
mix.exs
|
@ -20,7 +20,7 @@ defmodule Philomena.MixProject do
|
||||||
def application do
|
def application do
|
||||||
[
|
[
|
||||||
mod: {Philomena.Application, []},
|
mod: {Philomena.Application, []},
|
||||||
extra_applications: [:logger, :runtime_tools]
|
extra_applications: [:logger, :canada, :mnesia, :runtime_tools]
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
41
post-receive
Executable file
41
post-receive
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Set up environment
|
||||||
|
source ~/bin/philomena-env
|
||||||
|
|
||||||
|
read oldrev newrev ref
|
||||||
|
echo "Updating $oldrev -> $newrev ($ref)"
|
||||||
|
|
||||||
|
# Clear variable set to '.' so git commands don't complain
|
||||||
|
unset GIT_DIR
|
||||||
|
|
||||||
|
die() {
|
||||||
|
echo "$*" 1>&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if git diff --name-only $oldrev $newrev | grep "^mix.exs"; then
|
||||||
|
echo "Fetching deps"
|
||||||
|
mix deps.get || die "mix failed to update"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run migrations
|
||||||
|
if git diff --name-only $oldrev $newrev | grep "^priv/repo/migrations"; then
|
||||||
|
echo "Running database migrations"
|
||||||
|
mix ecto.migrate || die "ecto.migrate failed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Compile assets
|
||||||
|
if git diff --name-only $oldrev $newrev | grep "^assets/"; then
|
||||||
|
echo "Compiling assets"
|
||||||
|
npm run deploy --prefix ./assets
|
||||||
|
mix phx.digest || die "assets compile failed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Generate release name to always be the current timestamp so that
|
||||||
|
# it will be considered an upgrade
|
||||||
|
export PHILOMENA_VERSION="0.1.0.$(date +%s)"
|
||||||
|
|
||||||
|
mix distillery.release || die "failed to generate release"
|
||||||
|
|
||||||
|
_build/prod/rel/philomena/bin/philomena upgrade $PHILOMENA_VERSION || die "failed to upgrade app; log in to the server and restart the app manually"
|
|
@ -52,7 +52,8 @@ end
|
||||||
release :philomena do
|
release :philomena do
|
||||||
set version: current_version(:philomena)
|
set version: current_version(:philomena)
|
||||||
set applications: [
|
set applications: [
|
||||||
:runtime_tools
|
:runtime_tools,
|
||||||
|
philomena: :permanent
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue