LoginSignup
12
12

More than 5 years have passed since last update.

Dynamo on Elixer - works on Heroku!

Last updated at Posted at 2012-12-26

Excuse

Elixirという勢いのある言語の情報ということで、この記事は大変古く、基本的に歴史的経緯の確認以上の役には立たないと思います。

そもそもElixirってなに

Elixir is a functional meta-programming aware language built on top of the Erlang VM.

  • 1st class なマクロ
  • protocols による多態のサポート
  • Pattern matching
  • 最終的に Erlang の VM を生成する / Erlang、OTPとの連携性

  • 日本語の情報

  • http://d.hatena.ne.jp/k-1/20120310/p1

Heroku toolbelt 入れる

Setup Erlang, rebar, & Elixir

  • Homebrew でとりあえず入れてよし
brew install erlang
brew install elixir
brew install --HEAD rebar

erl
#=> Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false] [dtrace]
rebar --version
#=> rebar 2.0.0 R15B02 20121101_110141 No VCS info available.
elixir -v
#=> Elixir 0.7.0
mix help

ウェブアプリケーションフレームワーク、 Dynamo を入れる

git clone https://github.com/dynamo/dynamo
cd dynamo
mix deps.get
mix install

プロジェクトを作成する

mix dynamo ../shinjuku_ex

First run!

mix deps.get
mix server
# Generated shinjuku_ex.app
# Running ShinjukuEx at localhost:4000 with Cowboy on dev
  • 言われた通り app/views/index.html.eex を編集するとライブで反映される。

deploy to heroku

heroku apps:create shinjuku-ex-official \
    --buildpack "https://github.com/goshakkk/heroku-buildpack-elixir.git"

# Create Procfile
# web: mix server -p=$PORT

# specify versions
echo OTP_R15B02 > .preferred_otp_version
echo v0.7.0 > .preferred_elixir_version
git add . && git commit

# Explicitly add web process
heroku ps:scale web=1
git push heroku master

あとは

static 対応について

Source

Super Ultra Thanks

12
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
12