add release config

This commit is contained in:
byte[] 2019-12-07 12:17:12 -05:00
parent 9a3ef4df30
commit d655a24808
5 changed files with 130 additions and 15 deletions

View file

@ -2,23 +2,47 @@
Next generation imageboard. Next generation imageboard.
![](https://derpicdn.net/img/2019/8/23/2125268/full.png) ![](https://derpicdn.net/img/2019/8/23/2125268/full.svg)
To start your Phoenix server: ## Getting started
On systems with `docker` and `docker-compose` installed, the process should be as simple as:
* Install dependencies with `mix deps.get` ```
* Create and migrate your database with `mix ecto.setup` docker-compose build
* Install Node.js dependencies with `cd assets && npm install` docker-compose up
* Start Phoenix endpoint with `mix phx.server` ```
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. If you use `podman` and `podman-compose` instead, the process for constructing a rootless container is nearly identical:
Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html). ```
podman-compose build
podman-compose up
```
## Learn more If you run into an Elasticsearch bootstrap error, you may need to increase your `max_map_count` on the host as follows:
```
sudo sysctl -w vm.max_map_count=262144
```
* Official website: http://www.phoenixframework.org/ If you have SELinux enforcing, you should run the following in the application directory on the host before proceeding:
* Guides: https://hexdocs.pm/phoenix/overview.html ```
* Docs: https://hexdocs.pm/phoenix chcon -Rt svirt_sandbox_file_t .
* Mailing list: http://groups.google.com/group/phoenix-talk ```
* Source: https://github.com/phoenixframework/phoenix
This allows Docker or Podman to bind mount the application directory into the containers.
## Deployment
You need a key installed on the server you target, and the git remote installed in your ssh configuration.
git remote add production philomena@<serverip>:philomena/
The general syntax is:
git push production master
And if everything goes wrong:
git reset HEAD^ --hard
git push -f production master
(to be repeated until it works again)

View file

@ -4,7 +4,7 @@ defmodule Philomena.MixProject do
def project do def project do
[ [
app: :philomena, app: :philomena,
version: "0.1.0", version: System.get_env("PHILOMENA_VERSION") || "0.1.0",
elixir: "~> 1.5", elixir: "~> 1.5",
elixirc_paths: elixirc_paths(Mix.env()), elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(), compilers: [:phoenix, :gettext] ++ Mix.compilers(),

58
rel/config.exs Normal file
View file

@ -0,0 +1,58 @@
# 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
]
end

3
rel/plugins/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
*.*
!*.exs
!.gitignore

30
rel/vm.args Normal file
View file

@ -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