Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure dev, Render, and Fly to all stop using redis #327

Merged
merged 3 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,12 @@ FROM ruby:${RUBY_VERSION}-alpine AS render-production

RUN apk add --no-cache git build-base postgresql-dev curl-dev gcompat tzdata vips-dev imagemagick

ENV BUNDLE_CACHE=/tmp/bundle \
BUNDLE_JOBS=2 \
PORT=3000

WORKDIR /rails
COPY Gemfile Gemfile.lock .ruby-version ./

RUN --mount=type=cache,id=gems,target=/tmp/bundle \
bundle install

ENV BUNDLE_DEPLOYMENT=1 \
ENV BUNDLE_CACHE=/tmp/bundle \
BUNDLE_JOBS=2 \
BUNDLE_DEPLOYMENT=1 \
BUNDLE_WITHOUT=development \
RAILS_ENV=production \
PORT=8080
Expand Down
7 changes: 0 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ group :development do
gem "rubocop-rails"
gem "rubocop-capybara"
gem "rubocop-minitest"

gem "pgreset"
gem "htmlbeautifier"

# https://github.com/kirillplatonov/hotwire-livereload
gem "hotwire-livereload", "~> 1.3"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

random cleanup unrelated to this PR

gem "dockerfile-rails", ">= 1.6"
end

Expand Down
15 changes: 0 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,6 @@ GEM
ffi (1.16.3)
globalid (1.2.1)
activesupport (>= 6.1)
hotwire-livereload (1.3.2)
actioncable (>= 6.0.0)
listen (>= 3.0.0)
railties (>= 6.0.0)
htmlbeautifier (1.4.2)
i18n (1.14.4)
concurrent-ruby (~> 1.0)
image_processing (1.12.2)
Expand All @@ -146,9 +141,6 @@ GEM
json (2.7.1)
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand Down Expand Up @@ -190,7 +182,6 @@ GEM
ast (~> 2.4.1)
racc
pg (1.5.6)
pgreset (0.4)
prism (0.19.0)
pry (0.14.2)
coderay (~> 1.1)
Expand Down Expand Up @@ -245,9 +236,6 @@ GEM
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.1.0)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rdoc (6.6.2)
psych (>= 4.0.0)
redcarpet (3.6.0)
Expand Down Expand Up @@ -376,14 +364,11 @@ DEPENDENCIES
capybara
debug
dockerfile-rails (>= 1.6)
hotwire-livereload (~> 1.3)
htmlbeautifier
image_processing (~> 1.2)
importmap-rails
minitest-stub_any_instance
name_of_person
pg (~> 1.1)
pgreset
pry-rails
puma (>= 5.0)
rails (~> 7.1.3)
Expand Down
1 change: 0 additions & 1 deletion app/views/application/_head.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@
<%= render 'application/head/favicons' %>
<%= render 'application/head/meta_tags' %>
<%= content_for :head %>
<%= hotwire_livereload_tags if Rails.env.development? %> <!-- Hotwire LiveReload -->
</head>
1 change: 0 additions & 1 deletion config/dockerfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ options:
fly_launch_runtime: rails
postgresql: true
prepare: false
redis: true
yjit: true
4 changes: 2 additions & 2 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
# Raise error when a before_action's only/except options reference missing actions
config.action_controller.raise_on_missing_callback_actions = true

config.hotwire_livereload.reload_method = :turbo_stream
config.web_console.permissions = "192.168.0.0/16"

config.hosts << ENV['DEV_HOST']
config.hosts << ENV['DEV_HOST'] if ENV['DEV_HOST'].present?
end
11 changes: 2 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
version: '3.1'

services:
redis:
image: redis
healthcheck:
test: ["CMD", "redis-cli","ping"]

postgres:
image: postgres:16
restart: always
Expand All @@ -21,20 +16,18 @@ services:
retries: 5

base: &base
depends_on: ["redis", "postgres"]
depends_on: ["postgres"]
restart: on-failure:3
tty: true
build:
context: .
target: development
environment:
- REDIS_URL=redis://redis/0
- DATABASE_URL=postgres://app:secret@postgres/app_development
- DEV_HOST=${DEV_HOST}
- DEV_HOST=${DEV_HOST:-localhost} # Set if you want to use a different hostname
ports: ["3000:3000"]
volumes:
- .:/rails
- /rails/tmp

worker:
<<: *base
Expand Down
4 changes: 3 additions & 1 deletion fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ console_command = '/rails/bin/rails console'

[processes]
app = './bin/rails server'
worker = 'bundle exec rake solid_queue:start'

[env]
RUN_SOLID_QUEUE_IN_PUMA = 'true'

[http_service]
internal_port = 3000
Expand Down
9 changes: 0 additions & 9 deletions render.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,8 @@ services:
fromDatabase:
name: hostedgpt-postgres
property: connectionString
- key: REDIS_URL
fromService:
type: redis
name: hostedgpt-redis
property: connectionString
- fromGroup: hostedgpt-secrets
- key: RUN_SOLID_QUEUE_IN_PUMA
value: true
- key: WEB_CONCURRENCY
value: 2 # sensible default
- type: redis
plan: free
name: hostedgpt-redis
ipAllowList: [] # no external connections
Loading