Ruby 3.4 with Rails 8 on Ubuntu 24.04 LTS. Puma, nginx, PostgreSQL 16, scaffolded starter app, per VM SECRET_KEY_BASE and admin password at first boot.
## Ruby 3.4 with Rails 8 on Ubuntu 24.04 LTS by cloudimg
Pre configured Ruby 3.4 with Rails 8.0 on Ubuntu 24.04 LTS, purpose built for Microsoft Azure and maintained by cloudimg. Production stack with Puma 6 as the Rails app server bound to a Unix socket, nginx as reverse proxy and asset server, and PostgreSQL 16 as the default database. Ships with a cloudimg starter Rails project including a scaffolded Article model so the root path serves a working CRUD UI within seconds of first boot.
Why Choose cloudimg?
* 24/7 Expert Support Guaranteed 24 hour response, one hour average for critical issues. support@cloudimg.co.uk
* Production Ready from Launch Pre configured, security patched, validated before publication
* Azure Native Integration Azure Linux Agent, cloud init, Gen2 Hyper V with UEFI boot
* Per VM Auth Wall SECRET_KEY_BASE (64 hex), DB password (32 hex), and Admin password (32 hex) all rotated at first boot, written to /stage/scripts/rails-credentials.log mode 0600 root only
What is Included
* Ruby 3.4 from the Brightbox PPA ppa:brightbox/ruby-ng (canonical modern Ruby PPA for Ubuntu LTS)
* Bundler 2.6 + Rails 8.0 installed system wide via gem install
* Pre created cloudimg starter Rails project at /opt/rails/cloudimg with a scaffolded Article model (title, body) so / and /articles serve a working CRUD UI immediately
* Simple Admin model with has_secure_password (bcrypt) seeded with the per VM admin user at first boot
* Puma 6 as Rails app server bound to a Unix socket at /run/puma/cloudimg.sock with env driven workers and threads
* nginx as reverse proxy on TCP 80 and asset server for /assets/ from public/assets/
* PostgreSQL 16 from Ubuntu noble main, pre provisioned with a cloudimg role and cloudimg_production database
* libpq-dev for the pg gem and Node.js for asset compilation
* RAILS_ENV=production, RAILS_LOG_TO_STDOUT=true, RAILS_SERVE_STATIC_FILES=true, DATABASE_URL driven from /etc/rails/cloudimg.env
* Three systemd units: puma.service, nginx.service, postgresql.service plus rails-firstboot.service that rotates secrets, creates the postgres role and DB, runs db:migrate and assets:precompile, and seeds the admin user
* The puma unit wraps ExecStart in /bin/bash -c so env defaults like ${PUMA_WORKERS:-2} expand correctly at runtime (systemd does not expand bash defaults under raw Exec lines)
* Ubuntu 24.04 LTS base with latest security patches at build time
Use Cases
* Internal Rails applications and admin dashboards
* SaaS backends behind a load balancer or Azure Application Gateway
* CRUD APIs and JSON services using Action Controller or the Rails 8 API mode
* Migration target for legacy Rails 6 or Rails 7 applications onto a current LTS Ruby + Rails stack
* Fresh starting point for greenfield Rails 8 projects with PostgreSQL 16 already wired
Getting Started
1. Deploy from the Azure Marketplace
2. SSH as azureuser, sudo cat /stage/scripts/rails-credentials.log for the URL and admin password
3. Browse to http://your-public-ip/ and the Articles index renders immediately
4. Browse to http://your-public-ip/articles to create, read, update and delete records
5. Restrict NSG inbound on 80 to trusted IPs
6. Drop your Rails app into /opt/rails/cloudimg or replace the starter project with your own
7. Tune /etc/rails/cloudimg.env for SECRET_KEY_BASE, DATABASE_URL, PUMA_WORKERS, PUMA_THREADS_MIN, PUMA_THREADS_MAX
Technical Specifications
* Ruby 3.4 (Brightbox PPA ppa:brightbox/ruby-ng)
* Rails 8.0
* Bundler 2.6
* Puma 6 bound to /run/puma/cloudimg.sock
* nginx reverse proxy + asset server on TCP 80
* PostgreSQL 16, role cloudimg, db cloudimg_production
* Project root: /opt/rails/cloudimg, owned by the rails system user
* Service: systemd (puma.service, nginx.service, postgresql.service, rails-firstboot.service)
* Recommended Size: Standard_B2s
* VM Generation: Hyper V Gen2 with UEFI boot
Security Model
* Per VM SECRET_KEY_BASE generated at first boot (64 hex chars, openssl rand -hex 32)
* Per VM PostgreSQL password generated at first boot (32 hex chars), DB on loopback only
* Per VM Admin password generated at first boot (32 hex chars), stored as a bcrypt digest in the admins table
* RAILS_ENV=production with default Rails security headers and CSRF protection
* nginx exposes only TCP 80; customers terminate TLS upstream or install certbot for Let's Encrypt
Support
cloudimg provides 24/7/365 expert technical support. Contact support@cloudimg.co.uk.
Visit www.cloudimg.co.uk/guides/ruby-3-on-ubuntu-24-04-azure for the full user guide.
Ruby on Rails is a registered trademark of David Heinemeier Hansson. This image is a repackaged upstream distribution provided by cloudimg. Additional charges apply for build, maintenance, and 24/7 support.