diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 8b883e56..a6942510 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -33,6 +33,6 @@ jobs: make build env: ISHOCON_APP_LANG: ${{ matrix.language }} - - run: make up && sleep 30 + - run: make up - run: make bench timeout-minutes: 5 diff --git a/docker-compose.yml b/docker-compose.yml index 63abc4d3..04b6599a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,12 @@ services: dockerfile: ./docker/app/python/Dockerfile environment: ISHOCON_APP_LANG: "${ISHOCON_APP_LANG-python}" + healthcheck: + test: ["CMD", "test", "-f", "/tmp/ishocon-app"] + interval: 30s + timeout: 1s + retries: 3 + start_period: 10s command: [/home/ishocon/run.sh] tty: true volumes: @@ -23,6 +29,9 @@ services: - app environment: - TARGET=app + depends_on: + app: + condition: service_healthy volumes: storage_bench: diff --git a/run.sh b/run.sh index c133615f..6dcce323 100755 --- a/run.sh +++ b/run.sh @@ -10,20 +10,28 @@ fi echo "app_lang: $app_lang" +function make_tmp_file() { + if [ ! -e /tmp/ishocon-app ]; then + touch /tmp/ishocon-app + fi +} + function run_ruby() { cd "/home/ishocon/webapp/$app_lang" bundle install + make_tmp_file unicorn -c unicorn_config.rb - echo $check_message } function run_python() { cd "/home/ishocon/webapp/$app_lang" + make_tmp_file /home/ishocon/.pyenv/shims/uwsgi --ini app.ini } function run_python_sanic() { cd "/home/ishocon/webapp/${app_lang}_sanic" + make_tmp_file /home/ishocon/.pyenv/shims/uwsgi --ini "app.ini" } @@ -32,6 +40,7 @@ function run_go() { cd "/home/ishocon/webapp/$app_lang" go get -t -d -v ./... go build -o webapp *.go + make_tmp_file ./webapp } @@ -39,16 +48,16 @@ function run_php() { cd "/home/ishocon/webapp/$app_lang" sudo mv -f /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig sudo cp webapp/php/php-nginx.conf /etc/nginx/nginx.conf + make_tmp_file sudo service nginx reload } function run_crystal() { cd "/home/ishocon/webapp/$app_lang" shards install + make_tmp_file crystal app.cr } -echo "start running $app_lang app..." +echo "starting running $app_lang app..." "run_${app_lang}" -echo "completed to start running $app_lang app..." -