File tree Expand file tree Collapse file tree 14 files changed +133
-7
lines changed Expand file tree Collapse file tree 14 files changed +133
-7
lines changed Original file line number Diff line number Diff line change
1
+ name : Benchmark
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ push :
6
+
7
+ concurrency :
8
+ group : ${{ github.workflow }}-${{ github.sha }}
9
+ cancel-in-progress : true
10
+
11
+ jobs :
12
+ benchmark :
13
+ name : Run benchmark
14
+ runs-on : ubuntu-22.04
15
+ timeout-minutes : 60
16
+ strategy :
17
+ fail-fast : false
18
+ matrix :
19
+ language :
20
+ - " crystal"
21
+ - " go"
22
+ - " nodejs"
23
+ - " php"
24
+ - " python"
25
+ - " python_sanic"
26
+ - " ruby"
27
+ steps :
28
+ - uses : actions/checkout@v2
29
+ - run : echo 'Run benchmark for ISHOCON2'
30
+ - run : |
31
+ sed -i 's/python/'"$ISHOCON_APP_LANG"'/g' ./docker-compose.yml
32
+ cat ./docker-compose.yml
33
+ make build
34
+ env:
35
+ ISHOCON_APP_LANG: ${{ matrix.language }}
36
+ - run : make up && sleep 30
37
+ - run : make bench
38
+ timeout-minutes : 5
Original file line number Diff line number Diff line change
1
+ common :
2
+ docker build -f docker/app/base/Dockerfile -t showwin/ishocon2_app_base:latest .
3
+
4
+ build : common
5
+ docker compose build
6
+
7
+ up : build
8
+ docker compose up -d
9
+
10
+ down :
11
+ docker compose down
12
+
13
+ bench :
14
+ docker exec -i ishocon2-bench-1 sh -c " ./benchmark --ip app:443"
Original file line number Diff line number Diff line change @@ -43,6 +43,6 @@ $ docker exec -it ishocon2_app_1 /bin/bash
43
43
## ベンチマーカー
44
44
45
45
```
46
- $ docker exec -it ishocon2_bench_1 /bin/bash
46
+ $ docker exec -it ishocon2-bench-1 /bin/bash
47
47
$ ./benchmark --ip app:443 # docker-compose.yml で link しているので app で到達できます
48
48
```
Original file line number Diff line number Diff line change @@ -4,7 +4,10 @@ services:
4
4
build :
5
5
context : .
6
6
dockerfile : ./docker/app/python/Dockerfile
7
- command : tail -f /dev/null
7
+ environment :
8
+ ISHOCON_APP_LANG : " ${ISHOCON_APP_LANG-python}"
9
+ command : [/home/ishocon/run.sh]
10
+ tty : true
8
11
volumes :
9
12
- storage_app:/var/lib/mysql
10
13
- ./webapp:/home/ishocon/webapp
Original file line number Diff line number Diff line change @@ -2,10 +2,10 @@ FROM showwin/ishocon2_app_base:latest
2
2
ENV APP_LANG 'Crystal'
3
3
4
4
# Crystal のインストール
5
+ RUN sudo apt-get update
5
6
RUN sudo apt-get install -y gnupg2
6
7
RUN curl -sL "https://keybase.io/crystal/pgp_keys.asc" | sudo apt-key add -
7
8
RUN echo "deb https://dist.crystal-lang.org/apt crystal main" | sudo tee /etc/apt/sources.list.d/crystal.list
8
- RUN sudo apt-get update
9
9
RUN sudo apt install -y libssl1.0-dev crystal
10
10
11
11
# アプリケーション
@@ -17,6 +17,8 @@ COPY admin/config/bashrc /home/ishocon/.bashrc
17
17
WORKDIR /home/ishocon
18
18
EXPOSE 443
19
19
20
+ COPY run.sh /home/ishocon/run.sh
21
+
20
22
COPY docker/app/entrypoint.sh /home/ishocon/docker/app/entrypoint.sh
21
23
ENTRYPOINT ["/home/ishocon/docker/app/entrypoint.sh" ]
22
24
Original file line number Diff line number Diff line change 1
- #! /bin/bash
1
+ #! /bin/bash -eux
2
+
2
3
sudo service nginx start
3
4
sudo service mysql start
4
5
sudo chown -R mysql:mysql /var/lib/mysql /var/run/mysqld
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ COPY admin/config/bashrc /home/ishocon/.bashrc
19
19
WORKDIR /home/ishocon
20
20
EXPOSE 443
21
21
22
+ COPY run.sh /home/ishocon/run.sh
23
+
22
24
COPY docker/app/entrypoint.sh /home/ishocon/docker/app/entrypoint.sh
23
25
ENTRYPOINT ["/home/ishocon/docker/app/entrypoint.sh" ]
24
26
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ RUN cd /home/ishocon/webapp/nodejs && \
18
18
WORKDIR /home/ishocon
19
19
EXPOSE 443
20
20
21
+ COPY run.sh /home/ishocon/run.sh
22
+
21
23
COPY docker/app/entrypoint.sh /home/ishocon/docker/app/entrypoint.sh
22
24
ENTRYPOINT ["/home/ishocon/docker/app/entrypoint.sh" ]
23
25
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ RUN cd /home/ishocon/webapp/php && \
21
21
WORKDIR /home/ishocon
22
22
EXPOSE 443
23
23
24
+ COPY run.sh /home/ishocon/run.sh
25
+
24
26
COPY docker/app/entrypoint.sh /home/ishocon/docker/app/entrypoint.sh
25
27
ENTRYPOINT ["/home/ishocon/docker/app/entrypoint.sh" ]
26
28
Original file line number Diff line number Diff line change @@ -2,12 +2,13 @@ FROM showwin/ishocon2_app_base:latest
2
2
ENV APP_LANG 'Python'
3
3
4
4
# Python のインストール
5
+ RUN sudo apt-get update
5
6
RUN sudo apt-get install -y zlib1g-dev
6
7
RUN git clone https://github.com/pyenv/pyenv.git ~/.pyenv && \
7
8
PYENV_ROOT="$HOME/.pyenv" && PATH="$PYENV_ROOT/bin:$PATH" && \
8
9
eval "$(pyenv init -)" && \
9
10
pyenv install 3.6.5 && pyenv global 3.6.5 && \
10
- cd && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python get-pip.py && rm get-pip.py
11
+ cd && curl https://bootstrap.pypa.io/pip/3.6/ get-pip.py -o get-pip.py && python get-pip.py && rm get-pip.py
11
12
12
13
# アプリケーション
13
14
RUN mkdir /home/ishocon/data /home/ishocon/webapp
@@ -23,6 +24,8 @@ RUN LC_ALL=C.UTF-8 && LANG=C.UTF-8 && cd /home/ishocon/webapp/python && \
23
24
WORKDIR /home/ishocon
24
25
EXPOSE 443
25
26
27
+ COPY run.sh /home/ishocon/run.sh
28
+
26
29
COPY docker/app/entrypoint.sh /home/ishocon/docker/app/entrypoint.sh
27
30
ENTRYPOINT ["/home/ishocon/docker/app/entrypoint.sh" ]
28
31
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ FROM showwin/ishocon2_app_base:latest
2
2
ENV APP_LANG 'Ruby'
3
3
4
4
# Ruby のインストール
5
+ RUN sudo apt-get update
5
6
RUN sudo apt-get install -y ruby-dev libmysqlclient-dev && \
6
7
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
7
8
RUN PATH="$HOME/.rbenv/bin:$PATH" && \
@@ -21,6 +22,8 @@ RUN cd /home/ishocon/webapp/ruby && sudo gem install bundler -v "1.16.1" && bund
21
22
WORKDIR /home/ishocon
22
23
EXPOSE 443
23
24
25
+ COPY run.sh /home/ishocon/run.sh
26
+
24
27
COPY docker/app/entrypoint.sh /home/ishocon/docker/app/entrypoint.sh
25
28
ENTRYPOINT ["/home/ishocon/docker/app/entrypoint.sh" ]
26
29
Original file line number Diff line number Diff line change 1
1
FROM ubuntu:18.04
2
2
3
- RUN apt-get update
3
+ RUN sudo apt-get update
4
4
RUN apt-get install -y wget
5
5
6
6
# Go のインストール
Original file line number Diff line number Diff line change 1
- #! /bin/bash
1
+ #! /bin/bash -ux
2
+
2
3
service mysql start # なぜか失敗する(調査中)
3
4
chown -R mysql:mysql /var/lib/mysql /var/run/mysqld
4
5
service mysql start # 正しく起動
Original file line number Diff line number Diff line change
1
+ #! /bin/bash -eux
2
+
3
+ app_lang=" ${ISHOCON_APP_LANG} "
4
+
5
+ if [ -z " $app_lang " ]
6
+ then
7
+ echo " ISHOCON_APP_LANG is not set"
8
+ exit 1
9
+ fi
10
+
11
+ check_message=" start application w/ ${app_lang} ..."
12
+
13
+ echo " app_lang: $app_lang "
14
+
15
+ function run_ruby() {
16
+ bundle install
17
+ unicorn -c unicorn_config.rb
18
+ echo " $check_message "
19
+ }
20
+
21
+ function run_python() {
22
+ /home/ishocon/.pyenv/shims/uwsgi --ini app.ini
23
+ echo " $check_message "
24
+ }
25
+
26
+ function run_python_sanic() {
27
+ /home/ishocon/.pyenv/shims/uwsgi --ini app.ini
28
+ echo " $check_message "
29
+ }
30
+
31
+
32
+ function run_go() {
33
+ go get -t -d -v ./...
34
+ go build -o webapp * .go
35
+ ./webapp
36
+ echo " $check_message "
37
+ }
38
+
39
+ function run_php() {
40
+ sudo mv -f /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig
41
+ sudo cp webapp/php/php-nginx.conf /etc/nginx/nginx.conf
42
+ sudo service nginx reload
43
+ echo " $check_message "
44
+ }
45
+
46
+ function run_crystal() {
47
+ shards install
48
+ crystal app.cr
49
+ echo " $check_message "
50
+ }
51
+
52
+ echo " run $app_lang app..."
53
+ cd " /home/ishocon/webapp/$app_lang "
54
+
55
+ " run_$app_lang "
You can’t perform that action at this time.
0 commit comments