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?

Docker環境でのRailsプロジェクト再立ち上げが分からなすぎた話

Posted at

はじめに

自分はプロジェクトにフロントエンドエンジニアとして入ることが多いが、バックエンドでの変更やデータベースでの変更がブランチに取り込まれた際に、500サーバーエラーなどアプリケーションのフロント自体が見れなくなるタイミングが開発していると頻繁に立ち会うことがあると思う。

そんな時よくDocker環境でのRailsプロジェクトの再立ち上げをするが、あんまり手順として残ってない気がしたので、残してみることにした。

具体的手順

バックエンドがRailsのDocker環境下に限られるが、そんな技術スタックのプロジェクトも多いと思うので下記に手順を書く。

手順1

docker compose down

ローカル環境を一旦ダウンさせる

手順2

docker compose down -v

ローカル環境のクリア
DB設定を変更した際に実行する

手順3

docker compose up

ローカル環境を立ち上げる

手順4

docker exec -it プロジェクト名 /bin/bash

shellに入る

手順5

bundle install

Gemのインストール

手順6

DATABASE_USER=root bundle exec rails db:migrate:reset
DATABASE_USER=root bundle exec rails db:migrate

マイグレーションを実行する

手順7

DATABASE_USER=root bundle exec rails db:migrate:reset;
bundle exec rails db:seed

seedデータを投入する

さいごに

どのプロジェクトもRailsとDockerは大体上記の手順で立ち上げ直したら変更が反映されていたので、備忘録。

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?