medusajs ecommerce Nextjs, Postgres, Redis - monorepo

a year ago

Description: Full ecommerce solution, manage products, inventory, orders, etc.

Category: Other

URL: https://railway.app/template/QvfPwp

30 Replies

a year ago

please come up with a better template name 😂😂


smanookianHOBBY

a year ago

I tried everything to deploy this template, but I only get errors, crashes.
For example trying to call backend gives me "Application failed to respond"

Is there any tutorial how to make this running?


a year ago

I tried everything to deploy this template, but I only get errors, crashes. For example trying to call backend gives me "Application failed to respond" Is there any tutorial how to make this running?

Should be fixed now !
And yes, there's a draft tutorial here: https://funkyton.com/medusajs-free-fully-open-source-ecommerce-solution/

Still working on the template, and the tutorial, the goal is to make it as easy as possible to setup, so anyone with no technical skills can do it. Any advise and feedback is welcomed!


a year ago

please come up with a better template name 😂😂

Can you please suggest a better name. Then I will gladly change it :)


stefan8412HOBBY

a year ago

its working for me on production , also on localhost but i have issue with autodeploy(when i commit/push changes) deployment doesnt start, could you pls help


a year ago

Hello Stefan.
Two things to verify that I can think of;

  • Have you verified in github that your commit was pushed to your repository?

  • In Railway, under (either frontend/backend) cantainer -> settings -> Source repo. That this is not disconnected, and in fact points to the same repository that you pushed to?

If you can confirm that both are above are positive, then something less trivial is probably wrong, not sure that I can solve it, but I would be happy to help debugging. If I can send you a private message somehow?, I can give you my email address, then you could invite me a inspector member in your project, I could take a look.


stefan8412HOBBY

a year ago

i am using medusa comminity discord channel https://discord.gg/YB3FNcBw , we can chat there


a year ago

You are steve246? I have sent you DM


kanaiyathacker1980TRIAL

a year ago

Not picking the new repository. Pointing to old repository


a year ago

If you are referring to the project pointing to the boilerplate repo and not a repo of your own, this is because railway have changed how templates are deployed. You can watch this video: https://www.youtube.com/watch?v=PyQp5fbXNRk&t=1s&ab_channel=Funkyton to see how to eject from the boilerplate, and get a personal clone


a year ago

Well rpuls, time to make a new video because Railway should eject all services if they are a part of the monorepo.

(change made 04/17/24)


kanaiyathacker1980TRIAL

a year ago

No the project was pointing to one of my repo which I changed to another one and I had to create new service. I will have a look at the video.


a year ago

Yeah just tested, this was not the case despite it being mentioned in the changelog, team is aware of this.

Edit, this is now fixed, ejecting from one service will now eject all services that have the same source as the ejected service!!


devinaiHOBBY

10 months ago

@brody: For this project, I have created below railway.json, but it's not working for me. Please can you suggest whats the issue here?```{ "$schema": "https://railway.app/railway.schema.json", "project": { "name": "my-railway-project" }, "services": [ { "name": "backend", "path": "medusajs-backend", "build": { "builder": "NIXPACKS" }, "deploy": { "runtime": "V2", "numReplicas": 1, "startCommand": "npm run seed:once && npm run start", "sleepApplication": false, "restartPolicyType": "ON_FAILURE", "restartPolicyMaxRetries": 10 }, "env": { "ADMIN_CORS": "http://localhost:7000,http://localhost:7001,${{RAILWAY_PUBLIC_DOMAIN}},${{RAILWAY_PRIVATE_DOMAIN}}", "COOKIE_SECRET": "your_cookie_secret_value", "DATABASE_URL": "${{postgres.DATABASE_URL}}", "JWT_SECRET": "your_jwt_secret_value", "MEDUSA_ADMIN_ONBOARDING_TYPE": "nextjs", "PGDATABASE": "${{postgres.PGDATABASE}}", "PGHOST": "${{postgres.PGHOST}}", "PGPASSWORD": "${{postgres.PGPASSWORD}}", "PGPORT": "${{postgres.PGPORT}}", "PGUSER": "${{postgres.PGUSER}}", "RAILWAY_PRIVATE_DOMAIN_VALUE": "${{RAILWAY_PRIVATE_DOMAIN}}", "RAILWAY_PUBLIC_DOMAIN_VALUE": "${{RAILWAY_PUBLIC_DOMAIN}}", "REDISHOST": "${{redis.REDISHOST}}", "REDISPASSWORD": "${{redis.REDISPASSWORD}}", "REDISPORT": "${{redis.REDISPORT}}", "REDISUSER": "${{redis.REDISUSER}}", "REDIS_URL": "${{redis.REDIS_URL}}" } }, { "name": "frontend", "path": "medusajs-storefront", "build": { "builder": "NIXPACKS" }, "deploy": { "runtime": "V2", "numReplicas": 1, "startCommand": "npm run start", "sleepApplication": false, "restartPolicyType": "ON_FAILURE", "restartPolicyMaxRetries": 10 }, "env": { "DATABASE_URL": "${{postgres.DATABASE_URL}}", "NEXT_PUBLIC_BASE_URL": "https://${{RAILWAY_PUBLIC_DOMAIN}}", "NEXT_PUBLIC_MEDUSA_BACKEND_URL": "https://${{backend.RAILWAY_PUBLIC_DOMAIN_VALUE}}", "PGDATABASE": "${{postgres.PGDATABASE}}", "PGHOST": "${{postgres.PGHOST}}", "PGPASSWORD": "${{postgres.PGPASSWORD}}", "PGPORT": "${{postgres.PGPORT}}", "PGUSER": "${{postgres.PGUSER}}", "REDISHOST": "${{redis.REDISHOST}}", "REDISPASSWORD": "${{redis.REDISPASSWORD}}", "REDISPORT": "${{redis.REDISPORT}}", "REDISUSER": "${{redis.REDISUSER}}", "REDIS_URL": "${{redis.REDIS_URL}}" } }, { "name": "postgres", "type": "postgres", "config": { "version": "13" } }, { "name": "redis", "type": "redis", "config": { "version": "6" } } ] }

```


10 months ago

That's not even remotely a valid railway.json file.

Use the template.


devinaiHOBBY

10 months ago

@brody I want to deploy my custom project, but the setup is having problems, so I thought of giving a file so that it will set up mono repo services along with databases correctly.


devinaiHOBBY

10 months ago

Or can you please share a mono repo project valid railway.json file if its handy? I am working on other such projects but struggling to deploy them, like a UI, backend, and database service.


10 months ago

There is no such thing as a valid railway.json file for a monorepo, a railway.json file can only ever contain configurations for a single service.

Deploy the template, eject from the template, make your desired changes.


cfike000HOBBY

10 months ago

I tried using the template. Everything finishes but it then becomes stuck in an infinite loop saying it's

#12 1.107

#12 131.9 Waiting for a medusajs backend to be available on https://medusajs-backend-production-6e0f.up.railway.app/store/product-categories?expand=category_children... Elapsed time: 0 seconds

This goes on until it times out.

Anyone know anything about how to fix this?


10 months ago

I tried using the template. Everything finishes but it then becomes stuck in an infinite loop saying it's

#12 1.107

#12 131.9 Waiting for a medusajs backend to be available on https://medusajs-backend-production-6e0f.up.railway.app/store/product-categories?expand=category_children... Elapsed time: 0 seconds

This goes on until it times out.

Anyone know anything about how to fix this?

The Waiting for backend ind message indicates that the backend either didn't build succesfully, or isn't running. You are on a trial account? In that case that's why. You need a hobby plan to run cloud code.There are resouces available for this template here: https://funkyton.com/medusajs-free-fully-open-source-ecommerce-solution/The tutorial mentions that at least hobby plan is required.


10 months ago

I can confirm this template works fine on a Hobby plan, but rpuls, it would be great if you could add health checks to the frontend and backend services.


10 months ago

Hey @bordy, could you point me to a resource/example for health checks? Then I will give it a shot ;)



10 months ago

@brody, healthcheck added


10 months ago

Awesome!

This is just nitpicking but could you tidy up the service names, shorter and catchier names like Medusajs-Frontend -> Frontend are more appealing and give a sense of professionalism, same would go for the template name too.

Adding service icons to the frontend and backend services would also be good!


10 months ago

@brody, I do agree with your point. However, I will not be changing the service names, as I have referenced them with screenshots and video recordings in the deployment tutorial. I fear that it could confuse some people following the tutorials if what they see starts to differ too much from what's in the guides. Already, the Railway dashboard has changed a bit since then, which led to some confusion for a few. So, I am trying to keep visual changes to a minimum.


10 months ago

Ah okay, that makes complete sense, no worries at all!

Anyway, I'd like to thank you for putting together higher-quality templates than the official template!


devinaiHOBBY

10 months ago

yeah awesome work @RP


potatoclubsgHOBBY

7 months ago

Thanks for the template, its running perfectly on railway.

I also follow your video and try to run it locally to push changes.

I tried running the storefront and got the following error. Appreciate if anyone can help me out here.

Error [SyntaxError]: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

at JSON.parse (<anonymous>)

at parseJSONFromBytes (eval at requireWithFakeGlobalScope (/Users/Admin/Documents/medusajs-for-railway-boilerplate/medusajs-storefront/node_modules/next/dist/compiled/edge-runtime/index.js:1:655888), <anonymous>:7110:19)

at successSteps (eval at requireWithFakeGlobalScope (/Users/Admin/Documents/medusajs-for-railway-boilerplate/medusajs-storefront/node_modules/next/dist/compiled/edge-runtime/index.js:1:655888), <anonymous>:7081:27)

at eval (eval at requireWithFakeGlobalScope (/Users/Admin/Documents/medusajs-for-railway-boilerplate/medusajs-storefront/node_modules/next/dist/compiled/edge-runtime/index.js:1:655888), <anonymous>:1454:83)


7 months ago

@potatoclubsg which series of commands did you use to run the apps (backend and frontend?)


medusajs ecommerce Nextjs, Postgres, Redis - monorepo - Railway Help Station