release tooling
This commit is contained in:
parent
66cc647a52
commit
ac73c20cea
3
.gitignore
vendored
3
.gitignore
vendored
@ -9,4 +9,5 @@ erl_crash.dump
|
|||||||
*.beam
|
*.beam
|
||||||
/config/*.secret.exs
|
/config/*.secret.exs
|
||||||
.elixir_ls/
|
.elixir_ls/
|
||||||
/priv/static/assets
|
/priv/static/
|
||||||
|
/rel/overlays/
|
28
lib/chicken_egg/release.ex
Normal file
28
lib/chicken_egg/release.ex
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
defmodule ChickenEgg.Release do
|
||||||
|
@moduledoc """
|
||||||
|
Used for executing DB release tasks when run in production without Mix
|
||||||
|
installed.
|
||||||
|
"""
|
||||||
|
@app :chicken_egg
|
||||||
|
|
||||||
|
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
|
12
make_release.sh
Executable file
12
make_release.sh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
export SECRET_KEY_BASE=$(mix phx.gen.secret)
|
||||||
|
export DATABASE_URL=ecto://postgres:postgres@localhost/chicken_egg_dev
|
||||||
|
|
||||||
|
mix deps.get --only prod
|
||||||
|
MIX_ENV=prod mix compile
|
||||||
|
MIX_ENV=prod mix assets.deploy
|
||||||
|
mix phx.gen.release
|
||||||
|
|
||||||
|
MIX_ENV=prod mix release
|
4
sync_prod.sh
Normal file
4
sync_prod.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
rsync -vau _build/prod/rel/chicken_egg/ servi-eins:/srv/www/chicken_egg/
|
Loading…
Reference in New Issue
Block a user