Skip to content

Commit

Permalink
docker: start bench after app started
Browse files Browse the repository at this point in the history
  • Loading branch information
mickamy committed Jan 1, 2024
1 parent eefceaf commit 5a51054
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -23,6 +29,9 @@ services:
- app
environment:
- TARGET=app
depends_on:
app:
condition: service_healthy

volumes:
storage_bench:
Expand Down
17 changes: 13 additions & 4 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand All @@ -32,23 +40,24 @@ function run_go() {
cd "/home/ishocon/webapp/$app_lang"
go get -t -d -v ./...
go build -o webapp *.go
make_tmp_file
./webapp
}

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..."

0 comments on commit 5a51054

Please sign in to comment.