Skip to content

Commit

Permalink
Merge branch 'master' into feat/add-puma-metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
danimo authored Mar 1, 2024
2 parents 38790ad + d0ee817 commit 5979cd1
Show file tree
Hide file tree
Showing 9 changed files with 144 additions and 106 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ RUN apk update \

FROM base as prod

RUN addgroup -S -g 1000 greenlight && adduser -S -G greenlight -u 999 greenlight

ARG PACKAGES='libpq-dev tzdata imagemagick yarn bash'
COPY --from=build $RAILS_ROOT/vendor/bundle ./vendor/bundle
COPY package.json yarn.lock ./
Expand All @@ -42,5 +44,8 @@ RUN apk update \
&& apk upgrade \
&& update-ca-certificates

RUN chown -R greenlight /usr/src/app/tmp

USER 999
EXPOSE ${PORT}
ENTRYPOINT [ "./bin/start" ]
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ gem 'omniauth-rails_csrf_protection', '~> 1.0.1'
gem 'pagy', '~> 6.0', '>= 6.0.0'
gem 'pg'
gem 'puma', '~> 5.6'
gem 'rails', '~> 7.1.1'
gem 'rails', '~> 7.1.3'
gem 'redis', '~> 4.0'
gem 'sprockets-rails'
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
Expand Down
139 changes: 70 additions & 69 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,50 +1,51 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (7.1.1)
actionpack (= 7.1.1)
activesupport (= 7.1.1)
actioncable (7.1.3.1)
actionpack (= 7.1.3.1)
activesupport (= 7.1.3.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.1)
actionpack (= 7.1.1)
activejob (= 7.1.1)
activerecord (= 7.1.1)
activestorage (= 7.1.1)
activesupport (= 7.1.1)
actionmailbox (7.1.3.1)
actionpack (= 7.1.3.1)
activejob (= 7.1.3.1)
activerecord (= 7.1.3.1)
activestorage (= 7.1.3.1)
activesupport (= 7.1.3.1)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.1)
actionpack (= 7.1.1)
actionview (= 7.1.1)
activejob (= 7.1.1)
activesupport (= 7.1.1)
actionmailer (7.1.3.1)
actionpack (= 7.1.3.1)
actionview (= 7.1.3.1)
activejob (= 7.1.3.1)
activesupport (= 7.1.3.1)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.2)
actionpack (7.1.1)
actionview (= 7.1.1)
activesupport (= 7.1.1)
actionpack (7.1.3.1)
actionview (= 7.1.3.1)
activesupport (= 7.1.3.1)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.1)
actionpack (= 7.1.1)
activerecord (= 7.1.1)
activestorage (= 7.1.1)
activesupport (= 7.1.1)
actiontext (7.1.3.1)
actionpack (= 7.1.3.1)
activerecord (= 7.1.3.1)
activestorage (= 7.1.3.1)
activesupport (= 7.1.3.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.1)
activesupport (= 7.1.1)
actionview (7.1.3.1)
activesupport (= 7.1.3.1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
Expand All @@ -59,22 +60,22 @@ GEM
activemodel (>= 5.2.0)
activestorage (>= 5.2.0)
activesupport (>= 5.2.0)
activejob (7.1.1)
activesupport (= 7.1.1)
activejob (7.1.3.1)
activesupport (= 7.1.3.1)
globalid (>= 0.3.6)
activemodel (7.1.1)
activesupport (= 7.1.1)
activerecord (7.1.1)
activemodel (= 7.1.1)
activesupport (= 7.1.1)
activemodel (7.1.3.1)
activesupport (= 7.1.3.1)
activerecord (7.1.3.1)
activemodel (= 7.1.3.1)
activesupport (= 7.1.3.1)
timeout (>= 0.4.0)
activestorage (7.1.1)
actionpack (= 7.1.1)
activejob (= 7.1.1)
activerecord (= 7.1.1)
activesupport (= 7.1.1)
activestorage (7.1.3.1)
actionpack (= 7.1.3.1)
activejob (= 7.1.3.1)
activerecord (= 7.1.3.1)
activesupport (= 7.1.3.1)
marcel (~> 1.0)
activesupport (7.1.1)
activesupport (7.1.3.1)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
Expand Down Expand Up @@ -115,7 +116,7 @@ GEM
rack (>= 1.6.11)
rubyzip (>= 1.3.0)
xml-simple (~> 1.1)
bigdecimal (3.1.5)
bigdecimal (3.1.6)
bindata (2.4.15)
bindex (0.8.1)
bootsnap (1.16.0)
Expand All @@ -134,7 +135,7 @@ GEM
activesupport
childprocess (4.1.0)
clamby (1.6.10)
concurrent-ruby (1.2.2)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
crack (0.4.5)
rexml
Expand All @@ -144,7 +145,7 @@ GEM
data_migrate (9.2.0)
activerecord (>= 6.1)
railties (>= 6.1)
date (3.3.3)
date (3.3.4)
debug (1.7.1)
irb (>= 1.5.0)
reline (>= 0.3.1)
Expand Down Expand Up @@ -221,10 +222,10 @@ GEM
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
io-console (0.7.1)
irb (1.11.0)
io-console (0.7.2)
irb (1.11.2)
rdoc
reline (>= 0.3.8)
reline (>= 0.4.2)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
Expand Down Expand Up @@ -260,18 +261,18 @@ GEM
mini_magick (4.12.0)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.20.0)
minitest (5.22.2)
msgpack (1.6.0)
multi_json (1.15.0)
mutex_m (0.2.0)
net-imap (0.4.1)
net-imap (0.4.10)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.1)
net-protocol (0.2.2)
timeout
net-smtp (0.4.0)
net-smtp (0.4.0.1)
net-protocol
nio4r (2.7.0)
nokogiri (1.16.2)
Expand Down Expand Up @@ -319,7 +320,7 @@ GEM
prometheus-client (>= 0.10)
puma (>= 5.0)
racc (1.7.3)
rack (2.2.8)
rack (2.2.8.1)
rack-oauth2 (2.2.0)
activesupport
attr_required
Expand All @@ -337,30 +338,30 @@ GEM
rackup (1.0.0)
rack (< 3)
webrick
rails (7.1.1)
actioncable (= 7.1.1)
actionmailbox (= 7.1.1)
actionmailer (= 7.1.1)
actionpack (= 7.1.1)
actiontext (= 7.1.1)
actionview (= 7.1.1)
activejob (= 7.1.1)
activemodel (= 7.1.1)
activerecord (= 7.1.1)
activestorage (= 7.1.1)
activesupport (= 7.1.1)
rails (7.1.3.1)
actioncable (= 7.1.3.1)
actionmailbox (= 7.1.3.1)
actionmailer (= 7.1.3.1)
actionpack (= 7.1.3.1)
actiontext (= 7.1.3.1)
actionview (= 7.1.3.1)
activejob (= 7.1.3.1)
activemodel (= 7.1.3.1)
activerecord (= 7.1.3.1)
activestorage (= 7.1.3.1)
activesupport (= 7.1.3.1)
bundler (>= 1.15.0)
railties (= 7.1.1)
railties (= 7.1.3.1)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.1.1)
actionpack (= 7.1.1)
activesupport (= 7.1.1)
railties (7.1.3.1)
actionpack (= 7.1.3.1)
activesupport (= 7.1.3.1)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
Expand All @@ -372,7 +373,7 @@ GEM
psych (>= 4.0.0)
redis (4.8.0)
regexp_parser (2.8.1)
reline (0.4.2)
reline (0.4.3)
io-console (~> 0.5)
remote_syslog_logger (1.0.4)
syslog_protocol
Expand Down Expand Up @@ -458,8 +459,8 @@ GEM
faraday (~> 2.0)
faraday-follow_redirects
syslog_protocol (0.9.2)
thor (1.3.0)
timeout (0.4.0)
thor (1.3.1)
timeout (0.4.1)
trailblazer-option (0.1.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -497,7 +498,7 @@ GEM
rexml
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.12)
zeitwerk (2.6.13)

PLATFORMS
ruby
Expand Down Expand Up @@ -536,7 +537,7 @@ DEPENDENCIES
pg
puma (~> 5.6)
puma-metrics (~> 1.2.0)
rails (~> 7.1.1)
rails (~> 7.1.3)>>>>>>> master
redis (~> 4.0)
remote_syslog_logger
rspec-rails (>= 6.0.4)
Expand Down
3 changes: 2 additions & 1 deletion app/assets/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@
"maintenance": "Maintenance Banner",
"change_maintenance_text": "Change the maintenance banner text that appears in the header",
"change_url": "Change URL",
"change_text": "Change text",
"set_text": "Set Text",
"clear_banner": "Clear Banner",
"enter_link": "Enter link here"
},
"settings": {
Expand Down
11 changes: 9 additions & 2 deletions app/javascript/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ export default function App() {

// useEffect hook for running notify maintenance banner on page load
useEffect(() => {
if (maintenanceBanner.data) {
toast.info(maintenanceBanner.data, {
// set a cookie for a day after maintenance banner dismissed
const maintenanceClosedAt = localStorage.getItem('maintenanceClosedAt');
const now = new Date();
const oneDayInMilliseconds = 24 * 60 * 60 * 1000;

if (maintenanceBanner.data && (!maintenanceClosedAt || now.getTime() - new Date(maintenanceClosedAt).getTime() > oneDayInMilliseconds)) {
const toastId = toast.info(maintenanceBanner.data, {
position: 'top-center',
autoClose: false,
hideProgressBar: true,
Expand All @@ -45,7 +50,9 @@ export default function App() {
progress: undefined,
theme: 'light',
className: 'text-center',
onClose: () => localStorage.setItem('maintenanceClosedAt', new Date().toISOString()),
});
localStorage.setItem('maintenanceBannerId', toastId);
}
}, [maintenanceBanner.data]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ export default function Administration() {

return (
<>
<Row>
<h6> { t('admin.site_settings.administration.maintenance') } </h6>
<p className="text-muted"> { t('admin.site_settings.administration.change_maintenance_text') } </p>
<TextForm
id="maintenanceForm"
mutation={() => useUpdateSiteSetting('Maintenance')}
value={siteSettings?.Maintenance}
/>
</Row>
<Row>
<h6> { t('admin.site_settings.administration.terms') } </h6>
<p className="text-muted"> { t('admin.site_settings.administration.change_term_links') } </p>
Expand Down Expand Up @@ -55,15 +64,6 @@ export default function Administration() {
value={siteSettings?.HelpCenter}
/>
</Row>
<Row>
<h6> { t('admin.site_settings.administration.maintenance') } </h6>
<p className="text-muted"> { t('admin.site_settings.administration.change_maintenance_text') } </p>
<TextForm
id="maintenanceForm"
mutation={() => useUpdateSiteSetting('Maintenance')}
value={siteSettings?.Maintenance}
/>
</Row>
</>
);
}
Loading

0 comments on commit 5979cd1

Please sign in to comment.