Skip to content

Commit

Permalink
fix type streamServerClient.upsertUser lasdeloy to Vercel
Browse files Browse the repository at this point in the history
  • Loading branch information
maearon committed Jul 29, 2024
1 parent 3a01a42 commit 5a25b44
Show file tree
Hide file tree
Showing 33 changed files with 860 additions and 561 deletions.
Empty file removed ,
Empty file.
106 changes: 46 additions & 60 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,62 +1,48 @@
# syntax = docker/dockerfile:1
FROM ruby:3.3.3

# Install node & yarn
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get update && \
apt-get install -y \
libvips-dev \
nodejs \
curl && \
curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && \
apt-get install -y yarn

# Install base deps or additional (e.g. tesseract)
ARG INSTALL_DEPENDENCIES
RUN apt-get update -qq \
&& apt-get install -y --no-install-recommends ${INSTALL_DEPENDENCIES} \
build-essential libpq-dev git \
&& apt-get clean autoclean \
&& apt-get autoremove -y \
&& rm -rf \
/var/lib/apt \
/var/lib/dpkg \
/var/lib/cache \
/var/lib/log

# Install deps with bundler
RUN mkdir /app
WORKDIR /app
COPY Gemfile* /app/
ARG BUNDLE_INSTALL_ARGS
RUN gem install bundler:2.5.11
RUN bundle config set without 'development test'
RUN bundle install ${BUNDLE_INSTALL_ARGS} \
&& rm -rf /usr/local/bundle/cache/* \
&& find /usr/local/bundle/gems/ -name "*.c" -delete \
&& find /usr/local/bundle/gems/ -name "*.o" -delete
COPY . /app/

# Compile assets
ARG RAILS_ENV=development
RUN if [ "$RAILS_ENV" = "production" ]; then SECRET_KEY_BASE=$(rake secret) bundle exec rake assets:precompile; fi

VOLUME /rails/db

# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.3.2
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base

# Rails app lives here
WORKDIR /rails

# Set production environment
ENV RAILS_ENV="production" \
BUNDLE_DEPLOYMENT="1" \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development"


# Throw-away build stage to reduce size of final image
FROM base as build

# Install packages needed to build gems
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config

# Install application gems
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
bundle exec bootsnap precompile --gemfile

# Copy application code
COPY . .

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile


# Final stage for app image
FROM base

# Install packages needed for deployment
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y curl libvips postgresql-client && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Copy built artifacts: gems, application
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build /rails /rails

# Run and own only the runtime files as a non-root user for security
RUN useradd rails --create-home --shell /bin/bash && \
chown -R rails:rails db log storage tmp
USER rails:rails

# Entrypoint prepares the database.
ENTRYPOINT ["/rails/bin/docker-entrypoint"]

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["./bin/rails", "server"]
CMD ["rails", "server", "-b", "0.0.0.0"]
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ gem "bootsnap", require: false

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem 'dotenv-rails'
gem "debug", platforms: %i[ mri windows ]
end

Expand Down
106 changes: 73 additions & 33 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,25 @@ GEM
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
autoprefixer-rails (10.4.16.0)
execjs (~> 2)
aws-eventstream (1.3.0)
aws-partitions (1.944.0)
aws-sdk-core (3.197.0)
aws-partitions (1.958.0)
aws-sdk-core (3.201.3)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.84.0)
aws-sdk-core (~> 3, >= 3.197.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.152.3)
aws-sdk-core (~> 3, >= 3.197.0)
aws-sdk-kms (1.88.0)
aws-sdk-core (~> 3, >= 3.201.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.156.0)
aws-sdk-core (~> 3, >= 3.201.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.9.0)
aws-eventstream (~> 1, >= 1.0.2)
babel-source (5.8.35)
babel-transpiler (0.7.0)
Expand Down Expand Up @@ -132,29 +132,42 @@ GEM
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
dotenv (3.1.2)
dotenv-rails (3.1.2)
dotenv (= 3.1.2)
railties (>= 6.1)
drb (2.2.1)
erubi (1.13.0)
execjs (2.9.1)
faker (3.4.1)
faker (3.4.2)
i18n (>= 1.8.11, < 2)
ffi (1.17.0-aarch64-linux-gnu)
ffi (1.17.0-aarch64-linux-musl)
ffi (1.17.0-arm-linux-gnu)
ffi (1.17.0-arm-linux-musl)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86-linux-gnu)
ffi (1.17.0-x86-linux-musl)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
ffi (1.17.0-x86_64-linux-musl)
font-awesome-sass (6.5.2)
sassc (~> 2.0)
globalid (1.2.1)
activesupport (>= 6.1)
graphql (2.3.5)
graphql (2.3.10)
base64
i18n (1.14.5)
concurrent-ruby (~> 1.0)
image_processing (1.12.2)
image_processing (1.13.0)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
importmap-rails (2.0.1)
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
railties (>= 6.0.0)
io-console (0.7.2)
irb (1.13.1)
irb (1.14.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jbuilder (2.12.0)
Expand All @@ -165,7 +178,7 @@ GEM
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jwt (2.8.1)
jwt (2.8.2)
base64
kaminari (1.2.2)
activesupport (>= 4.1.0)
Expand All @@ -182,6 +195,7 @@ GEM
kaminari (>= 0.13.0)
rails
kaminari-core (1.2.2)
logger (1.6.0)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand All @@ -192,12 +206,12 @@ GEM
net-smtp
marcel (1.0.4)
matrix (0.4.2)
mini_magick (4.13.0)
mini_magick (4.13.2)
mini_mime (1.1.5)
minitest (5.23.1)
minitest (5.24.1)
msgpack (1.7.2)
mutex_m (0.2.0)
net-imap (0.4.12)
net-imap (0.4.14)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -206,16 +220,26 @@ GEM
net-smtp (0.5.0)
net-protocol
nio4r (2.7.3)
nokogiri (1.16.6-x86_64-linux)
nokogiri (1.16.7-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.7-arm-linux)
racc (~> 1.4)
nokogiri (1.16.7-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86-linux)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
pg (1.5.6)
pg (1.5.7)
psych (5.1.2)
stringio
public_suffix (5.0.5)
public_suffix (6.0.1)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.8.0)
rack (3.1.3)
rack (3.1.7)
rack-cors (2.0.2)
rack (>= 2.0.0)
rack-session (2.0.0)
Expand Down Expand Up @@ -258,7 +282,7 @@ GEM
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rake (13.2.1)
ransack (4.1.1)
ransack (4.2.0)
activerecord (>= 6.1.5)
activesupport (>= 6.1.5)
i18n
Expand All @@ -277,10 +301,11 @@ GEM
regexp_parser (2.9.2)
reline (0.5.9)
io-console (~> 0.5)
rexml (3.3.0)
rexml (3.3.2)
strscan
ruby-vips (2.2.1)
ruby-vips (2.2.2)
ffi (~> 1.12)
logger
rubyzip (2.3.2)
sassc (2.4.0)
ffi (~> 1.9)
Expand All @@ -290,7 +315,9 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
selenium-webdriver (4.10.0)
selenium-webdriver (4.23.0)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
Expand All @@ -310,21 +337,21 @@ GEM
strscan (3.1.0)
temple (0.10.3)
thor (1.3.1)
tilt (2.3.0)
tilt (2.4.0)
timeout (0.4.1)
turbo-rails (2.0.5)
turbo-rails (2.0.6)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
railties (>= 6.0.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
web-console (4.2.0)
web-console (4.2.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webrick (1.8.1)
websocket (1.2.10)
websocket (1.2.11)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
Expand All @@ -333,7 +360,19 @@ GEM
zeitwerk (2.6.16)

PLATFORMS
x86_64-linux
aarch64-linux
aarch64-linux-gnu
aarch64-linux-musl
arm-linux
arm-linux-gnu
arm-linux-musl
arm64-darwin
x86-linux
x86-linux-gnu
x86-linux-musl
x86_64-darwin
x86_64-linux-gnu
x86_64-linux-musl

DEPENDENCIES
active_storage_validations
Expand All @@ -345,6 +384,7 @@ DEPENDENCIES
capybara
cocoon
debug
dotenv-rails
faker
font-awesome-sass
graphql
Expand Down Expand Up @@ -378,4 +418,4 @@ RUBY VERSION
ruby 3.3.3p89

BUNDLED WITH
2.3.22
2.5.11
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,35 @@ rails db:drop
cd client &&
npx prisma generate &&
npx prisma migrate dev (rails db:migrate)

manhpc@manhpc-B660M-D3H-DDR4:~/code/ruby-rails-boilerplate/client$ npx prisma migrate dev
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "verceldb", schema "public" at "ep-bold-voice-a4yp8xc9.us-east-1.aws.neon.tech:5432"

Applying migration `20240722050134_ruby_rails_boilerplate_development`

The following migration(s) have been applied:

migrations/
└─ 20240722050134_ruby_rails_boilerplate_development/
└─ migration.sql



Your database is now in sync with your schema.

Running generate... (Use --skip-generate to skip the generators)

✔ Generated Prisma Client (v5.17.0) to ./node_modules/@prisma/client in 130ms


manhpc@manhpc-B660M-D3H-DDR4:~/code/ruby-rails-boilerplate/client$
1953 git checkout 6757f51096580846978602258ea87eabee204ef2 -- Dockerfile
1954 git status
1955 git checkout 6757f51096580846978602258ea87eabee204ef2 -- docker-compose.yml


rails db:seed (prisma introspect && npx prisma db pull && npx prisma db push)
cd ..
rails s -p 3001
Expand Down
Loading

0 comments on commit 5a25b44

Please sign in to comment.