R
Railway

✋|help

Duplicate variables when setting up additional service for Sidekiq in a Rails project

Nnickmacavoy11/28/2022
Hey team, firstly love your work. I've searched Discord/Google/help for advice on this already but I haven't seen a conclusive answer. I'm trying to find the optimal way of running Sidekiq in a Nixpacks build scenario. Currently we have a start script containing: bundle exec rails s -b 0.0.0.0 & bundle exec sidekiq Up to August 2022 I believe that's been the recommended way to run both Rails and Sidekiq in a start script (rather than a Procfile environment). Though now i'm reading that that's not the recommended way, and that one should have a separate service created solely for Sidekiq – makes sense. Here's the thread: https://discord.com/channels/713503345364697088/1024492237486309457/1024654301181788160 Do I then need to copy all environment variables that are in my Rails service to my Sidekiq service? I believe so, otherwise Sidekiq will be running a different environment to the Rails one. But no where I've seen mentions that and it feels important. It also means that we have a post-deploy manual task of environment variable duplication which doesn't sound optimal. PS. You may notice looking at the project that I currently do have a Procfile but I'm proposing the above two-service solution and removing the Procfile in the process. Thank you! Project: 3c08e827-8d73-4a37-bbe9-9af9757bd354 Service: 959337ac-60f8-4004-9151-1b122a5e1460
PPercy11/28/2022
Project ID: 3c08e827-8d73-4a37-bbe9-9af9757bd354,959337ac-60f8-4004-9151-1b122a5e1460
JJustJake11/28/2022
You can use project level variables Project Settings -> Variables Those will be shared with all services
Nnickmacavoy11/28/2022
Brilliant, thanks Cooper, let me look into that. Sounds exactly like what I'm looking for
JJustJake11/28/2022
We just rolled it out. Need to highlight it better!
Nnickmacavoy11/28/2022
I can't find that option i'm afraid. This is what I see as the options in Project Settings
JJustJake11/28/2022
hmm Can you pair your Discord account and then type /beta? I think it's still in the priority boarding menu
Nnickmacavoy11/28/2022
Will do, i'll revert when i've done that. Ta
JJustJake11/28/2022
https://railway.app/account -> Discord sg let me know! Once you do that, should show the Shared Variables tag cool, now just refresh and it should show up (hopefully!)
Nnickmacavoy11/28/2022
Yes! Success. Thank you, i'll post in the thread if I have any hitches with this but appears to be exactly what I need
JJustJake11/28/2022
Perfecto 😄
Nnickmacavoy11/28/2022
Hey there, me again. Something i'll run into with this second service setup is that there needs to be a deploy order. Rails needs to be built first, and then Sidekiq needs to be second on success of the first. It's imperative it is ordered on success otherwise Sidekiq will deploy without any of the code in the concurrent Rails deploy (because Rails has a build stage it will be far slower and Sidekiq which will deploy instantly). I see there's a thread here on syncing deploys which is what i'm looking for: https://discordapp.com/channels/713503345364697088/1038386449776656464/1038386449776656464 Just confirming that my existing method should work OK using a single service setup? bundle exec rails s -b 0.0.0.0 & bundle exec sidekiq I might stick with this existing method if it works until there's clarity over this deploy order
JJustJake11/28/2022
That would work You can also use GitHub actions to call the deploys synchronously
JJustJake11/28/2022
Railway Blog
Using Github Actions with Railway
Github Actions come with a pretty neat set of features to automate your workflows. In this post, we talk about using Github Actions to automate your deployments on Railway.
Nnickmacavoy11/28/2022
Thank you, i'll keep you posted

Looking for more? Join the community!

Want results from more Discord servers?
Add your server
Recommended Posts
Only re-deploy (not rebuild) upon env variable changeIs there a way to have Railway not do a rebuild (which can take 4-5 minutes) and just redeploy when How to stop a project from running and using execution hours temporarilyyessamesite cookies; public suffixHi dev team! Quick question. I couldnt find railway.app (and up.railway.app) on the public suffix lDeployment has crashed after upgradeCRASHED after running my nodejs directus app, everything running locally. Please help https://railwrailway run returns 400Any command, freshly logged in and linked project. Anything I should check? Statuspage is green.rust-overlay unable to download archivemore info in chatNodeJS server does not use connection keep-alive anymoreI moved my NodeJS http server from Heroku to NodeJS. It's just a school project, so it uses regular Deployment with build doesn't workHi I am trying to deploy my react app with npm run build command but it gives an error while buildinPath of a Nixpacks (google-chrome, chromedriver) [Python]Hello, with the latest update I could install `google-chrome` and `chromedriver` using Nixpacks by afailing to buildmy builds are failingI'm having issues with my deploymentI am trying to redeploy a project. Here is the response I am getting. ```bash #3 [internal] load meScheduling Jobs to run far in the futureHey there, I have a Typescript project running on Railway. I am looking to dynamically schedule a Dockerfile working on local machine but not RailwayHere is my dockerfile ```dockerfile FROM rust:latest ARG DATABASE_URL WORKDIR /usr/src/pail COPY Prisma and nextjs app with pg urlFrom your example, it deploys both: a postgres container and a nodejs container, but to be able to project idhow do you find the project idSetting up a local environmentFor a variety of reasons I typically like to develop completely locally. I'm using the Next.js / Pri