Skip to content

Commit db5440e

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

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

.github/workflows/benchmark.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ jobs:
2727
steps:
2828
- uses: actions/checkout@v2
2929
- run: echo 'Run benchmark for ISHOCON2'
30+
- run: touch /tmp/ishocon-app
3031
- run: |
3132
sed -i 's/python/'"$ISHOCON_APP_LANG"'/g' ./docker-compose.yml
3233
cat ./docker-compose.yml
3334
make build
3435
env:
3536
ISHOCON_APP_LANG: ${{ matrix.language }}
36-
- run: make up && sleep 30
37+
- run: make up
3738
- run: make bench
3839
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: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,47 @@ fi
1010

1111
echo "app_lang: $app_lang"
1212

13+
function make_tmp_file() {
14+
if [ ! -e /tmp/ishocon-app ]; then
15+
touch /tmp/ishocon-app
16+
fi
17+
}
18+
1319
function run_ruby() {
1420
cd "/home/ishocon/webapp/$app_lang"
1521
bundle install
22+
make_tmp_file
1623
unicorn -c unicorn_config.rb
17-
echo $check_message
1824
}
1925

2026
function run_python() {
2127
cd "/home/ishocon/webapp/$app_lang"
28+
make_tmp_file
2229
/home/ishocon/.pyenv/shims/uwsgi --ini app.ini
2330
}
2431

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-
3132
function run_go() {
3233
cd "/home/ishocon/webapp/$app_lang"
3334
go get -t -d -v ./...
3435
go build -o webapp *.go
36+
make_tmp_file
3537
./webapp
3638
}
3739

3840
function run_php() {
3941
cd "/home/ishocon/webapp/$app_lang"
4042
sudo mv -f /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig
4143
sudo cp webapp/php/php-nginx.conf /etc/nginx/nginx.conf
44+
make_tmp_file
4245
sudo service nginx reload
4346
}
4447

4548
function run_crystal() {
4649
cd "/home/ishocon/webapp/$app_lang"
4750
shards install
51+
make_tmp_file
4852
crystal app.cr
4953
}
5054

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

0 commit comments

Comments
 (0)