Skip to content

Commit b89897b

Browse files
committed
fix type streamServerClient.upsertUser lasdeloy to Vercel
1 parent 3a01a42 commit b89897b

36 files changed

+926
-696
lines changed

,

Whitespace-only changes.

Dockerfile

+46-60
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,48 @@
1-
# syntax = docker/dockerfile:1
1+
FROM ruby:3.3.3
2+
3+
# Install node & yarn
4+
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
5+
apt-get update && \
6+
apt-get install -y \
7+
libvips-dev \
8+
nodejs \
9+
curl && \
10+
curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
11+
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
12+
apt-get update && \
13+
apt-get install -y yarn
14+
15+
# Install base deps or additional (e.g. tesseract)
16+
ARG INSTALL_DEPENDENCIES
17+
RUN apt-get update -qq \
18+
&& apt-get install -y --no-install-recommends ${INSTALL_DEPENDENCIES} \
19+
build-essential libpq-dev git \
20+
&& apt-get clean autoclean \
21+
&& apt-get autoremove -y \
22+
&& rm -rf \
23+
/var/lib/apt \
24+
/var/lib/dpkg \
25+
/var/lib/cache \
26+
/var/lib/log
27+
28+
# Install deps with bundler
29+
RUN mkdir /app
30+
WORKDIR /app
31+
COPY Gemfile* /app/
32+
ARG BUNDLE_INSTALL_ARGS
33+
RUN gem install bundler:2.5.11
34+
RUN bundle config set without 'development test'
35+
RUN bundle install ${BUNDLE_INSTALL_ARGS} \
36+
&& rm -rf /usr/local/bundle/cache/* \
37+
&& find /usr/local/bundle/gems/ -name "*.c" -delete \
38+
&& find /usr/local/bundle/gems/ -name "*.o" -delete
39+
COPY . /app/
40+
41+
# Compile assets
42+
ARG RAILS_ENV=development
43+
RUN if [ "$RAILS_ENV" = "production" ]; then SECRET_KEY_BASE=$(rake secret) bundle exec rake assets:precompile; fi
44+
45+
VOLUME /rails/db
246

3-
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
4-
ARG RUBY_VERSION=3.3.2
5-
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
6-
7-
# Rails app lives here
8-
WORKDIR /rails
9-
10-
# Set production environment
11-
ENV RAILS_ENV="production" \
12-
BUNDLE_DEPLOYMENT="1" \
13-
BUNDLE_PATH="/usr/local/bundle" \
14-
BUNDLE_WITHOUT="development"
15-
16-
17-
# Throw-away build stage to reduce size of final image
18-
FROM base as build
19-
20-
# Install packages needed to build gems
21-
RUN apt-get update -qq && \
22-
apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config
23-
24-
# Install application gems
25-
COPY Gemfile Gemfile.lock ./
26-
RUN bundle install && \
27-
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
28-
bundle exec bootsnap precompile --gemfile
29-
30-
# Copy application code
31-
COPY . .
32-
33-
# Precompile bootsnap code for faster boot times
34-
RUN bundle exec bootsnap precompile app/ lib/
35-
36-
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
37-
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
38-
39-
40-
# Final stage for app image
41-
FROM base
42-
43-
# Install packages needed for deployment
44-
RUN apt-get update -qq && \
45-
apt-get install --no-install-recommends -y curl libvips postgresql-client && \
46-
rm -rf /var/lib/apt/lists /var/cache/apt/archives
47-
48-
# Copy built artifacts: gems, application
49-
COPY --from=build /usr/local/bundle /usr/local/bundle
50-
COPY --from=build /rails /rails
51-
52-
# Run and own only the runtime files as a non-root user for security
53-
RUN useradd rails --create-home --shell /bin/bash && \
54-
chown -R rails:rails db log storage tmp
55-
USER rails:rails
56-
57-
# Entrypoint prepares the database.
58-
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
59-
60-
# Start the server by default, this can be overwritten at runtime
6147
EXPOSE 3000
62-
CMD ["./bin/rails", "server"]
48+
CMD ["rails", "server", "-b", "0.0.0.0"]

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ gem "bootsnap", require: false
6060

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

Gemfile.lock

+73-33
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,25 @@ GEM
8181
minitest (>= 5.1)
8282
mutex_m
8383
tzinfo (~> 2.0)
84-
addressable (2.8.6)
85-
public_suffix (>= 2.0.2, < 6.0)
84+
addressable (2.8.7)
85+
public_suffix (>= 2.0.2, < 7.0)
8686
autoprefixer-rails (10.4.16.0)
8787
execjs (~> 2)
8888
aws-eventstream (1.3.0)
89-
aws-partitions (1.944.0)
90-
aws-sdk-core (3.197.0)
89+
aws-partitions (1.958.0)
90+
aws-sdk-core (3.201.3)
9191
aws-eventstream (~> 1, >= 1.3.0)
9292
aws-partitions (~> 1, >= 1.651.0)
9393
aws-sigv4 (~> 1.8)
9494
jmespath (~> 1, >= 1.6.1)
95-
aws-sdk-kms (1.84.0)
96-
aws-sdk-core (~> 3, >= 3.197.0)
97-
aws-sigv4 (~> 1.1)
98-
aws-sdk-s3 (1.152.3)
99-
aws-sdk-core (~> 3, >= 3.197.0)
95+
aws-sdk-kms (1.88.0)
96+
aws-sdk-core (~> 3, >= 3.201.0)
97+
aws-sigv4 (~> 1.5)
98+
aws-sdk-s3 (1.156.0)
99+
aws-sdk-core (~> 3, >= 3.201.0)
100100
aws-sdk-kms (~> 1)
101-
aws-sigv4 (~> 1.8)
102-
aws-sigv4 (1.8.0)
101+
aws-sigv4 (~> 1.5)
102+
aws-sigv4 (1.9.0)
103103
aws-eventstream (~> 1, >= 1.0.2)
104104
babel-source (5.8.35)
105105
babel-transpiler (0.7.0)
@@ -132,29 +132,42 @@ GEM
132132
debug (1.9.2)
133133
irb (~> 1.10)
134134
reline (>= 0.3.8)
135+
dotenv (3.1.2)
136+
dotenv-rails (3.1.2)
137+
dotenv (= 3.1.2)
138+
railties (>= 6.1)
135139
drb (2.2.1)
136140
erubi (1.13.0)
137141
execjs (2.9.1)
138-
faker (3.4.1)
142+
faker (3.4.2)
139143
i18n (>= 1.8.11, < 2)
144+
ffi (1.17.0-aarch64-linux-gnu)
145+
ffi (1.17.0-aarch64-linux-musl)
146+
ffi (1.17.0-arm-linux-gnu)
147+
ffi (1.17.0-arm-linux-musl)
148+
ffi (1.17.0-arm64-darwin)
149+
ffi (1.17.0-x86-linux-gnu)
150+
ffi (1.17.0-x86-linux-musl)
151+
ffi (1.17.0-x86_64-darwin)
140152
ffi (1.17.0-x86_64-linux-gnu)
153+
ffi (1.17.0-x86_64-linux-musl)
141154
font-awesome-sass (6.5.2)
142155
sassc (~> 2.0)
143156
globalid (1.2.1)
144157
activesupport (>= 6.1)
145-
graphql (2.3.5)
158+
graphql (2.3.10)
146159
base64
147160
i18n (1.14.5)
148161
concurrent-ruby (~> 1.0)
149-
image_processing (1.12.2)
162+
image_processing (1.13.0)
150163
mini_magick (>= 4.9.5, < 5)
151164
ruby-vips (>= 2.0.17, < 3)
152165
importmap-rails (2.0.1)
153166
actionpack (>= 6.0.0)
154167
activesupport (>= 6.0.0)
155168
railties (>= 6.0.0)
156169
io-console (0.7.2)
157-
irb (1.13.1)
170+
irb (1.14.0)
158171
rdoc (>= 4.0.0)
159172
reline (>= 0.4.2)
160173
jbuilder (2.12.0)
@@ -165,7 +178,7 @@ GEM
165178
rails-dom-testing (>= 1, < 3)
166179
railties (>= 4.2.0)
167180
thor (>= 0.14, < 2.0)
168-
jwt (2.8.1)
181+
jwt (2.8.2)
169182
base64
170183
kaminari (1.2.2)
171184
activesupport (>= 4.1.0)
@@ -182,6 +195,7 @@ GEM
182195
kaminari (>= 0.13.0)
183196
rails
184197
kaminari-core (1.2.2)
198+
logger (1.6.0)
185199
loofah (2.22.0)
186200
crass (~> 1.0.2)
187201
nokogiri (>= 1.12.0)
@@ -192,12 +206,12 @@ GEM
192206
net-smtp
193207
marcel (1.0.4)
194208
matrix (0.4.2)
195-
mini_magick (4.13.0)
209+
mini_magick (4.13.2)
196210
mini_mime (1.1.5)
197-
minitest (5.23.1)
211+
minitest (5.24.1)
198212
msgpack (1.7.2)
199213
mutex_m (0.2.0)
200-
net-imap (0.4.12)
214+
net-imap (0.4.14)
201215
date
202216
net-protocol
203217
net-pop (0.1.2)
@@ -206,16 +220,26 @@ GEM
206220
net-smtp (0.5.0)
207221
net-protocol
208222
nio4r (2.7.3)
209-
nokogiri (1.16.6-x86_64-linux)
223+
nokogiri (1.16.7-aarch64-linux)
224+
racc (~> 1.4)
225+
nokogiri (1.16.7-arm-linux)
226+
racc (~> 1.4)
227+
nokogiri (1.16.7-arm64-darwin)
228+
racc (~> 1.4)
229+
nokogiri (1.16.7-x86-linux)
230+
racc (~> 1.4)
231+
nokogiri (1.16.7-x86_64-darwin)
232+
racc (~> 1.4)
233+
nokogiri (1.16.7-x86_64-linux)
210234
racc (~> 1.4)
211-
pg (1.5.6)
235+
pg (1.5.7)
212236
psych (5.1.2)
213237
stringio
214-
public_suffix (5.0.5)
238+
public_suffix (6.0.1)
215239
puma (6.4.2)
216240
nio4r (~> 2.0)
217241
racc (1.8.0)
218-
rack (3.1.3)
242+
rack (3.1.7)
219243
rack-cors (2.0.2)
220244
rack (>= 2.0.0)
221245
rack-session (2.0.0)
@@ -258,7 +282,7 @@ GEM
258282
thor (~> 1.0, >= 1.2.2)
259283
zeitwerk (~> 2.6)
260284
rake (13.2.1)
261-
ransack (4.1.1)
285+
ransack (4.2.0)
262286
activerecord (>= 6.1.5)
263287
activesupport (>= 6.1.5)
264288
i18n
@@ -277,10 +301,11 @@ GEM
277301
regexp_parser (2.9.2)
278302
reline (0.5.9)
279303
io-console (~> 0.5)
280-
rexml (3.3.0)
304+
rexml (3.3.2)
281305
strscan
282-
ruby-vips (2.2.1)
306+
ruby-vips (2.2.2)
283307
ffi (~> 1.12)
308+
logger
284309
rubyzip (2.3.2)
285310
sassc (2.4.0)
286311
ffi (~> 1.9)
@@ -290,7 +315,9 @@ GEM
290315
sprockets (> 3.0)
291316
sprockets-rails
292317
tilt
293-
selenium-webdriver (4.10.0)
318+
selenium-webdriver (4.23.0)
319+
base64 (~> 0.2)
320+
logger (~> 1.4)
294321
rexml (~> 3.2, >= 3.2.5)
295322
rubyzip (>= 1.2.2, < 3.0)
296323
websocket (~> 1.0)
@@ -310,21 +337,21 @@ GEM
310337
strscan (3.1.0)
311338
temple (0.10.3)
312339
thor (1.3.1)
313-
tilt (2.3.0)
340+
tilt (2.4.0)
314341
timeout (0.4.1)
315-
turbo-rails (2.0.5)
342+
turbo-rails (2.0.6)
316343
actionpack (>= 6.0.0)
317344
activejob (>= 6.0.0)
318345
railties (>= 6.0.0)
319346
tzinfo (2.0.6)
320347
concurrent-ruby (~> 1.0)
321-
web-console (4.2.0)
348+
web-console (4.2.1)
322349
actionview (>= 6.0.0)
323350
activemodel (>= 6.0.0)
324351
bindex (>= 0.4.0)
325352
railties (>= 6.0.0)
326353
webrick (1.8.1)
327-
websocket (1.2.10)
354+
websocket (1.2.11)
328355
websocket-driver (0.7.6)
329356
websocket-extensions (>= 0.1.0)
330357
websocket-extensions (0.1.5)
@@ -333,7 +360,19 @@ GEM
333360
zeitwerk (2.6.16)
334361

335362
PLATFORMS
336-
x86_64-linux
363+
aarch64-linux
364+
aarch64-linux-gnu
365+
aarch64-linux-musl
366+
arm-linux
367+
arm-linux-gnu
368+
arm-linux-musl
369+
arm64-darwin
370+
x86-linux
371+
x86-linux-gnu
372+
x86-linux-musl
373+
x86_64-darwin
374+
x86_64-linux-gnu
375+
x86_64-linux-musl
337376

338377
DEPENDENCIES
339378
active_storage_validations
@@ -345,6 +384,7 @@ DEPENDENCIES
345384
capybara
346385
cocoon
347386
debug
387+
dotenv-rails
348388
faker
349389
font-awesome-sass
350390
graphql
@@ -378,4 +418,4 @@ RUBY VERSION
378418
ruby 3.3.3p89
379419

380420
BUNDLED WITH
381-
2.3.22
421+
2.5.11

README.md

+29
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,35 @@ rails db:drop
7171
cd client &&
7272
npx prisma generate &&
7373
npx prisma migrate dev (rails db:migrate)
74+
75+
manhpc@manhpc-B660M-D3H-DDR4:~/code/ruby-rails-boilerplate/client$ npx prisma migrate dev
76+
Environment variables loaded from .env
77+
Prisma schema loaded from prisma/schema.prisma
78+
Datasource "db": PostgreSQL database "verceldb", schema "public" at "ep-bold-voice-a4yp8xc9.us-east-1.aws.neon.tech:5432"
79+
80+
Applying migration `20240722050134_ruby_rails_boilerplate_development`
81+
82+
The following migration(s) have been applied:
83+
84+
migrations/
85+
└─ 20240722050134_ruby_rails_boilerplate_development/
86+
└─ migration.sql
87+
88+
89+
90+
Your database is now in sync with your schema.
91+
92+
Running generate... (Use --skip-generate to skip the generators)
93+
94+
✔ Generated Prisma Client (v5.17.0) to ./node_modules/@prisma/client in 130ms
95+
96+
97+
manhpc@manhpc-B660M-D3H-DDR4:~/code/ruby-rails-boilerplate/client$
98+
1953 git checkout 6757f51096580846978602258ea87eabee204ef2 -- Dockerfile
99+
1954 git status
100+
1955 git checkout 6757f51096580846978602258ea87eabee204ef2 -- docker-compose.yml
101+
102+
74103
rails db:seed (prisma introspect && npx prisma db pull && npx prisma db push)
75104
cd ..
76105
rails s -p 3001

0 commit comments

Comments
 (0)