add release files
This commit is contained in:
parent
fa866cc10e
commit
918229f8c6
6 changed files with 41 additions and 0 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -28,6 +28,8 @@ chiya-*.tar
|
|||
# Ignore assets that are produced by build tools.
|
||||
/priv/static/assets/
|
||||
|
||||
/priv/static/*
|
||||
|
||||
# Ignore digested assets cache.
|
||||
/priv/static/cache_manifest.json
|
||||
|
||||
|
@ -35,3 +37,5 @@ chiya-*.tar
|
|||
npm-debug.log
|
||||
/assets/node_modules/
|
||||
|
||||
# env file
|
||||
.env
|
||||
|
|
28
lib/chiya/release.ex
Normal file
28
lib/chiya/release.ex
Normal file
|
@ -0,0 +1,28 @@
|
|||
defmodule Chiya.Release do
|
||||
@moduledoc """
|
||||
Used for executing DB release tasks when run in production without Mix
|
||||
installed.
|
||||
"""
|
||||
@app :chiya
|
||||
|
||||
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
|
3
rel/overlays/bin/migrate
Executable file
3
rel/overlays/bin/migrate
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
cd -P -- "$(dirname -- "$0")"
|
||||
exec ./chiya eval Chiya.Release.migrate
|
1
rel/overlays/bin/migrate.bat
Executable file
1
rel/overlays/bin/migrate.bat
Executable file
|
@ -0,0 +1 @@
|
|||
call "%~dp0\chiya" eval Chiya.Release.migrate
|
3
rel/overlays/bin/server
Executable file
3
rel/overlays/bin/server
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
cd -P -- "$(dirname -- "$0")"
|
||||
PHX_SERVER=true exec ./chiya start
|
2
rel/overlays/bin/server.bat
Executable file
2
rel/overlays/bin/server.bat
Executable file
|
@ -0,0 +1,2 @@
|
|||
set PHX_SERVER=true
|
||||
call "%~dp0\chiya" start
|
Loading…
Reference in a new issue