Skip to content

Commit

Permalink
Ruby 3 にアップデート
Browse files Browse the repository at this point in the history
  • Loading branch information
showwin committed Oct 20, 2024
1 parent 1ab2605 commit 1f5fa7e
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 26 deletions.
2 changes: 1 addition & 1 deletion admin/ami/scripts/base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sudo debconf-set-selections <<< 'mysql-service mysql-server/mysql-apt-config str
sudo apt-get install -y mysql-server

# Install Ruby
export RUBY_VERSION=2.7.1
export RUBY_VERSION=3.3.5
sudo apt-get install -y ruby-dev libmysqlclient-dev libffi-dev libyaml-dev bzip2
sudo apt-get clean
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
Expand Down
2 changes: 1 addition & 1 deletion admin/ami/scripts/webapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ chown -R ishocon:ishocon /home/ishocon/webapp

# # Install Ruby libraries
cd /home/ishocon/webapp/ruby
gem install bundler -v "1.16.1"
gem install bundler -v "2.5.22"
bundle install

# # Install Python libraries
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ services:
app:
build:
context: .
dockerfile: ./docker/app/go/Dockerfile
dockerfile: ./docker/app/ruby/Dockerfile
args:
BASE_IMAGE: ishocon1-app-base:latest
# ローカルで base image をビルドしない場合は以下を利用すること
# BASE_IMAGE: showwin/ishocon1_app_base:latest
image: ishocon1-app-go:latest
image: ishocon1-app-ruby:latest
environment:
ISHOCON_APP_LANG: "${ISHOCON_APP_LANG-go}"
ISHOCON_APP_LANG: "${ISHOCON_APP_LANG-ruby}"
healthcheck:
test: ["CMD", "test", "-f", "/tmp/ishocon-app"]
interval: 10s
Expand Down
4 changes: 2 additions & 2 deletions docker/app/ruby/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG BASE_IMAGE=ishocon2-app-base:latest
FROM ${BASE_IMAGE}

ENV RUBY_VERSION=2.7.1
ENV RUBY_VERSION=3.3.5

# Ruby のインストール
RUN sudo apt-get update && \
Expand All @@ -18,7 +18,7 @@ COPY --chown=ishocon:ishocon webapp/ /home/ishocon/webapp

WORKDIR /home/ishocon

RUN sudo gem install bundler -v "1.16.1" && \
RUN sudo gem install bundler -v "2.5.22" && \
cd webapp/ruby && \
. /home/ishocon/.bashrc && \
bundle install
Expand Down
2 changes: 1 addition & 1 deletion webapp/ruby/Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'

gem 'sinatra'
gem 'mysql2', '0.5.3'
gem 'mysql2', '0.5.6'
gem 'mysql2-cs-bind'
gem 'erubis'
gem 'unicorn'
Expand Down
39 changes: 22 additions & 17 deletions webapp/ruby/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
GEM
remote: https://rubygems.org/
specs:
base64 (0.2.0)
erubis (2.7.0)
foreman (0.87.2)
kgio (2.11.3)
mustermann (1.1.1)
foreman (0.88.1)
kgio (2.11.4)
mustermann (3.0.3)
ruby2_keywords (~> 0.0.1)
mysql2 (0.5.3)
mysql2-cs-bind (0.0.7)
mysql2 (0.5.6)
mysql2-cs-bind (0.1.1)
mysql2
rack (2.2.3)
rack-protection (2.0.8.1)
rack
raindrops (0.19.1)
ruby2_keywords (0.0.2)
sinatra (2.0.8.1)
mustermann (~> 1.0)
rack (~> 2.0)
rack-protection (= 2.0.8.1)
rack (3.1.8)
rack-protection (4.0.0)
base64 (>= 0.1.0)
rack (>= 3.0.0, < 4)
rack-session (2.0.0)
rack (>= 3.0.0)
raindrops (0.20.1)
ruby2_keywords (0.0.5)
sinatra (4.0.0)
mustermann (~> 3.0)
rack (>= 3.0.0, < 4)
rack-protection (= 4.0.0)
rack-session (>= 2.0.0, < 3)
tilt (~> 2.0)
tilt (2.0.10)
unicorn (5.6.0)
tilt (2.4.0)
unicorn (6.1.0)
kgio (~> 2.6)
raindrops (~> 0.7)

Expand All @@ -30,7 +35,7 @@ PLATFORMS
DEPENDENCIES
erubis
foreman
mysql2 (= 0.5.3)
mysql2 (= 0.5.6)
mysql2-cs-bind
sinatra
unicorn
Expand Down
2 changes: 1 addition & 1 deletion webapp/ruby/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class PermissionDenied < StandardError; end
end

class Ishocon1::WebApp < Sinatra::Base
session_secret = ENV['ISHOCON1_SESSION_SECRET'] || 'showwin_happy'
session_secret = ENV['ISHOCON1_SESSION_SECRET'] || 'showwin_happy' * 10
use Rack::Session::Cookie, key: 'rack.session', secret: session_secret
set :erb, escape_html: true
set :public_folder, File.expand_path('../public', __FILE__)
Expand Down

0 comments on commit 1f5fa7e

Please sign in to comment.