## Summary Improve local dev restart reliability by enhancing `make force_run` to run cleanup before starting Overmind. ## How To Reproduce During local development, if `make run` is interrupted (for example with Ctrl-C), stale state can remain (`.overmind.sock`, PID files, and processes on ports `3000`/`3036`), which can block or complicate the next restart. ## Changes Updated `force_run` in `Makefile` to: - print cleanup start/end messages - kill processes on ports `3036` and `3000` (best-effort) - remove `.overmind.sock` - remove `tmp/pids/*.pid` - then start `Procfile.dev` via Overmind No other files are changed in this PR. ## Testing - Verified branch diff against `develop` only touches `Makefile`. - Ran `make -n force_run` to validate the command sequence and startup flow. --------- Co-authored-by: Sojan Jose <sojan@pepalo.com>
67 lines
1.5 KiB
Makefile
67 lines
1.5 KiB
Makefile
# Variables
|
|
APP_NAME := chatwoot
|
|
RAILS_ENV ?= development
|
|
|
|
# Targets
|
|
setup:
|
|
gem install bundler
|
|
bundle install
|
|
pnpm install
|
|
|
|
db_create:
|
|
RAILS_ENV=$(RAILS_ENV) bundle exec rails db:create
|
|
|
|
db_migrate:
|
|
RAILS_ENV=$(RAILS_ENV) bundle exec rails db:migrate
|
|
|
|
db_seed:
|
|
RAILS_ENV=$(RAILS_ENV) bundle exec rails db:seed
|
|
|
|
db_reset:
|
|
RAILS_ENV=$(RAILS_ENV) bundle exec rails db:reset
|
|
|
|
db:
|
|
RAILS_ENV=$(RAILS_ENV) bundle exec rails db:chatwoot_prepare
|
|
|
|
console:
|
|
RAILS_ENV=$(RAILS_ENV) bundle exec rails console
|
|
|
|
server:
|
|
RAILS_ENV=$(RAILS_ENV) bundle exec rails server -b 0.0.0.0 -p 3000
|
|
|
|
burn:
|
|
bundle && pnpm install
|
|
|
|
run:
|
|
@if [ -f ./.overmind.sock ]; then \
|
|
echo "Overmind is already running. Use 'make force_run' to start a new instance."; \
|
|
else \
|
|
overmind start -f Procfile.dev; \
|
|
fi
|
|
|
|
force_run:
|
|
@echo "Cleaning up Overmind processes..."
|
|
@lsof -ti:3036 2>/dev/null | xargs kill -9 2>/dev/null || true
|
|
@lsof -ti:3000 2>/dev/null | xargs kill -9 2>/dev/null || true
|
|
@rm -f ./.overmind.sock
|
|
@rm -f tmp/pids/*.pid
|
|
@echo "Cleanup complete"
|
|
overmind start -f Procfile.dev
|
|
|
|
force_run_tunnel:
|
|
lsof -ti:3000 | xargs kill -9 2>/dev/null || true
|
|
rm -f ./.overmind.sock
|
|
rm -f tmp/pids/*.pid
|
|
overmind start -f Procfile.tunnel
|
|
|
|
debug:
|
|
overmind connect backend
|
|
|
|
debug_worker:
|
|
overmind connect worker
|
|
|
|
docker:
|
|
docker build -t $(APP_NAME) -f ./docker/Dockerfile .
|
|
|
|
.PHONY: setup db_create db_migrate db_seed db_reset db console server burn docker run force_run force_run_tunnel debug debug_worker
|