Procfile with web & worker should create two services, right?

Rails 6 app with this Procfile:
web: /bin/bash -l -c "rails db:migrate && bundle exec puma -C config/puma.rb"
worker: /bin/bash -l -c "bundle exec sidekiq -C config/sidekiq.yml"
web: /bin/bash -l -c "rails db:migrate && bundle exec puma -C config/puma.rb"
worker: /bin/bash -l -c "bundle exec sidekiq -C config/sidekiq.yml"
I added PostgreSQL service and Redis service Then I add Github repo. Only one service appears and start of Build logs looks like this:
╔═══════════════════════════════ Nixpacks v0.6.2 ══════════════════════════════╗
║ setup │ pkgs: procps, libpq-dev
║ │ cmds: curl -sSL https://get.rvm.io | bash -s stable && .
║ │ /etc/profile.d/rvm.sh
║ │ rvm install 3.1.2
║ │ rvm --default use 3.1.2
║ │ gem install bundler:2.3.17
║ │ echo 'source /usr/local/rvm/scripts/rvm' >> /root/.profile
║─────────────────────────────
║ node:setup │ nodejs-16_x, npm-8_x
║─────────────────────────────
║ node:install │ npm i
║──────────────────────────────
║ install │ bundle install
║───────────────────────────────
║ build │ bundle exec rake assets:precompile
║───────────────────────────────
║ start │ /bin/bash -l -c "bundle exec sidekiq -C config/sidekiq.yml"
╔═══════════════════════════════ Nixpacks v0.6.2 ══════════════════════════════╗
║ setup │ pkgs: procps, libpq-dev
║ │ cmds: curl -sSL https://get.rvm.io | bash -s stable && .
║ │ /etc/profile.d/rvm.sh
║ │ rvm install 3.1.2
║ │ rvm --default use 3.1.2
║ │ gem install bundler:2.3.17
║ │ echo 'source /usr/local/rvm/scripts/rvm' >> /root/.profile
║─────────────────────────────
║ node:setup │ nodejs-16_x, npm-8_x
║─────────────────────────────
║ node:install │ npm i
║──────────────────────────────
║ install │ bundle install
║───────────────────────────────
║ build │ bundle exec rake assets:precompile
║───────────────────────────────
║ start │ /bin/bash -l -c "bundle exec sidekiq -C config/sidekiq.yml"
I can see "start" has the 2nd line of my Procfile and if I let it go fully, I have a Sidekiq process running, but not a Puma server. The only issue I can think of is I'm not deploying from master, I have a separate branch on my repo called railway and after the service is connected, I abort the first deploy from master and switch it over to the railway branch. Could this be causing the issue as it reads from the master branch initially?
5 Replies
chiperific
chiperific2y ago
Project ID: 9ddc4dfb-ab3f-4809-8481-9657a0c52a43
angelo
angelo2y ago
I haven't seen your repo yet but is your Procfile in your .gitignore?
chiperific
chiperific2y ago
No, just checked. However, my procfile for my master branch is different:
web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -C config/sidekiq.yml
web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -C config/sidekiq.yml
The master branch is still deployed on Heroku, so I was trying to use a separate branch to deploy to Railway.
Faraz
Faraz2y ago
IIRC you need to create a separate service to deploy your worker process. My recommendation would be that on your railway branch, remove the Procfile. Then: 1. In your first service, under settings, set a start command of /bin/bash -l -c "rails db:migrate && bundle exec puma -C config/puma.rb" 2. In your second service, under settings, set a start command of /bin/bash -l -c "bundle exec sidekiq -C config/sidekiq.yml" ^ This is assuming those are your start commands for the web and worker processes.
chiperific
chiperific2y ago
This worked! Instead of creating services from GitHub, I created empty services, set the start commands and then linked to GitHub, which allowed me to set the branch before they started to build. Might be worth addding something to the docs about deploying when not using master or main.