Upgrade to Ruby 3.3.5, and improve the mechanisms for it a bit
I move `ruby_version` into an Ansible variable, to make it easier to update in the future!
This commit is contained in:
parent
5bf2ef42a0
commit
9ebc498888
5 changed files with 23 additions and 20 deletions
|
@ -1 +1 @@
|
|||
3.3.4
|
||||
3.3.5
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -1,5 +1,5 @@
|
|||
source 'https://rubygems.org'
|
||||
ruby '3.3.4'
|
||||
ruby '3.3.5'
|
||||
|
||||
gem 'rails', '~> 7.1', '>= 7.1.3.4'
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
vars:
|
||||
local_app_root: "{{ playbook_dir }}/.."
|
||||
remote_project_root: "/srv/impress"
|
||||
ruby_version: "3.3.5"
|
||||
|
||||
# deploy:setup should have added us to the "impress-deployers" group, so we
|
||||
# should be able to become the "impress" user without a password.
|
||||
ansible_become_password: ""
|
||||
|
@ -60,7 +62,7 @@
|
|||
- name: Configure Bundler to run in deployment mode
|
||||
command:
|
||||
chdir: "{{ remote_app_root }}"
|
||||
cmd: /opt/ruby-3.3.4/bin/bundle config set --local deployment true
|
||||
cmd: /opt/ruby-{{ ruby_version }}/bin/bundle config set --local deployment true
|
||||
|
||||
# This ensures that, while attempting our current deploy, we don't
|
||||
# accidentally delete gems out from under the currently-running version.
|
||||
|
@ -70,7 +72,7 @@
|
|||
- name: Configure Bundler to *not* clean up old gems when installing
|
||||
command:
|
||||
chdir: "{{ remote_app_root }}"
|
||||
cmd: /opt/ruby-3.3.4/bin/bundle config set --local clean false
|
||||
cmd: /opt/ruby-{{ ruby_version }}/bin/bundle config set --local clean false
|
||||
|
||||
# NOTE: Bundler recommends this, and they're pretty smart about it: if the
|
||||
# Gemfile changes, this shouldn't disrupt the currently-running version,
|
||||
|
@ -79,7 +81,7 @@
|
|||
- name: Configure Bundler to use the bundle folder shared by all app versions
|
||||
command:
|
||||
chdir: "{{ remote_app_root }}"
|
||||
cmd: "/opt/ruby-3.3.4/bin/bundle config set --local path {{ remote_project_root}}/shared/bundle"
|
||||
cmd: "/opt/ruby-{{ ruby_version }}/bin/bundle config set --local path {{ remote_project_root}}/shared/bundle"
|
||||
|
||||
- name: Run `bundle install` to install dependencies in remote folder
|
||||
command:
|
||||
|
@ -87,7 +89,7 @@
|
|||
# The `--local` flag instructs Bundler to use the cached dependencies
|
||||
# in `vendor/cache`, instead of reading from the web, which is much
|
||||
# faster and more reliable!
|
||||
cmd: /opt/ruby-3.3.4/bin/bundle install --local
|
||||
cmd: /opt/ruby-{{ ruby_version }}/bin/bundle install --local
|
||||
|
||||
- name: Update the `current` folder to point to the new version
|
||||
file:
|
||||
|
@ -111,7 +113,7 @@
|
|||
- name: Clean up gems no longer used in the current app version
|
||||
command:
|
||||
chdir: "{{ remote_app_root }}"
|
||||
cmd: /opt/ruby-3.3.4/bin/bundle clean
|
||||
cmd: /opt/ruby-{{ ruby_version }}/bin/bundle clean
|
||||
when: not skip_set_as_current
|
||||
|
||||
- name: Find older app versions to clean up
|
||||
|
|
|
@ -5,7 +5,7 @@ Description=Dress to Impress webapp
|
|||
User=impress
|
||||
Restart=always
|
||||
WorkingDirectory=/srv/impress/current
|
||||
ExecStart=/opt/ruby-3.3.4/bin/bundle exec falcon host
|
||||
ExecStart=/opt/ruby-{{ ruby_version }}/bin/bundle exec falcon host
|
||||
Environment="RAILS_ENV=production"
|
||||
; Set EXECJS_RUNTIME to save us from needing to install Node
|
||||
Environment="EXECJS_RUNTIME=Disabled"
|
||||
|
@ -35,4 +35,4 @@ NoNewPrivileges=true
|
|||
CapabilityBoundingSet=~CAP_SYS_ADMIN
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=multi-user.target
|
|
@ -6,6 +6,7 @@
|
|||
vars:
|
||||
email_address: "emi@matchu.dev" # TODO: Extract this to personal config?
|
||||
impress_hostname: impress.openneo.net
|
||||
ruby_version: "3.3.5"
|
||||
vars_files:
|
||||
# mysql_root_password, mysql_user_password, mysql_user_password_2020,
|
||||
# dev_ips
|
||||
|
@ -170,21 +171,21 @@
|
|||
git:
|
||||
repo: https://github.com/rbenv/ruby-build.git
|
||||
dest: /opt/ruby-build
|
||||
version: d22fa95a6e4c77945304c16ebe0d9513fec98cfb
|
||||
version: v20240917
|
||||
|
||||
- name: Check if Ruby 3.3.4 is already installed
|
||||
- name: Check if Ruby {{ ruby_version }} is already installed
|
||||
stat:
|
||||
path: /opt/ruby-3.3.4
|
||||
path: /opt/ruby-{{ ruby_version }}
|
||||
register: ruby_dir
|
||||
|
||||
- name: Install Ruby 3.3.4
|
||||
command: "/opt/ruby-build/bin/ruby-build 3.3.4 /opt/ruby-3.3.4"
|
||||
- name: Install Ruby {{ ruby_version }}
|
||||
command: "/opt/ruby-build/bin/ruby-build {{ ruby_version }} /opt/ruby-{{ ruby_version }}"
|
||||
when: not ruby_dir.stat.exists
|
||||
|
||||
- name: Add Ruby 3.3.4 to the global PATH, for developer convenience
|
||||
- name: Add Ruby {{ ruby_version }} to the global PATH, for developer convenience
|
||||
copy:
|
||||
dest: /etc/profile.d/ruby_path.sh
|
||||
content: PATH="/opt/ruby-3.3.4/bin:$PATH"
|
||||
content: PATH="/opt/ruby-{{ ruby_version }}/bin:$PATH"
|
||||
|
||||
- name: Install system dependencies for impress's Ruby gems
|
||||
apt:
|
||||
|
@ -248,14 +249,14 @@
|
|||
become_user: impress
|
||||
command:
|
||||
chdir: /srv/impress/versions/initial-placeholder
|
||||
cmd: /opt/ruby-3.3.4/bin/bundle config set --local deployment true
|
||||
cmd: /opt/ruby-{{ ruby_version }}/bin/bundle config set --local deployment true
|
||||
when: not current_app_version.stat.exists
|
||||
|
||||
- name: Install the placeholder app's dependencies
|
||||
become_user: impress
|
||||
command:
|
||||
chdir: /srv/impress/versions/initial-placeholder
|
||||
cmd: /opt/ruby-3.3.4/bin/bundle install
|
||||
cmd: /opt/ruby-{{ ruby_version }}/bin/bundle install
|
||||
when: not current_app_version.stat.exists
|
||||
|
||||
- name: Set the placeholder app as the current version
|
||||
|
@ -287,8 +288,8 @@
|
|||
state: directory
|
||||
|
||||
- name: Create service file for impress
|
||||
copy:
|
||||
src: files/impress.service
|
||||
template:
|
||||
src: files/impress.service.j2
|
||||
dest: /etc/systemd/system/impress.service
|
||||
notify:
|
||||
- Reload systemctl
|
||||
|
|
Loading…
Reference in a new issue