diff --git a/.gitignore b/.gitignore index 346948da..714d3f6f 100644 --- a/.gitignore +++ b/.gitignore @@ -28,10 +28,7 @@ coverage !/.config/docker_ci.env !/.config/helm_values_example.yml !/.config/LICENSE -docker-compose.yml - -# docker dev config -/dev/docker-compose.yml +/docker-compose.yml # ESLint .eslintcache diff --git a/dev/Makefile b/dev/Makefile new file mode 100644 index 00000000..58bea4e9 --- /dev/null +++ b/dev/Makefile @@ -0,0 +1,16 @@ +.PHONY: recreate +recreate: down up + + +.PHONY: down +down: + podman-compose down + + +.PHONY: up +up: + podman-compose up --detach + podman-compose exec db psql \ + --user=firefish \ + --dbname=firefish_db \ + --command='CREATE EXTENSION pgroonga;' diff --git a/dev/docker-compose.yml b/dev/docker-compose.yml new file mode 100644 index 00000000..8059ab14 --- /dev/null +++ b/dev/docker-compose.yml @@ -0,0 +1,16 @@ +version: "3" + +services: + redis: + image: docker.io/redis:7-alpine + ports: + - "6379:6379" + + db: + image: docker.io/groonga/pgroonga:latest-alpine-16 + environment: + - "POSTGRES_PASSWORD=password" + - "POSTGRES_USER=firefish" + - "POSTGRES_DB=firefish_db" + ports: + - "5432:5432" diff --git a/docs/contributing.md b/docs/contributing.md index 1201324c..67d50f42 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -18,36 +18,14 @@ - shellcheck - sea-orm-cli -2. 以下の内容の `dev/docker-compose.yml` を作成する - - ```yaml - version: "3" - - services: - redis: - image: docker.io/redis:7-alpine - ports: - - "6379:6379" - - db: - image: docker.io/groonga/pgroonga:latest-alpine-16 - environment: - - "POSTGRES_PASSWORD=password" - - "POSTGRES_USER=firefish" - - "POSTGRES_DB=firefish_db" - ports: - - "5432:5432" - ``` - -3. コンテナを起動し、PGroonga を有効化する +2. コンテナを起動し、PGroonga を有効化する ```bash cd dev - podman-compose up --detach - podman-compose exec db --user=firefish --dbname=firefish_db --command='CREATE EXTENSION pgroonga;' + make up ``` -4. 以下の内容の `.config/default.yml` を作成する +3. 以下の内容の `.config/default.yml` を作成する ```yaml url: http://localhost:3000 @@ -67,9 +45,7 @@ ```bash cd dev -podman-compose down --volumes -podman-compose up --detach -podman-compose exec db --user=firefish --dbname=firefish_db --command='CREATE EXTENSION pgroonga;' +make ``` 参考にした記事: [Firefish 開発環境の準備(バックエンド向け)](https://hackmd.io/@nmkj-io/HJHNbM_8a)