Skip to content

Commit

Permalink
静的ファイルが nginx で返せていないようなので revisit(なんだかローカルが遅い) 22143
Browse files Browse the repository at this point in the history
  • Loading branch information
mickamy committed Jan 2, 2024
1 parent 9732ad2 commit 1ac1fce
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 3 deletions.
4 changes: 3 additions & 1 deletion admin/config/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ http {
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;

rewrite ^/(.*)/$ /$1 permanent;

location /css/ {
add_header Cache-Control "s-maxage=86400";
alias /home/ishocon/webapp/ruby/public/css/;
alias /home/ishocon/public/css/;
}

location / {
Expand Down
6 changes: 6 additions & 0 deletions docker/app/ruby/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ COPY admin/ishocon2.dump.tar.bz2 /home/ishocon/data/ishocon2.dump.tar.bz2
COPY webapp/ /home/ishocon/webapp
COPY admin/config/bashrc /home/ishocon/.bashrc

# 静的ファイルの配置(nginx が読めるように)
COPY --chown=www-data:www-data public /home/ishocon/public

# base をビルドし直しても変更されなかったのでここでも改めてコピーする
COPY admin/config/nginx.conf /etc/nginx/nginx.conf

# ライブラリのインストール
RUN cd /home/ishocon/webapp/ruby && \
. /home/ishocon/.bashrc && \
Expand Down
15 changes: 15 additions & 0 deletions note.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,18 @@ docker exec -i ishocon2-bench-1 sh -c "./benchmark --ip app:443 --workload 6"
2024/01/02 05:09:35 投票者の感心がなくなりました
2024/01/02 05:09:35 {"score": 19963, "success": 16931, "failure": 0}
```

- 静的ファイルが nginx で返せていないようなので revisit(なんだかローカルが遅い) 22143

```
❯ make bench
docker exec -i ishocon2-bench-1 sh -c "./benchmark --ip app:443 --workload 6"
2024/01/02 05:41:38 Start GET /initialize
2024/01/02 05:41:38 期日前投票を開始します
2024/01/02 05:41:40 期日前投票が終了しました
2024/01/02 05:41:40 投票を開始します Workload: 6
2024/01/02 05:42:26 投票が終了しました
2024/01/02 05:42:26 投票者が結果を確認しています
2024/01/02 05:42:41 投票者の感心がなくなりました
2024/01/02 05:42:41 {"score": 22143, "success": 18471, "failure": 0}
```
File renamed without changes.
1 change: 0 additions & 1 deletion webapp/ruby/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class Ishocon2::WebApp < Sinatra::Base
session_secret = ENV['ISHOCON2_SESSION_SECRET'] || 'showwin_happy'
use Rack::Session::Cookie, key: 'rack.session', secret: session_secret
set :erb, escape_html: true
set :public_folder, File.expand_path('../public', __FILE__)
set :protection, true

helpers do
Expand Down
1 change: 0 additions & 1 deletion webapp/ruby/set_up_ruby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
cd /home/ishocon/webapp/ruby
gem install bundler -v "2.5.3"
bundle install
rbenv rehash

0 comments on commit 1ac1fce

Please sign in to comment.