Glitch #
glitch.json #
Javascriptでないプロジェクトの実行の設定ができる。
glitch.jsonに
- “install”
- “start”
- “watch” の設定をする。
例:
{
"start": "go/main /app/go/db.sqlite"
}
{
"install": "sh ./install.sh",
"start": "racket/bin/racket rantstack.scm",
"watch": {
"install": {
"include": [
"^glitch\\.json$",
"^install\\.sh$",
"^\\.env$"
]
},
"restart": {
"exclude": [
"^racket/"
],
"include": [
"\\.rkt$",
"\\.scm$"
]
},
"throttle": 1000
}
}
GoやRust,Swiftをstaticバイナリにビルドすれば動作させられる。
Python, Rubyなどのランタイムもコンテナイメージに入ってはいるがバージョンがちょっと古い。(Go 1.11.2, Rust 1.74.1, Python 3.7.10, Ruby 2.5.8, Swift 5.1, Java 1.8.0, Lua 5.2, OCaml 4.02.3, GCC 5.4)
ポート番号 #
PORT環境変数に入っている値をポート番号に使う。
通常は3000になっている。
git pushによるデプロイ #
Glitchのプロジェクトはgitになっているので git pushでデプロイすることができる。 ただしnon-bareレポジトリなので、下のコマンドを ターミナルで一度実行しておく。
git config receive.denyCurrentBranch updateInstead
git pushで再始動させるにはgitのpos-updateフックにrefreshコマンドを入れておく
echo 'refresh' > ./.git/hooks/post-update
chmod +x ./.git/hooks/post-update