mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-19 23:32:53 +00:00
Setup config for deploying both worker and web (#362)
This commit is contained in:
parent
97f8119e8d
commit
7c5b869bce
5 changed files with 47 additions and 3 deletions
|
|
@ -74,6 +74,6 @@ USER 1000:1000
|
|||
# Entrypoint prepares the database.
|
||||
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
|
||||
|
||||
# Start either web server or job worker based on WORKER env var
|
||||
# Start either web server or job worker based on PROCESS_TYPE env var
|
||||
EXPOSE 80
|
||||
CMD ["./bin/thrust", "./bin/rails", "server"]
|
||||
CMD ["./bin/start-process"]
|
||||
|
|
|
|||
2
Procfile
Normal file
2
Procfile
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
web: bundle exec rails server -b 0.0.0.0 -p $PORT
|
||||
worker: bundle exec good_job start
|
||||
18
bin/start-process
Executable file
18
bin/start-process
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# Start the appropriate process based on PROCESS_TYPE environment variable
|
||||
case "$PROCESS_TYPE" in
|
||||
web)
|
||||
echo "Starting web server..."
|
||||
exec ./bin/thrust ./bin/rails server -b 0.0.0.0 -p ${PORT:-80}
|
||||
;;
|
||||
worker)
|
||||
echo "Starting GoodJob worker..."
|
||||
exec bundle exec good_job start
|
||||
;;
|
||||
*)
|
||||
echo "Unknown PROCESS_TYPE: $PROCESS_TYPE"
|
||||
echo "Valid options: web, worker"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
@ -9,7 +9,7 @@ Rails.application.configure do
|
|||
config.good_job.poll_interval = -1 # Disable polling
|
||||
config.good_job.execution_mode = :inline # Run jobs inline in development
|
||||
else
|
||||
config.good_job.execution_mode = :async
|
||||
config.good_job.execution_mode = :external
|
||||
end
|
||||
|
||||
config.good_job.enable_cron = Rails.env.production?
|
||||
|
|
|
|||
24
docker-compose.coolify.yml
Normal file
24
docker-compose.coolify.yml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
environment:
|
||||
- PROCESS_TYPE=web
|
||||
- PORT=80
|
||||
- RAILS_ENV=production
|
||||
- DATABASE_URL=${DATABASE_URL}
|
||||
- RAILS_MASTER_KEY=${RAILS_MASTER_KEY}
|
||||
ports:
|
||||
- "80:80"
|
||||
depends_on:
|
||||
- worker
|
||||
|
||||
worker:
|
||||
build: .
|
||||
environment:
|
||||
- PROCESS_TYPE=worker
|
||||
- RAILS_ENV=production
|
||||
- DATABASE_URL=${DATABASE_URL}
|
||||
- RAILS_MASTER_KEY=${RAILS_MASTER_KEY}
|
||||
# No ports exposed for worker
|
||||
Loading…
Add table
Reference in a new issue