Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add make init #432

Merged
merged 1 commit into from
Feb 4, 2024
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
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.PHONY: init
init: webapp/sql/dump.sql
$(MAKE) setup-bench-image

webapp/sql/dump.sql:
cd webapp/sql && \
curl -L -O https://github.com/catatsuy/private-isu/releases/download/img/dump.sql.bz2 && \
bunzip2 dump.sql.bz2

.PHONY: setup-bench-image
setup-bench-image:
cd benchmarker/userdata && \
curl -L -O https://github.com/catatsuy/private-isu/releases/download/img/img.zip && \
unzip img.zip
29 changes: 11 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ __いずれの手順もディスク容量が十分にあるマシン上で行う
* ベンチマーカーはGoの開発環境とuserdataがあれば動く
* Dockerとvagrantはメモリが潤沢なマシンで実行すること

#### 初期データを用意する

必要になるので、以下の手順を行う前に必ず実行すること。

```sh
make init
```

#### MacやLinux上で適当に動かす

MySQLとmemcachedを起動した上で以下の手順を実行。
Expand All @@ -110,19 +118,13 @@ MySQLとmemcachedを起動した上で以下の手順を実行。
* MySQLのrootユーザーのパスワードが設定されていない前提になっているので、設定されている場合は適宜読み替えること

```sh
curl -L -O https://github.com/catatsuy/private-isu/releases/download/img/dump.sql.bz2
bzcat dump.sql.bz2 | mysql -uroot
cat webapp/sql/dump.sql | mysql -uroot

cd webapp/ruby
bundle install --path=vendor/bundle
bundle exec foreman start
cd ../..

cd benchmarker/userdata
curl -L -O https://github.com/catatsuy/private-isu/releases/download/img/img.zip
unzip img.zip
cd ../..

cd benchmarker
make
./bin/benchmarker -t "http://localhost:8080" -u ./userdata
Expand All @@ -137,11 +139,7 @@ make
アプリケーションは以下の手順で実行できる。dump.sqlを配置しないとMySQLに初期データがimportされないので注意。

```sh
cd webapp/sql
curl -L -O https://github.com/catatsuy/private-isu/releases/download/img/dump.sql.bz2
bunzip2 dump.sql.bz2

cd ..
cd webapp
docker compose up
```

Expand All @@ -158,12 +156,7 @@ mv nginx/conf.d/php.conf.org nginx/conf.d/php.conf
ベンチマーカーは以下の手順で実行できる。

```sh
cd benchmarker/userdata
curl -L -O https://github.com/catatsuy/private-isu/releases/download/img/img.zip
unzip img.zip
rm img.zip
cd ..

cd benchmarker
docker build -t private-isu-benchmarker .
docker run --network host -i private-isu-benchmarker /opt/go/bin/benchmarker -t http://host.docker.internal -u /opt/go/userdata
# Linuxの場合
Expand Down