Skip to content

Commit

Permalink
[CHORE] Update Kamal, fix deployment, update some gems and minor things
Browse files Browse the repository at this point in the history
  • Loading branch information
trinitytakei committed Nov 11, 2024
1 parent 1b044da commit 186e9ae
Show file tree
Hide file tree
Showing 11 changed files with 161 additions and 150 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ node_modules
llm

/config/credentials/test.key
.kamal/secrets
9 changes: 9 additions & 0 deletions .kamal/hooks/post-deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

echo "$KAMAL_PERFORMER deployed $KAMAL_VERSION to $KAMAL_DESTINATION in $KAMAL_RUNTIME seconds"

echo "Running migrations"

kamal bundle exec rails db:migrate
kamal bundle exec rails db:migrate:queue
kamal bundle exec rails db:migrate:cache
17 changes: 7 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ WORKDIR /rails
# Install base packages
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 \
build-essential libssl-dev git pkg-config python-is-python3 libgmp-dev ca-certificates gnupg xz-utils && \
build-essential libssl-dev git pkg-config python-is-python3 libgmp-dev ca-certificates gnupg xz-utils \
libffi-dev libyaml-dev libreadline-dev zlib1g-dev libncurses5-dev libgdbm-dev \
libc6-dev && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Set production environment
Expand Down Expand Up @@ -40,7 +42,8 @@ FROM base AS build
# Install application gems
COPY Gemfile Gemfile.lock ./
RUN bundle config set --local build.nokogiri --use-system-libraries && \
bundle install --jobs 4 --retry 3 && \
bundle config build.msgpack --with-cflags="-O2" && \
bundle install --jobs 4 --retry 5 && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Install node modules
Expand All @@ -56,8 +59,6 @@ RUN bundle exec bootsnap precompile app/ lib/
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN RAILS_ENV=production SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile

# RUN yarn vite build

# Final stage for app image
FROM base

Expand All @@ -78,9 +79,5 @@ USER rails
# Entrypoint prepares the database.
ENTRYPOINT ["/rails/bin/docker-entrypoint"]

ENV HTTP_PORT="3000" \
TARGET_PORT="3001"

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["bundle", "exec", "thrust", "./bin/rails", "server"]
EXPOSE 80
CMD ["./bin/thrust", "./bin/rails", "server"]
20 changes: 10 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
source "https://rubygems.org"

gem "rails", "8.0.0.beta1"
gem "rails", "8.0.0.rc2"

gem "bootsnap", require: false
gem "friendly_id", "~> 5.5.1"
gem "kamal", "~> 1.8.3", require: false
gem "mission_control-jobs", "~> 0.3.3"
gem "litestream", "~> 0.11.2"
gem "kamal", "~> 2.3.0", require: false
gem "thruster", "~> 0.1.8", require: false
gem "mission_control-jobs", "~> 0.4.0"
gem "litestream", "~> 0.12.0"
gem "propshaft", "~> 1.1.0"
gem "solid_cache", "~> 1.0.6"
gem "solid_queue", "~> 1.0.0"
gem "sqlite3", "~> 2.1.0"
gem "solid_queue", "~> 1.0.1"
gem "sqlite3", "~> 2.2.0"
gem "stimulus-rails"
gem "turbo-rails", "~> 2.0.11"
gem "puma", ">= 6.4.3"
gem "phlex-rails", "~> 1.2.1"
gem "thruster", "~> 0.1.8"
gem "vite_rails", "~> 3.0.17"
gem "vite_rails", "~> 3.0.19"

group :development do
gem "annotaterb"
Expand All @@ -28,8 +28,8 @@ end

group :test do
gem "capybara"
gem "selenium-webdriver", "~> 4.25.0"
gem "mocha", "~> 2.4.5"
gem "selenium-webdriver", "~> 4.26.0"
gem "mocha", "~> 2.5.0"
gem "simplecov", require: false
gem "simplecov-tailwindcss", require: false
end
Expand Down
Loading

0 comments on commit 186e9ae

Please sign in to comment.