0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

RailwayでWebアプリのデプロイ

0
Posted at

RailwayでWebアプリのデプロイ

注意

個人情報のため、画像に写っている固有名詞はgeminiで編集した。

概要

Railwayでフロント+バック+DBという構成のWebアプリをデプロイしたので、それの手順のメモ。

アカウント作成

githubアカウントで認証した。

project作成

Configure Github Appを押すとページが表示されるので、そこでリポジトリへのアクセスを許可する。

image.png

deployするもの(リポジトリ)を選択

Github Repogitoryでデプロイするリポジトリを選ぶ。

image.png

すると、production環境にサービスが作成された。

image.png

project => environment => serviceという階層構造になっていて、この画像では、xxx projectproduction environmentweb serviceが作成されている。

webサービスの設定

build設定

build command: pnpm build

を設定したが、Railpackでやってくれていそうなので意味はないかも。

image.png

deploy設定

start command: pnpm db:push && pnpm start

こちらは必須。

image.png

DB追加

次にDBを追加する。右上のAddボタンを押して追加できる

image.png

DB接続

webサービスの方にDATABASE_URLという環境変数があるので、それに適切な値を設定する。

探す

MYSQL_URLを使うのでコピーする。

webサービスの方のSetting => Variablesから、DATABASE_URLを設定。

image.png

確認

Settings => Networkingでドメインを設定する。
Generate Domainを押すとurlが生成されるので、確認できる。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?