diff --git a/.nixpacks.toml b/.nixpacks.toml new file mode 100644 index 00000000..cf5a6323 --- /dev/null +++ b/.nixpacks.toml @@ -0,0 +1,5 @@ +[phases.setup] +nixPkgs = ["libvips", "postgresql"] + +[phases.build] +cmds = ["bundle install"] diff --git a/README.md b/README.md index f22007ae..26da7a09 100644 --- a/README.md +++ b/README.md @@ -30,6 +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. +## Deploy on Railway + +Spree Starter can be deployed on Railway using the built-in Nixpacks support. + +### 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 diff --git a/railway.json b/railway.json new file mode 100644 index 00000000..fe1dca85 --- /dev/null +++ b/railway.json @@ -0,0 +1,12 @@ +{ + "$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 + } +}