Trying to migrate from Heroku

I am trying to migrate our Rails project over from Heroku. I have followed the migration guide and believe everything set itself up "automagically", but deploys are failing and I am really struggling to understand why, or understand how to gain any control over the situation to resolve. I will attach a screenshot of the deploy logs as well as our build settings. Project ID: dbb32a7b-e126-450a-89f1-55383bcf99b8
99 Replies
Percy
Percy2y ago
Project ID: dbb32a7b-e126-450a-89f1-55383bcf99b8
beninate
beninateOP2y ago
beninate
beninateOP2y ago
Jack
Jack2y ago
Not incredibly experienced in this category and I could be wrong; however you can try to ensure your bundler gem version is the most recent version: For example, you can change gem 'bundler', '2.1.4' to gem 'bundler', '>= 2.1.4'. Then run bundle update bundler locally to update your Gemfile.lock. Heroku is holds your hand with your code and its deployment, while Railway executes your deployments as-is, so any minor changes like this could affect it.
beninate
beninateOP2y ago
Thanks. I have tried running railway run gem install bundler:2.1.4 and indeed when i run railway run gem list, bundler 2.1.4 is now listed. However I'm still getting the exact same error on deploy 🤔
Jack
Jack2y ago
If you have already installed bundler version 2.1.4 using the railway run gem install bundler:2.1.4 command, but you are still encountering the same error during deployment, there might be a few other things to consider: 1. Check your Gemfile: Make sure that your Gemfile specifies the required bundler version as gem 'bundler', '>= 2.1.4'. Verify that there are no conflicting gem versions or other issues in your Gemfile. 2. Run bundle update bundler: Locally, run the command bundle update bundler to update your Gemfile.lock and ensure that the correct bundler version is locked in. 3. Verify the Dockerfile: Confirm that your Dockerfile is correctly configured to install the specified bundler version. The Dockerfile should contain a line like RUN gem install bundler -v '>= 2.1.4'.
beninate
beninateOP2y ago
Sigh, I actually did not realize this project had a Dockerfile, but just found it. It's old and totally outdated. I want to just remove it and see if Railway can deploy without specifying one? However, now when trying to deploy with railway up, im getting "The owner of this project is not verified". Any ideas here? Sorry this request is now taking a tangent, but i wasn't experiencing this issue previously.
Jack
Jack2y ago
Absolutely no worries; have you received any verification emails regarding verifying your email/account? and/or linking your GitHub account to Railway if you have one?
beninate
beninateOP2y ago
I'm actually not the owner of the GH repo, but I believe he did verify it a few days ago. But i'll check with him. Thanks
Jack
Jack2y ago
Oh hmm, didn’t know that the owner of the project had to be verified. Are you using codespaces or the cli installed on your computer with a local directory? And of course, feel free to reach out with any other questions or concerns.
beninate
beninateOP2y ago
Yea im using CLI
Jack
Jack2y ago
Oh, are you using a shared project shared by your friend?
beninate
beninateOP2y ago
that's right
Jack
Jack2y ago
Ah, makes sense.
beninate
beninateOP2y ago
are we "doing it wrong"? 😅
Jack
Jack2y ago
Sorry for the confusion. Nope, just gotta make sure he’s verified I’m assuming, tell him to check out his email and see if he ever got any verifications emails or messages in settings, haha.
beninate
beninateOP2y ago
copy Alright, so i've asked the GH account owner to look and he doesn't see any additional emails asking for account verification. He had already successfully verified the account previously, it just stopped "working" somewhere along the lines. Is there any way to re-initialize that process? Anyone…?
Ray
Ray2y ago
Did you push those changes to your gem lockfile etc.? railway run runs the command with envs from Railway injected. It means "run this command locally using my Railway variables" instead of "run this command on my service on Railway"
beninate
beninateOP2y ago
I did but cannot deploy due to the aforementioned account verification issue Hmm ok; trying to process what that means practically 🤔
Ray
Ray2y ago
Try again
beninate
beninateOP2y ago
What is the proper way then to deploy a different branch? ‘git checkout somebranch’, ‘railway up’?
Ray
Ray2y ago
I overrode the verification for your project owner mmmm, I'd recommend sticking the project on GitHub and connecting that to your Railway service in that case because you'd ideally want that different branch to be on a different environment in Railway if you do railway up that way, it's going to push to whichever environment your CLI is set to (production by default) (which means there's a chance your some-shiny-wip-feature branch gets pushed to your app's production)
beninate
beninateOP2y ago
hm, obviously we'd always want our production environment to be pointed to master, but we want to also have a staging environment which could have any number of branches pointed at it; surely we wouldn't need to create a different environment for each branch? well, as far as my initial question, this build seems to be more promising now that i've removed our crappy Dockerfile 👍
Ray
Ray2y ago
Nope! If you enable PR deploys for your project, we'll spin up a different environment for each pull request you have. But that flow is entirely based on what you push to GitHub, not locally via CLI
beninate
beninateOP2y ago
hmm, we have dozens of branches though. surely that would incur a prohibitive cost once we get our evironments fully up and running?
beninate
beninateOP2y ago
🙌
Ray
Ray2y ago
They're pull requests based. When you open a new PR, the env gets spun up. When you merge/close a PR, they get deleted 🙂 Let me share an example, one sec
beninate
beninateOP2y ago
mm word ok. i'll need to give that a think
Ray
Ray2y ago
https://github.com/railwayapp/docs/pull/304 see this? There's a PR environment available at its own URL. https://docs.railway.app/develop/services#docker-image is our production, https://railway-docs-docs-pr-304.up.railway.app/develop/services#docker-image gets changed in that PR. The environment gets created in Railway when the PR is opened, and it gets automatically deleted once I merge that into master.
beninate
beninateOP2y ago
interesting. but for instance, in our current setup on Heroku, we'd maintain our staging environment database with a copy of production data; how would that happen in these PR environments if they are just spinning up from scratch each time?
Ray
Ray2y ago
you can maintain that staging environment manually, and point your PR environments to use your staging environment's database connection string
beninate
beninateOP2y ago
kk
Ray
Ray2y ago
is what you'd see for PR environment settings. Change the base environment to your staging and it should work 🙂
beninate
beninateOP2y ago
ok so this build got far further along than we've made it so far, but at the risk of being a pain now, there's a problem it encountered, and I'm not quite sure how to go about resolving. This isn't something we've encountered locally, and in any case I'm not sure how i'd go about resolving something on Railway's end...? not sure if it's an issue with the Nixpack or what exactly 🧐
Ray
Ray2y ago
Wanna post the error here? Others will be able to jump in to help 🙂
beninate
beninateOP2y ago
sorry yea
#15 [stage-0 11/17] RUN --mount=type=cache,id=s/0fcd9f91-f49a-455a-82e9-90b8129eaee6-/root/npm,target=/root/.npm npm i

#15 1.446 npm notice
#15 1.446 npm notice New major version of npm available! 8.19.2 -> 9.8.0
#15 1.446 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.8.0>;
#15 1.446 npm notice Run `npm install -g [email protected]` to update!
#15 1.447 npm notice
#15 1.449 npm ERR! code ERESOLVE
#15 1.452 npm ERR! ERESOLVE unable to resolve dependency tree
#15 1.452 npm ERR!
#15 1.452 npm ERR! While resolving: thesimgrid@undefined
#15 1.453 npm ERR! Found: [email protected]
#15 1.453 npm ERR! node_modules/trix
#15 1.453 npm ERR! trix@"^2.0.0-alpha.1" from the root project
#15 1.453 npm ERR!
#15 1.453 npm ERR! Could not resolve dependency:
#15 1.453 npm ERR! peer trix@"^1.3.1" from @rails/[email protected]
#15 1.453 npm ERR! node_modules/@rails/actiontext
#15 1.453 npm ERR! @rails/actiontext@"^7.0.2-3" from the root project
#15 1.453 npm ERR!
#15 1.454 npm ERR! Fix the upstream dependency conflict, or retry

#15 1.454 npm ERR! this command with --force, or --legacy-peer-deps
#15 1.454 npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
#15 1.454 npm ERR!
#15 1.454 npm ERR! See /root/.npm/eresolve-report.txt for a full report.
#15 1.456
#15 1.456 npm ERR! A complete log of this run can be found in:
#15 1.456 npm ERR! /root/.npm/_logs/2023-07-08T00_54_12_611Z-debug-0.log
#15 ERROR: process "/bin/bash -ol pipefail -c npm i" did not complete successfully: exit code: 1
-----
#15 [stage-0 11/17] RUN --mount=type=cache,id=s/0fcd9f91-f49a-455a-82e9-90b8129eaee6-/root/npm,target=/root/.npm npm i

#15 1.446 npm notice
#15 1.446 npm notice New major version of npm available! 8.19.2 -> 9.8.0
#15 1.446 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.8.0>;
#15 1.446 npm notice Run `npm install -g [email protected]` to update!
#15 1.447 npm notice
#15 1.449 npm ERR! code ERESOLVE
#15 1.452 npm ERR! ERESOLVE unable to resolve dependency tree
#15 1.452 npm ERR!
#15 1.452 npm ERR! While resolving: thesimgrid@undefined
#15 1.453 npm ERR! Found: [email protected]
#15 1.453 npm ERR! node_modules/trix
#15 1.453 npm ERR! trix@"^2.0.0-alpha.1" from the root project
#15 1.453 npm ERR!
#15 1.453 npm ERR! Could not resolve dependency:
#15 1.453 npm ERR! peer trix@"^1.3.1" from @rails/[email protected]
#15 1.453 npm ERR! node_modules/@rails/actiontext
#15 1.453 npm ERR! @rails/actiontext@"^7.0.2-3" from the root project
#15 1.453 npm ERR!
#15 1.454 npm ERR! Fix the upstream dependency conflict, or retry

#15 1.454 npm ERR! this command with --force, or --legacy-peer-deps
#15 1.454 npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
#15 1.454 npm ERR!
#15 1.454 npm ERR! See /root/.npm/eresolve-report.txt for a full report.
#15 1.456
#15 1.456 npm ERR! A complete log of this run can be found in:
#15 1.456 npm ERR! /root/.npm/_logs/2023-07-08T00_54_12_611Z-debug-0.log
#15 ERROR: process "/bin/bash -ol pipefail -c npm i" did not complete successfully: exit code: 1
-----
Dockerfile:30
-------------------
28 | ENV NIXPACKS_PATH /app/node_modules/.bin:$NIXPACKS_PATH
29 | COPY . /app/.
30 | >>> RUN --mount=type=cache,id=s/0fcd9f91-f49a-455a-82e9-90b8129eaee6-/root/npm,target=/root/.npm npm i
31 |
32 | # build phase
-------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm i" did not complete successfully: exit code: 1

Error: Docker build failed
Dockerfile:30
-------------------
28 | ENV NIXPACKS_PATH /app/node_modules/.bin:$NIXPACKS_PATH
29 | COPY . /app/.
30 | >>> RUN --mount=type=cache,id=s/0fcd9f91-f49a-455a-82e9-90b8129eaee6-/root/npm,target=/root/.npm npm i
31 |
32 | # build phase
-------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm i" did not complete successfully: exit code: 1

Error: Docker build failed
@rayofbytes curious, are you guys seeing an influx of Heroku refugees?
Ray
Ray2y ago
lots for a multitude of reasons...
beninate
beninateOP2y ago
figured. yea Salesforce has clearly already laid Heroku in a casket; just haven't closed the lid just yet Railway seemed like the next-best alternative. I'm still in the learning curve of trying to understand how they differ; being totally honest it's not quite the experience i was hoping for, but im sure i need to give it some more time and get everything up and running properly before making a judgment call. anyways, i appreaciate the assistance.
Ray
Ray2y ago
We ❤️ candid feedback. What's lacking for you? Our goal is zero learning curve but evidently we're not there yet
beninate
beninateOP2y ago
1. The "account-less" setup (Github link) is a little cumbersome, especially as I'm not the repo-owner, I need to keep bugging the business owner as I'm monkeying around setting up; would prefer a proper Railway account that we then link our stuff to as needed 2. The Dockerfile frustration was my own stupidity and oversight, so i can't put that on you guys. 3. The overview of your environment, where the blocks move around in the background, it's a neat idea, but a little bit gimicky, especially if you don't have access to a 2D scrolling mouse (i suppose click+drag works); would prefer a more traditional representation 4. I really would prefer a dedicated staging environment and the ability to deploy any branch we like to any environment we like; but need to give this PR deploy situation a shot before i judge prematurely
Ray
Ray2y ago
Love that, thank you! For 1, what issues are you running into that requires you to bug the business owner? For 4, you can create an environment yourself -- PR environments are just a automagic way to get environments for each PR (https://docs.railway.app/develop/environments)
Railway Docs
Environments | Railway Docs
Documentation for Railway
beninate
beninateOP2y ago
1. It was just during initial setup, we’re he had to start the railway setup and verify GH account ownership (which also didn’t seem to work quite right until you fixed it for us tonight).
Ray
Ray2y ago
Yeah that one is frustrating... We're shipping a few changes to tweak all of that soon
beninate
beninateOP2y ago
Awesome All just nitpicks btw, I’m just tired and grumpy and want to go back to playing FF XVI 🤣 I am excited to see how we look when we get our environment fully spun up
Jack
Jack2y ago
No worries haha, wanted to make some “nixpacks” joke with “nitpicks” but forgot 😭
beninate
beninateOP2y ago
this got lost in the fray, can anyone assist with this nixpack issue on our build? https://discord.com/channels/713503345364697088/1126140112590356561/1127044810415546388
Brody
Brody2y ago
you have dependency conflicts
beninate
beninateOP2y ago
Hmm but how would I go about resolving if I don’t have them locally? 🤔
Brody
Brody2y ago
well that's a good question and you aren't force installing locally are you?
beninate
beninateOP2y ago
negative 🤔
Brody
Brody2y ago
programming is fun they said
beninate
beninateOP2y ago
😂
Brody
Brody2y ago
what version of node are you using locally, and what version of node is railway using (it would be printed in the build table at the top of the build logs)
beninate
beninateOP2y ago
I've got 20.3.1, but interestingly, i don't actually see node getting installed in the build logs 🧐 oh! "Load More", 1 sec 😅 ok, still unsure. I see where it's installed, but no version is printed. the only reference to a version i can find is way further along, this line:
#8 23.06 /nix/store/21xbsm5vvam6mjwh5qbz3l027wwn5fvx-nodejs-16.18.1
#8 32.69 copying path '/nix/store/21xbsm5vvam6mjwh5qbz3l027wwn5fvx-nodejs-16.18.1' from 'https://cache.nixos.org';...
#8 23.06 /nix/store/21xbsm5vvam6mjwh5qbz3l027wwn5fvx-nodejs-16.18.1
#8 32.69 copying path '/nix/store/21xbsm5vvam6mjwh5qbz3l027wwn5fvx-nodejs-16.18.1' from 'https://cache.nixos.org';...
unsure if that would suggest the installed version is 16.18.1?
Brody
Brody2y ago
keep going! all the way to the top
beninate
beninateOP2y ago
yea, i see the table, but there's no version
beninate
beninateOP2y ago
Brody
Brody2y ago
keep going!
beninate
beninateOP2y ago
aint can do!
Brody
Brody2y ago
ah bummer look at another failed deployment haha maybe it won't have the table cut off
beninate
beninateOP2y ago
boom, ok
beninate
beninateOP2y ago
Brody
Brody2y ago
node 16 if you are developing locally on node 20, and then trying to run it on railway with node 16, it's probably not gonna work out lol the only problem now is that nixpacks only supports up to node 18
beninate
beninateOP2y ago
rip, hmmm
Brody
Brody2y ago
so let's try with node 18 first
beninate
beninateOP2y ago
how do i get my nixpack to use node 18?
Brody
Brody2y ago
in your package.json set engines.node to 18
beninate
beninateOP2y ago
this look right? 😬
Brody
Brody2y ago
not one single bit engines is an object at the root of the global object
beninate
beninateOP2y ago
ok
Brody
Brody2y ago
and then node is a text field
beninate
beninateOP2y ago
gulp?
Brody
Brody2y ago
yep!
beninate
beninateOP2y ago
aight. lemme give it a whirl
Brody
Brody2y ago
sounds good
beninate
beninateOP2y ago
welp, it is using 18 we sit and wait
Brody
Brody2y ago
cool peeposit
beninate
beninateOP2y ago
wonder if it's cause im on ARM locally, but the Railway machine is x86
Brody
Brody2y ago
most node modules should be pretty platform independent
beninate
beninateOP2y ago
looks like it's failing in the same place. we're not even using trix though, wonder if we even need to declare that in the package.json 🤔
Brody
Brody2y ago
whats trix
beninate
beninateOP2y ago
it's Rails' integrated rich-text editor thingy
Brody
Brody2y ago
isnt this a node app
beninate
beninateOP2y ago
nope ruby on rails
Brody
Brody2y ago
whats node for
beninate
beninateOP2y ago
it may be required to install some packages the stack depends on. im guessing that's why it's part of the nixpack?
Brody
Brody2y ago
do you have a railway.json in your project?
beninate
beninateOP2y ago
negative
Brody
Brody2y ago
can you show me the entire build table along with your package.json?
beninate
beninateOP2y ago
y
beninate
beninateOP2y ago
Brody
Brody2y ago
just trying to sus out any problems
beninate
beninateOP2y ago
sorry, meant y, as in "yes" 😆
Brody
Brody2y ago
do you have a node_modules folder in your repo
beninate
beninateOP2y ago
negative (gotta run back later, thx for your help thus far)
Brody
Brody2y ago
actiontext uses trix 1.3.1, so try installing that instead of 2.0.0-alpha.1
beninate
beninateOP2y ago
woah baby! we've made it to the Deploy phase! 🤞 just removed trix entirely from package.json for now deploy succeeded! thanks guys for the help. sorry to have been a neusence
Brody
Brody2y ago
absolutely where not a neusence, that's what #help is for!! I'm glad we where able to help!
beninate
beninateOP2y ago
🫶
Want results from more Discord servers?
Add your server