harapeko / phoenix

phoenixを遊んで見る
0 stars 0 forks source link

インストール時の備忘録 #1

Closed harapeko closed 7 years ago

harapeko commented 7 years ago

*参考URLここ Cloud9でPhoenixプロジェクト作成

*その他 What is the difference between using {:system, “PORT”} and System.get_env(“PORT”) in deployment? dev.exvで環境変数取得する書き方がなんでこれでいけるのか調べてみた phoenixのほうで用意しているぽい

.gitignoreは最初からあるものを使えば問題なさそう

harapeko commented 7 years ago

自分で追加した環境変数はSystem.get_env("DB_PASS")って感じにとってくればいいだけだった

harapeko commented 7 years ago

コンソールに[error] backend port not found: :inotifywaitっていうエラーがでた

ライブラリローディングのために必要なライブラリがなかった模様。

$ sudo apt-get update
$ sudo apt-get install inotify-tools

パッケージ更新しないとinotify-toolsないって怒られた

参考URL PhoenixをCloud 9上で動かしてみる

harapeko commented 7 years ago

見てみるとまだエラーでてる

[info] Running HellowPhoenix.Endpoint with Cowboy using http://localhost:8080
28 Oct 11:42:48 - error: Compiling of web/static/js/socket.js failed. Couldn't find preset "/home/ubuntu/workspace/hellow_phoenix/node_modules/babel-preset-es2015" relative to directory "web/static/js" 
28 Oct 11:42:48 - error: Compiling of web/static/js/app.js failed. Couldn't find preset "/home/ubuntu/workspace/hellow_phoenix/node_modules/babel-preset-es2015" relative to directory "web/static/js" 
28 Oct 11:42:48 - info: compiled 2 files into app.css, copied 3 in 2 sec
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.

どうもnpmがコンパイルに使うbabel-preset-es2015がないぽい npm install babel-preset-es2015をプロジェクトディレクトリで叩く

[info] Running HellowPhoenix.Endpoint with Cowboy using http://localhost:8080
28 Oct 11:55:30 - info: compiling
28 Oct 11:55:30 - error: Compiling of web/static/js/app.js failed. Couldn't find preset "/home/ubuntu/workspace/hellow_phoenix/node_modules/babel-preset-es2016" relative to directory "web/static/js" 
28 Oct 11:55:30 - error: Compiling of web/static/js/socket.js failed. Couldn't find preset "/home/ubuntu/workspace/hellow_phoenix/node_modules/babel-preset-es2016" relative to directory "web/static/js" 
28 Oct 11:55:30 - info: compiled 2 files into app.css, copied 3 in 7.5 sec
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.

今度はbabel-preset-es2016を求められた

npm install babel-preset-es2016をプロジェクトディレクトリで叩く

[info] Running HellowPhoenix.Endpoint with Cowboy using http://localhost:8080
Setting up watches.  Beware: since -r was given, this may take a while!
28 Oct 12:00:15 - info: compiling
28 Oct 12:00:15 - info: compiled 6 files into 2 files, copied 3 in 10.2 sec
Watches established.

エラー消えた。めでたい✌('ω'✌ )三✌('ω')✌三( ✌'ω')✌

参考URL PhoenixをCloud 9上で動かしてみる

harapeko commented 7 years ago

cloud9上は再起動すると環境変数がリセットされる模様(export xxx=xxxで書き込んだ) 面倒なので、~/.bashrcexport xxx=xxxを書いたった

harapeko commented 7 years ago

とりあえず、インストール関連はこれで良しとする。close!

ちなみにmix phoenix.serverした後のログ

[info] Running HellowPhoenix.Endpoint with Cowboy using http://localhost:8080
01 Nov 08:12:18 - info: compiling
01 Nov 08:12:19 - info: compiled 6 files into 2 files, copied 3 in 13.3 sec
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
[info] GET /
[debug] Processing by HellowPhoenix.PageController.index/2
  Parameters: %{}
  Pipelines: [:browser]
[info] Sent 200 in 48ms
Compiling 8 files (.ex)
[info] GET /
[debug] Processing by HellowPhoenix.PageController.index/2
  Parameters: %{}
  Pipelines: [:browser]
[info] Sent 200 in 280µs
[info] GET /
[debug] Processing by HellowPhoenix.PageController.index/2
  Parameters: %{}
  Pipelines: [:browser]
[info] Sent 200 in 302µs
[info] GET /posts
[debug] Processing by HellowPhoenix.PostController.index/2
  Parameters: %{}
  Pipelines: [:browser]
[debug] QUERY OK source="posts" db=1.9ms
SELECT p0."id", p0."title", p0."body", p0."inserted_at", p0."updated_at" FROM "posts" AS p0 []
[info] Sent 200 in 32ms
[info] GET /post
[debug] ** (Phoenix.Router.NoRouteError) no route found for GET /post (HellowPhoenix.Router)
    (hellow_phoenix) web/router.ex:1: HellowPhoenix.Router.match_route/4
    (hellow_phoenix) web/router.ex:1: HellowPhoenix.Router.do_call/2
    (hellow_phoenix) lib/hellow_phoenix/endpoint.ex:1: HellowPhoenix.Endpoint.phoenix_pipeline/1
    (hellow_phoenix) lib/plug/debugger.ex:123: HellowPhoenix.Endpoint."call (overridable 3)"/2
    (hellow_phoenix) lib/hellow_phoenix/endpoint.ex:1: HellowPhoenix.Endpoint.call/2
    (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
    (cowboy) src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4

[info] GET /posts/new
[debug] Processing by HellowPhoenix.PostController.new/2
  Parameters: %{}
  Pipelines: [:browser]
[info] Sent 200 in 23ms
[info] POST /posts
[debug] Processing by HellowPhoenix.PostController.create/2
  Parameters: %{"_csrf_token" => "d3c4BUszOgY6UgQCAAwaJmoEBSMgEAAACAPTxgXDQd1Q8GmGA4KeQA==", "_utf8" => "✓", "post" => %{"body" => "✌('ω'✌ )三✌('ω')✌三( ✌'ω')✌", "title" => "はじめてのとうこう!"}}
  Pipelines: [:browser]
[debug] QUERY OK db=5.1ms
INSERT INTO "posts" ("body","title","inserted_at","updated_at") VALUES ($1,$2,$3,$4) RETURNING "id" ["✌('ω'✌ )三✌('ω')✌三( ✌'ω')✌", "はじめてのとうこう!", {{2016, 11, 1}, {8, 34, 8, 0}}, {{2016, 11, 1}, {8, 34, 8, 0}}]
[info] Sent 302 in 35ms
[info] GET /posts
[debug] Processing by HellowPhoenix.PostController.index/2
  Parameters: %{}
  Pipelines: [:browser]
[debug] QUERY OK source="posts" db=1.8ms decode=3.0ms
SELECT p0."id", p0."title", p0."body", p0."inserted_at", p0."updated_at" FROM "posts" AS p0 []
[info] Sent 200 in 10ms
[info] GET /posts/1
[debug] Processing by HellowPhoenix.PostController.show/2
  Parameters: %{"id" => "1"}
  Pipelines: [:browser]
[debug] QUERY OK source="posts" db=1.5ms
SELECT p0."id", p0."title", p0."body", p0."inserted_at", p0."updated_at" FROM "posts" AS p0 WHERE (p0."id" = $1) [1]
[info] Sent 200 in 9ms
[info] GET /posts/1/edit
[debug] Processing by HellowPhoenix.PostController.edit/2
  Parameters: %{"id" => "1"}
  Pipelines: [:browser]
[debug] QUERY OK source="posts" db=1.8ms queue=0.1ms
SELECT p0."id", p0."title", p0."body", p0."inserted_at", p0."updated_at" FROM "posts" AS p0 WHERE (p0."id" = $1) [1]
[info] Sent 200 in 2ms
[info] POST /posts/1
[debug] Processing by HellowPhoenix.PostController.delete/2
  Parameters: %{"_csrf_token" => "RHE6I1gfEAwzfx4lXyk0Kk13JwwBEAAApGRrkKrNXI+vgbCKfGiJpA==", "_method" => "delete", "id" => "1"}
  Pipelines: [:browser]
[debug] QUERY OK source="posts" db=1.8ms queue=0.1ms
SELECT p0."id", p0."title", p0."body", p0."inserted_at", p0."updated_at" FROM "posts" AS p0 WHERE (p0."id" = $1) [1]
[debug] QUERY OK db=4.3ms queue=0.1ms
DELETE FROM "posts" WHERE "id" = $1 [1]
[info] Sent 302 in 7ms
[info] GET /posts
[debug] Processing by HellowPhoenix.PostController.index/2
  Parameters: %{}
  Pipelines: [:browser]
[debug] QUERY OK source="posts" db=1.3ms
SELECT p0."id", p0."title", p0."body", p0."inserted_at", p0."updated_at" FROM "posts" AS p0 []
[info] Sent 200 in 2ms
[info] GET /posts/new
[debug] Processing by HellowPhoenix.PostController.new/2
  Parameters: %{}
  Pipelines: [:browser]
[info] Sent 200 in 563µs
[info] POST /posts
[debug] Processing by HellowPhoenix.PostController.create/2
  Parameters: %{"_csrf_token" => "XFE6PnoCBgxeYVcfQT8VMFxnFCALEAAAhgRoIVdN5WbLytbQwWZfzA==", "_utf8" => "✓", "post" => %{"body" => "(∩´∀`)∩ワーイ", "title" => " にかいめのとうこう!"}}
  Pipelines: [:browser]
[debug] QUERY OK db=4.7ms
INSERT INTO "posts" ("body","title","inserted_at","updated_at") VALUES ($1,$2,$3,$4) RETURNING "id" ["(∩´∀`)∩ワーイ", "にかいめのとうこう!", {{2016, 11, 1}, {8, 34, 39, 0}}, {{2016, 11, 1}, {8, 34, 39, 0}}]
[info] Sent 302 in 38ms
[info] GET /posts
[debug] Processing by HellowPhoenix.PostController.index/2
  Parameters: %{}
  Pipelines: [:browser]
[debug] QUERY OK source="posts" db=1.4ms
SELECT p0."id", p0."title", p0."body", p0."inserted_at", p0."updated_at" FROM "posts" AS p0 []
[info] Sent 200 in 2ms
[info] GET /posts/new
[debug] Processing by HellowPhoenix.PostController.new/2
  Parameters: %{}
  Pipelines: [:browser]
[info] Sent 200 in 679µs
[info] POST /posts
[debug] Processing by HellowPhoenix.PostController.create/2
  Parameters: %{"_csrf_token" => "eHQyJWIiEikbTGAcSjktFH93Py0dNgAALBZtQvpkpzUOrrZuTGqklg==", "_utf8" => "✓", "post" => %{"body" => "(((((((((((っ・ω・)っ ブーン", "title" => "さんかいめのとうこう!"}}
  Pipelines: [:browser]
[debug] QUERY OK db=4.5ms
INSERT INTO "posts" ("body","title","inserted_at","updated_at") VALUES ($1,$2,$3,$4) RETURNING "id" ["(((((((((((っ・ω・)っ ブーン", "さんかいめのとうこう!", {{2016, 11, 1}, {8, 34, 50, 0}}, {{2016, 11, 1}, {8, 34, 50, 0}}]
[info] Sent 302 in 5ms
[info] GET /posts
[debug] Processing by HellowPhoenix.PostController.index/2
  Parameters: %{}
  Pipelines: [:browser]
[debug] QUERY OK source="posts" db=1.0ms queue=0.1ms
SELECT p0."id", p0."title", p0."body", p0."inserted_at", p0."updated_at" FROM "posts" AS p0 []
[info] Sent 200 in 2ms
[info] GET /posts/3/edit
[debug] Processing by HellowPhoenix.PostController.edit/2
  Parameters: %{"id" => "3"}
  Pipelines: [:browser]
[debug] QUERY OK source="posts" db=1.2ms queue=0.1ms
SELECT p0."id", p0."title", p0."body", p0."inserted_at", p0."updated_at" FROM "posts" AS p0 WHERE (p0."id" = $1) [3]
[info] Sent 200 in 2ms
[info] POST /posts/3
[debug] Processing by HellowPhoenix.PostController.update/2
  Parameters: %{"_csrf_token" => "An8mNgUNCQwGAHRrVWQyCl9TO3YSAAAA6INg6YkNm6A8m/Ektcu0cQ==", "_method" => "put", "_utf8" => "✓", "id" => "3", "post" => %{"body" => "(((((((((((っ・ω・)っ ブーン +編集", "title" => "さんかいめのとうこう!"}}
  Pipelines: [:browser]
[debug] QUERY OK source="posts" db=0.6ms queue=0.2ms
SELECT p0."id", p0."title", p0."body", p0."inserted_at", p0."updated_at" FROM "posts" AS p0 WHERE (p0."id" = $1) [3]
[debug] QUERY OK db=4.2ms queue=0.1ms
UPDATE "posts" SET "body" = $1, "updated_at" = $2 WHERE "id" = $3 ["(((((((((((っ・ω・)っ ブーン +編集", {{2016, 11, 1}, {8, 35, 5, 0}}, 3]
[info] Sent 302 in 36ms
[info] GET /posts/3
[debug] Processing by HellowPhoenix.PostController.show/2
  Parameters: %{"id" => "3"}
  Pipelines: [:browser]
[debug] QUERY OK source="posts" db=0.6ms queue=0.2ms
SELECT p0."id", p0."title", p0."body", p0."inserted_at", p0."updated_at" FROM "posts" AS p0 WHERE (p0."id" = $1) [3]
[info] Sent 200 in 1ms
[info] GET /posts
[debug] Processing by HellowPhoenix.PostController.index/2
  Parameters: %{}
  Pipelines: [:browser]
[debug] QUERY OK source="posts" db=0.9ms queue=0.1ms
SELECT p0."id", p0."title", p0."body", p0."inserted_at", p0."updated_at" FROM "posts" AS p0 []
[info] Sent 200 in 1ms
[info] GET /posts/new
[debug] Processing by HellowPhoenix.PostController.new/2
  Parameters: %{}
  Pipelines: [:browser]
[info] Sent 200 in 653µs
[info] GET /posts
[debug] Processing by HellowPhoenix.PostController.index/2
  Parameters: %{}
  Pipelines: [:browser]
[debug] QUERY OK source="posts" db=0.5ms decode=0.1ms queue=0.2ms
SELECT p0."id", p0."title", p0."body", p0."inserted_at", p0."updated_at" FROM "posts" AS p0 []
[info] Sent 200 in 1ms
[info] GET /posts/new
[debug] Processing by HellowPhoenix.PostController.new/2
  Parameters: %{}
  Pipelines: [:browser]
[info] Sent 200 in 596µs
[info] POST /posts
[debug] Processing by HellowPhoenix.PostController.create/2
  Parameters: %{"_csrf_token" => "bExQAwMBKXEhAV05DScUTkVZOwkZEAAAXz8R0UK3J7hj5lc/niuOhA==", "_utf8" => "✓", "post" => %{"body" => "", "title" => ""}}
  Pipelines: [:browser]
[info] Sent 200 in 785µs
[info] GET /posts
[debug] Processing by HellowPhoenix.PostController.index/2
  Parameters: %{}
  Pipelines: [:browser]
[debug] QUERY OK source="posts" db=1.1ms queue=0.1ms
SELECT p0."id", p0."title", p0."body", p0."inserted_at", p0."updated_at" FROM "posts" AS p0 []
[info] Sent 200 in 2ms