Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .devcontainer/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ SELENIUM_PORT_1=4444
SELENIUM_PORT_2=5900
MAILCATCHER_PORT=1080
RAILS_DB_ADAPTER=postgresql
POSTGRES_PORT=5433
MYSQL_PORT=3307
17 changes: 14 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"kaiwood.endwise",
"mtxr.sqltools",
"mtxr.sqltools-driver-pg",
"mtxr.sqltools-driver-mysql",
"ms-vsliveshare.vsliveshare"
],
"settings": {
Expand All @@ -30,9 +31,19 @@
"driver": "PostgreSQL",
"name": "app_development",
"database": "app_development",
"username": "db_user",
"password": "password"
}
"username": "postgres",
"password": "postgres"
},
{
"previewLimit": 50,
"server": "mysqldb",
"port": 3306,
"driver": "MySQL",
"name": "app_development",
"database": "app_development",
"username": "root",
"password": "password"
},
]
}
}
Expand Down
16 changes: 14 additions & 2 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- $POSTGRES_PORT:5432

# MySQL
# mysqldb:
# image: mysql:5
# platform: linux/amd64
# restart: on-failure:5
# environment:
# MYSQL_ROOT_PASSWORD: password
# MYSQL_PASSWORD: password
# MYSQL_USER: db_user
# ports:
# - $MYSQL_PORT:3306

app:
build:
Expand All @@ -33,13 +36,22 @@ services:
# Optional Node.js version to install
NODE_VERSION: "14"
environment:
# PostgreSQL
RAILS_DB_ADAPTER: postgresql
RAILS_DB_HOST: postgresdb
RAILS_DB: app
RAILS_DB_USERNAME: postgres
RAILS_DB_PASSWORD: postgres
RAILS_DB_ENCODING: utf8
RAILS_ENV: development
# # MySQL
# RAILS_DB_ADAPTER: mysql2
# RAILS_DB_HOST: mysqldb
# RAILS_DB: app
# RAILS_DB_USERNAME: root
# RAILS_DB_PASSWORD: password
# RAILS_DB_ENCODING: utf8mb4
# RAILS_ENV: development
env_file: .env
tty: true
ports:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ SELENIUM_PORT_2=5900
MAILCATCHER_PORT=1080
# mysqlやsqlite3に変えても良い。mysqlの場合、.devcontainer/docker-compose.ymlのMySQL関連のコメントアウトを外す
RAILS_DB_ADAPTER=postgresql
# postgres、mysqlのホスト側への公開ポート。ホスト側で既に使っている場合は変える
POSTGRES_PORT=5433
MYSQL_PORT=3307
```

* VScodeに拡張機能[Remote-Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)をインストール
Expand Down