From 91df76928b6d1459a9cf3f8739d655e67f07e77e Mon Sep 17 00:00:00 2001 From: Kevin McConnell Date: Wed, 16 Apr 2025 16:51:29 +0100 Subject: [PATCH 1/2] Add fizzy-app-102 as a replica The setup here is a bit rough while we settle some of the details, but the gist of it is: - Define accessories to run the primary/replica processes - Add a web-replica role, which is similar to web but has the replication-side accessory - Load the beamer extension on the app's primary tenanted database Note that we aren't sending any traffic into the replica yet, but it would be functional to do so. This stage is mainly about testing the database replication. --- Dockerfile | 5 +++++ config/database.yml | 2 ++ config/deploy.production.yml | 3 +++ config/deploy.yml | 36 +++++++++++++++++++++++++++++++++--- 4 files changed, 43 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 63e46037c..e0712a39a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,6 +38,10 @@ RUN bundle exec bootsnap precompile app/ lib/ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile +# Fetch beamer library +FROM basecamp/beamer:latest AS beamer + + # Final stage for app image FROM base @@ -49,6 +53,7 @@ RUN apt-get update -qq && \ # Copy built artifacts: gems, application COPY --from=build /usr/local/bundle /usr/local/bundle COPY --from=build /rails /rails +COPY --from=beamer /home/beamer/bin/beamer.so /rails/bin/lib/beamer.so # Run and own only the runtime files as a non-root user for security RUN useradd rails --create-home --shell /bin/bash && \ diff --git a/config/database.yml b/config/database.yml index 17e777cd0..82c7475e1 100644 --- a/config/database.yml +++ b/config/database.yml @@ -45,6 +45,8 @@ production: <<: *default database: storage/tenants/<%= Rails.env %>/%{tenant}/db/main.sqlite3 tenanted: true + extensions: + - ./bin/lib/beamer.so primary_original: <<: *default database: storage/production.sqlite3 diff --git a/config/deploy.production.yml b/config/deploy.production.yml index 38cc04500..00a4b176e 100644 --- a/config/deploy.production.yml +++ b/config/deploy.production.yml @@ -5,6 +5,9 @@ servers: jobs: hosts: - fizzy-app-101 + web-replica: + hosts: + - fizzy-app-102 proxy: hosts: diff --git a/config/deploy.yml b/config/deploy.yml index 9617a8b87..29eb15ba4 100644 --- a/config/deploy.yml +++ b/config/deploy.yml @@ -1,10 +1,42 @@ service: fizzy image: basecamp/fizzy + +x-basecamp-registry: &basecamp-registry + username: bcbot + password: + - BASECAMP_REGISTRY_PASSWORD + +x-beamer-accessory: &beamer-accessory + image: basecamp/beamer + registry: + <<: *basecamp-registry + options: + user: 1000 # Match the UID of the Rails app, for volume permissions + volumes: + - fizzy:/storage + + servers: jobs: cmd: bin/jobs +accessories: + beamer-primary: + <<: *beamer-accessory + service: beamer-primary + cmd: beamer primary --debug --remove-after=1h --dir=/storage + port: 5000:80 + roles: + - web + + beamer-replica: + <<: *beamer-accessory + service: beamer-replica + cmd: beamer replica --debug --primary=http://fizzy-app-101:5000/ --dir=/storage + roles: + - web-replica + volumes: - fizzy:/rails/storage @@ -12,9 +44,7 @@ proxy: ssl: true registry: - username: bcbot - password: - - BASECAMP_REGISTRY_PASSWORD + <<: *basecamp-registry builder: arch: amd64 From 94ccbdb6013ebed36bbc3962fd48e760e5544024 Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Wed, 16 Apr 2025 19:06:18 -0500 Subject: [PATCH 2/2] Fix close card notch state --- app/views/cards/_closure_toggle.html.erb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/views/cards/_closure_toggle.html.erb b/app/views/cards/_closure_toggle.html.erb index 7958b0887..661b8edea 100644 --- a/app/views/cards/_closure_toggle.html.erb +++ b/app/views/cards/_closure_toggle.html.erb @@ -1,9 +1,11 @@ -
"> +
<% if card.closed? %> - Completed by <%= card.closed_by.name %> on <%= local_datetime_tag(card.closed_at, style: :shortdate) %>. - <%= button_to card_closure_path(card), method: :delete, class: "btn btn--plain borderless fill-transparent" do %> - Un-do - <% end %> +
+ Completed by <%= card.closed_by.name %> on <%= local_datetime_tag(card.closed_at, style: :shortdate) %>. + <%= button_to card_closure_path(card), method: :delete, class: "btn btn--plain borderless fill-transparent" do %> + Un-do + <% end %> +
<% else %>