Skip to content

Commit

Permalink
Spin Redis to a separate instance
Browse files Browse the repository at this point in the history
  • Loading branch information
miharekar committed Nov 11, 2023
1 parent fde1f32 commit ccc5224
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
21 changes: 0 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ RUN bundle install && rm -rf vendor/bundle/ruby/*/cache

FROM base

# install redis 7
RUN curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg && \
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(. /etc/os-release && echo $VERSION_CODENAME) main" > /etc/apt/sources.list.d/redis.list && \
apt-get update -qq && \
apt-get install --no-install-recommends -y redis-server

ARG DEPLOY_PACKAGES="postgresql-client libvips42 file vim curl gzip libsqlite3-0 ruby-foreman"
ENV DEPLOY_PACKAGES=${DEPLOY_PACKAGES}

Expand All @@ -90,21 +84,6 @@ RUN --mount=type=cache,id=prod-apt-cache,sharing=locked,target=/var/cache/apt \
${DEPLOY_PACKAGES} \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives

# configure redis
RUN sed -i 's/^daemonize yes/daemonize no/' /etc/redis/redis.conf &&\
sed -i 's/^bind/# bind/' /etc/redis/redis.conf &&\
sed -i 's/^protected-mode yes/protected-mode no/' /etc/redis/redis.conf &&\
sed -i 's/^dir \/var\/lib\/redis/dir \/redis\/main/' /etc/redis/redis.conf &&\
sed -i 's/^logfile/# logfile/' /etc/redis/redis.conf

# set up cache redis
RUN cp /etc/redis/redis.conf /etc/redis/redis_cache.conf &&\
sed -i 's/^port 6379/port 6380/' /etc/redis/redis_cache.conf &&\
sed -i 's/^# maxmemory <bytes>/maxmemory 100mb/' /etc/redis/redis_cache.conf &&\
sed -i 's/^# maxmemory-policy noeviction/maxmemory-policy allkeys-lru/' /etc/redis/redis_cache.conf &&\
sed -i 's/^pidfile \/run\/redis\/redis-server.pid/pidfile \/run\/redis\/redis-cache.pid/' /etc/redis/redis_cache.conf &&\
sed -i 's/^dir \/redis\/main/dir \/redis\/cache/' /etc/redis/redis_cache.conf

# copy installed gems
COPY --from=gems /app /app
COPY --from=gems /usr/lib/fullstaq-ruby/versions /usr/lib/fullstaq-ruby/versions
Expand Down
2 changes: 0 additions & 2 deletions Procfile.fly
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
web: bin/rails server -p 8080
redis: redis-server /etc/redis/redis.conf
cache-redis: redis-server /etc/redis/redis_cache.conf
sidekiq: bundle exec sidekiq -C config/sidekiq.yml

0 comments on commit ccc5224

Please sign in to comment.