Skip to content

Commit 508e11a

Browse files
committed
docker: start bench after app started
1 parent eefceaf commit 508e11a

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

.github/workflows/benchmark.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ jobs:
2222
- "nodejs"
2323
- "php"
2424
- "python"
25-
- "python_sanic"
2625
- "ruby"
2726
steps:
2827
- uses: actions/checkout@v2
2928
- run: echo 'Run benchmark for ISHOCON2'
29+
- run: touch /tmp/ishocon-app
3030
- run: |
3131
sed -i 's/python/'"$ISHOCON_APP_LANG"'/g' ./docker-compose.yml
3232
cat ./docker-compose.yml
3333
make build
3434
env:
3535
ISHOCON_APP_LANG: ${{ matrix.language }}
36-
- run: make up && sleep 30
36+
- run: make up
3737
- run: make bench
3838
timeout-minutes: 5

docker-compose.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ services:
66
dockerfile: ./docker/app/python/Dockerfile
77
environment:
88
ISHOCON_APP_LANG: "${ISHOCON_APP_LANG-python}"
9+
healthcheck:
10+
test: ["CMD", "test", "-f", "/tmp/ishocon-app"]
11+
interval: 30s
12+
timeout: 3s
13+
retries: 5
14+
start_period: 10s
915
command: [/home/ishocon/run.sh]
1016
tty: true
1117
volumes:
@@ -23,6 +29,9 @@ services:
2329
- app
2430
environment:
2531
- TARGET=app
32+
depends_on:
33+
app:
34+
condition: service_healthy
2635

2736
volumes:
2837
storage_bench:

run.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,45 @@ fi
1010

1111
echo "app_lang: $app_lang"
1212

13+
function make_tmp_file() {
14+
touch /tmp/ishocon-app
15+
}
16+
1317
function run_ruby() {
1418
cd "/home/ishocon/webapp/$app_lang"
1519
bundle install
20+
make_tmp_file
1621
unicorn -c unicorn_config.rb
17-
echo $check_message
1822
}
1923

2024
function run_python() {
2125
cd "/home/ishocon/webapp/$app_lang"
26+
make_tmp_file
2227
/home/ishocon/.pyenv/shims/uwsgi --ini app.ini
2328
}
2429

25-
function run_python_sanic() {
26-
cd "/home/ishocon/webapp/${app_lang}_sanic"
27-
/home/ishocon/.pyenv/shims/uwsgi --ini "app.ini"
28-
}
29-
30-
3130
function run_go() {
3231
cd "/home/ishocon/webapp/$app_lang"
3332
go get -t -d -v ./...
3433
go build -o webapp *.go
34+
make_tmp_file
3535
./webapp
3636
}
3737

3838
function run_php() {
3939
cd "/home/ishocon/webapp/$app_lang"
4040
sudo mv -f /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig
4141
sudo cp webapp/php/php-nginx.conf /etc/nginx/nginx.conf
42+
make_tmp_file
4243
sudo service nginx reload
4344
}
4445

4546
function run_crystal() {
4647
cd "/home/ishocon/webapp/$app_lang"
4748
shards install
49+
make_tmp_file
4850
crystal app.cr
4951
}
5052

51-
echo "start running $app_lang app..."
53+
echo "starting running $app_lang app..."
5254
"run_${app_lang}"
53-
echo "completed to start running $app_lang app..."
54-

0 commit comments

Comments
 (0)