Skip to content

Commit

Permalink
remove pid on start production
Browse files Browse the repository at this point in the history
  • Loading branch information
fey committed Jan 15, 2025
1 parent 423880f commit 2f55a00
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ COPY . .

RUN bin/rails assets:precompile

CMD ["bash", "-c", "bin/rails db:prepare && bin/rails server"]
CMD ["bash", "-c", "make db-prepare && make start"]
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ ruby '~> 3.2.2'

gem 'bootsnap', require: false
gem 'cssbundling-rails'
# NOTE: должен быть в dev или test зависимостью. Испольузем для заполнения БД для демонстрации
gem 'faker'
gem 'flash_rails_messages'
gem 'jbuilder'
gem 'jsbundling-rails'
Expand All @@ -22,7 +24,6 @@ gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

group :development, :test do
gem 'debug', platforms: %i[mri mingw x64_mingw]
gem 'faker'
gem 'rubocop'
gem 'rubocop-performance'
gem 'rubocop-rails'
Expand Down
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
start:
rm -rf tmp/pids/server.pid
bin/rails s -b 0.0.0.0

rm -rf tmp/pids/server.pid || true
bin/rails s
setup: install db-prepare

install:
Expand All @@ -23,4 +22,12 @@ lint:
lint-fix:
bundle exec rubocop -A

compose-production-run-app:
docker compose -p rails_bulletin_board_project_ru-production -f docker-compose.production.yml build
docker compose -p rails_bulletin_board_project_ru-production -f docker-compose.production.yml up

compose-production-console:
docker compose -p rails_bulletin_board_project_ru-production -f docker-compose.production.yml exec app bin/rails console


.PHONY: test
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]

# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
config.force_ssl = false

# Include generic and useful information about system operation, but avoid logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII).
Expand Down
13 changes: 13 additions & 0 deletions docker-compose.production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---

services:
app:
build:
dockerfile: Dockerfile
context: .
environment:
PORT: 3000
SECRET_KEY_BASE: test
RAILS_ENV: production
ports:
- 3000:3000

0 comments on commit 2f55a00

Please sign in to comment.