Next.js and Rails on Aloof: two stacks, one workflow
What aloof launch generates for a Next.js app and a Rails app, where the two differ (build output, assets, migrations), and the settings worth changing.
Next.js and Rails sit at opposite ends of the framework spectrum, but on Aloof the loop is the same: aloof launch, review two files, aloof deploy. This post shows what's generated and why.
Next.js
launch recognises Next.js from next in package.json, picks your package manager from the lockfile (npm, pnpm, yarn or bun), and generates:
FROM node:20-slim WORKDIR /app ENV NODE_ENV=production PORT=8080 HOSTNAME=0.0.0.0 COPY . . RUN NODE_ENV=development npm ci || npm install RUN npm run build EXPOSE 8080 CMD ["npm","run","start"]
Two details matter. Dev dependencies are installed so next build works, and HOSTNAME=0.0.0.0 makes next start listen on all interfaces rather than localhost. For smaller images, switch to Next's output: "standalone" and a two-stage Dockerfile; Aloof builds whatever Dockerfile you commit.
If your Next.js app talks to a backend on Aloof, call it over the private network (http://api.internal:8080) from server components and route handlers. That traffic never leaves the host. See private networking.
Rails
A Gemfile containing rails produces a ruby:3.3-slim image with build tools and libpq, bundle install without development and test groups, and a best-effort assets:precompile. It also sets a release command:
[deploy] release_command = "bin/rails db:migrate"
Set your secrets once, staged so you deploy only once:
aloof secrets set RAILS_MASTER_KEY=$(cat config/master.key) --stage aloof pg create shop-db && aloof pg attach shop-db shop aloof secrets deploy
Background jobs go in [processes] (for example worker = "bundle exec sidekiq" or "bin/jobs" for Solid Queue), and recurring tasks in [[cron]].
Same workflow, same guarantees
- Builds run remotely;
.dockerignoreis respected when the directory is uploaded. - The release command runs before new instances start; a failure keeps the old release live.
- Every deploy is a numbered release you can roll back to without rebuilding.
Full walkthroughs: Next.js guide, Rails guide.