From 2c403db09b7f43116a9f43fd789ee8b4a3a408ec Mon Sep 17 00:00:00 2001 From: Aditya41150 Date: Tue, 16 Dec 2025 19:35:38 +0530 Subject: [PATCH 1/5] Add Railway deployment config (nixpacks + rails start) --- .nixpacks.toml | 8 ++++++++ railway.json | 12 ++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 .nixpacks.toml create mode 100644 railway.json diff --git a/.nixpacks.toml b/.nixpacks.toml new file mode 100644 index 00000000..1832c832 --- /dev/null +++ b/.nixpacks.toml @@ -0,0 +1,8 @@ +[phases.setup] +nixPkgs = ["libvips", "postgresql"] + +[phases.build] +cmds = ["bundle install"] + +[phases.start] +cmd = "bundle exec rails db:prepare && bundle exec rails server -b 0.0.0.0 -p $PORT" diff --git a/railway.json b/railway.json new file mode 100644 index 00000000..8b029323 --- /dev/null +++ b/railway.json @@ -0,0 +1,12 @@ + { + "$schema": "https://railway.app/railway.schema.json", + "build": { + "builder": "NIXPACKS" + }, + "deploy": { + "startCommand": "bundle exec rails server -b 0.0.0.0 -p $PORT", + "healthcheckPath": "/", + "restartPolicyType": "ON_FAILURE", + "restartPolicyMaxRetries": 10 + } + } \ No newline at end of file From dae611142cbe657754cca1a549a282b70a367b5c Mon Sep 17 00:00:00 2001 From: Aditya41150 Date: Tue, 16 Dec 2025 19:37:52 +0530 Subject: [PATCH 2/5] Add one-click Railway deployment template --- .railway/template.json | 41 +++++++++++++++++++++++++++++++++++++++++ README.md | 6 ++++++ 2 files changed, 47 insertions(+) create mode 100644 .railway/template.json diff --git a/.railway/template.json b/.railway/template.json new file mode 100644 index 00000000..318eaae5 --- /dev/null +++ b/.railway/template.json @@ -0,0 +1,41 @@ +{ + "name": "Spree Starter", + "description": "Deploy Spree Commerce Starter (Rails) with PostgreSQL, Redis, and Sidekiq on Railway", + "icon": "https://spreecommerce.org/favicon.ico", + "categories": ["ecommerce", "rails", "ruby"], + "services": [ + { + "name": "web", + "source": { + "repo": "Aditya41150/spree_starter" + }, + "variables": { + "RAILS_ENV": "production", + "RAILS_LOG_TO_STDOUT": "true", + "RAILS_SERVE_STATIC_FILES": "true" + } + }, + { + "name": "postgres", + "template": "postgresql" + }, +{ + "name": "redis", + "template": "redis" +}, +{ + "name": "sidekiq", + "source": { + "repo": "YOUR_GITHUB_USERNAME/spree_starter" + }, + "startCommand": "bundle exec sidekiq", + "variables": { + "RAILS_ENV": "production" + } +} + + + ] + + +} diff --git a/README.md b/README.md index f22007ae..086c5445 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,12 @@ Please follow [Spree Quickstart guide](https://spreecommerce.org/docs/developer/ ## Deployment Please follow [Deployment guide](https://spreecommerce.org/docs/developer/deployment/render) to quickly deploy your production-ready Spree application. +git add .railway/template.json README.md +## Deploy on Railway + +You can deploy Spree Starter with PostgreSQL and Redis using Railway. + +[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/XXXX) ## Customizing From 8dbae5fd945b38596e3e04efee16dc0172b97ec1 Mon Sep 17 00:00:00 2001 From: Aditya41150 Date: Tue, 16 Dec 2025 19:44:12 +0530 Subject: [PATCH 3/5] Fix Railway template JSON and add Sidekiq service --- .railway/template.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.railway/template.json b/.railway/template.json index 318eaae5..7affe694 100644 --- a/.railway/template.json +++ b/.railway/template.json @@ -26,7 +26,7 @@ { "name": "sidekiq", "source": { - "repo": "YOUR_GITHUB_USERNAME/spree_starter" + "repo": "Adity41150/spree_starter" }, "startCommand": "bundle exec sidekiq", "variables": { From 4d601043e3be86294cbf11bc2bed6ea231bcbaac Mon Sep 17 00:00:00 2001 From: Aditya41150 Date: Tue, 16 Dec 2025 19:49:59 +0530 Subject: [PATCH 4/5] Remove Railway template JSON and update deployment instructions in README --- .railway/template.json | 41 ----------------------------------------- README.md | 19 ++++++++++++++++--- 2 files changed, 16 insertions(+), 44 deletions(-) delete mode 100644 .railway/template.json diff --git a/.railway/template.json b/.railway/template.json deleted file mode 100644 index 7affe694..00000000 --- a/.railway/template.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "Spree Starter", - "description": "Deploy Spree Commerce Starter (Rails) with PostgreSQL, Redis, and Sidekiq on Railway", - "icon": "https://spreecommerce.org/favicon.ico", - "categories": ["ecommerce", "rails", "ruby"], - "services": [ - { - "name": "web", - "source": { - "repo": "Aditya41150/spree_starter" - }, - "variables": { - "RAILS_ENV": "production", - "RAILS_LOG_TO_STDOUT": "true", - "RAILS_SERVE_STATIC_FILES": "true" - } - }, - { - "name": "postgres", - "template": "postgresql" - }, -{ - "name": "redis", - "template": "redis" -}, -{ - "name": "sidekiq", - "source": { - "repo": "Adity41150/spree_starter" - }, - "startCommand": "bundle exec sidekiq", - "variables": { - "RAILS_ENV": "production" - } -} - - - ] - - -} diff --git a/README.md b/README.md index 086c5445..26da7a09 100644 --- a/README.md +++ b/README.md @@ -30,12 +30,25 @@ Please follow [Spree Quickstart guide](https://spreecommerce.org/docs/developer/ ## Deployment Please follow [Deployment guide](https://spreecommerce.org/docs/developer/deployment/render) to quickly deploy your production-ready Spree application. -git add .railway/template.json README.md ## Deploy on Railway -You can deploy Spree Starter with PostgreSQL and Redis using Railway. +Spree Starter can be deployed on Railway using the built-in Nixpacks support. -[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/XXXX) +### Steps + +1. Go to https://railway.app +2. Click **New Project → Deploy from GitHub Repo** +3. Select this repository +4. Add a **PostgreSQL** plugin +5. Add a **Redis** plugin +6. Set environment variables: + - RAILS_ENV=production + - RAILS_SERVE_STATIC_FILES=true + - RAILS_LOG_TO_STDOUT=true + - SECRET_KEY_BASE=(generate using `rails secret`) +7. Deploy 🚀 + +> Note: Sidekiq runs in the same service by default. For production workloads, you may create a separate Railway service running `bundle exec sidekiq`. ## Customizing From 8708470b82980752108a69e839926fb90dd0d083 Mon Sep 17 00:00:00 2001 From: Aditya41150 Date: Tue, 16 Dec 2025 20:05:11 +0530 Subject: [PATCH 5/5] Fix Railway start command to run db:prepare before boot --- .nixpacks.toml | 3 --- railway.json | 24 ++++++++++++------------ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.nixpacks.toml b/.nixpacks.toml index 1832c832..cf5a6323 100644 --- a/.nixpacks.toml +++ b/.nixpacks.toml @@ -3,6 +3,3 @@ nixPkgs = ["libvips", "postgresql"] [phases.build] cmds = ["bundle install"] - -[phases.start] -cmd = "bundle exec rails db:prepare && bundle exec rails server -b 0.0.0.0 -p $PORT" diff --git a/railway.json b/railway.json index 8b029323..fe1dca85 100644 --- a/railway.json +++ b/railway.json @@ -1,12 +1,12 @@ - { - "$schema": "https://railway.app/railway.schema.json", - "build": { - "builder": "NIXPACKS" - }, - "deploy": { - "startCommand": "bundle exec rails server -b 0.0.0.0 -p $PORT", - "healthcheckPath": "/", - "restartPolicyType": "ON_FAILURE", - "restartPolicyMaxRetries": 10 - } - } \ No newline at end of file +{ + "$schema": "https://railway.app/railway.schema.json", + "build": { + "builder": "NIXPACKS" + }, + "deploy": { + "startCommand": "bundle exec rails db:prepare && bundle exec rails server -b 0.0.0.0 -p $PORT", + "healthcheckPath": "/", + "restartPolicyType": "ON_FAILURE", + "restartPolicyMaxRetries": 10 + } +}