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?

【無料】laravelで作成したアプリをrailwayでデプロイする

Posted at

デプロイ手順

  1. github Repo から対象のリポジトリ選択
  2. Database > Add MySQL でデータベース選択
  3. 追加したリポジトリのアプリケーションにて以下の設定
    1. Root Directory:backendのコードが存在するrootディレクトリ
    2. Public Networking を ONにする
    3. Custom Build Command
      composer install && php artisan config:clear
      
    4. Custom Start Command
      php artisan serve --host=0.0.0.0 --port=$PORT
      
    5. Valiablesから環境変数を設定
      APP_URL="Public Networking のurl"
      APP_ENV="production"
      LOG_CHANNEL="stderr"
      APP_KEY="ローカルのkeyと同様(base64:××××××××××××××××××××××××)"
      DB_CONNECTION="mysql"
      DB_HOST="MySQLのMYSQL_PUBLIC_URLの@から:の間のホスト名"
      DB_PORT="MySQLのMYSQL_PUBLIC_URL の net:の後に記載のポート番号"
      DB_DATABASE="MySQLのMYSQL_DATABASE同様"
      DB_USERNAME="root"
      DB_PASSWORD="MySQLのMYSQLPASSWORD"
      
    6. config/logging.phpのchannels に stderr追記
      'channels' => [
          'stack' => [
              'driver' => 'stack',
              'channels' => ['single', 'stderr'],
      
  4. 暗号化キーの生成を行なっていなければ生成してAPP_KEYに設定
  5. マイグレーション
    railway run bash -c "cd backend && php artisan migrate"
    
  6. Public Networking の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?