A simple Ruby on Rails application published as a sample deployment project for Nife.io.
This repository demonstrates how to run a lightweight Rails application locally, package it with Docker, and deploy it on Nife.io. It is intended as a practical sample for validating Rails deployment workflows, container-based delivery, and basic platform configuration.1 2 3
# Rails Example
A simple **Ruby on Rails** application published as a **sample deployment project for [Nife.io](https://nife.io)**.
This repository demonstrates how to run a lightweight Rails application locally, package it with Docker, and deploy it on [Nife.io](https://nife.io). It is intended as a practical sample for testing Rails deployment workflows and showcasing a straightforward Ruby on Rails deployment path.
## Overview
This project is a basic Rails application with a standard project structure, backend logic, and database integration through Active Record. It is designed to be small enough for learning and deployment experiments while still reflecting the conventions of a real Rails application.[3]
If you want a simple backend-oriented sample to test deployment on [Nife.io](https://nife.io), this repository is a good starting point.
## Features
| Feature | Description |
| --- | --- |
| Ruby on Rails app | Built with the standard Rails application structure |
| MVC architecture | Uses the conventional Rails model-view-controller pattern |
| Database integration | Supports database-backed application workflows through Active Record |
| Docker support | Includes a `Dockerfile` for containerized execution |
| Deployment-ready setup | Can be deployed using Git-based or Docker-based workflows |
| Nife.io sample use case | Suitable as a reference project for [Nife.io](https://nife.io) deployments |
## Tech Stack
| Technology | Purpose |
| --- | --- |
| Ruby | Runtime environment |
| Ruby on Rails | Web framework |
| Bundler | Dependency management |
| SQLite or PostgreSQL | Database layer, depending on configuration |
| Docker | Container packaging |
| Nife.io | Deployment platform |
## Prerequisites
Before running the project locally, make sure the following are installed.
| Requirement | Notes |
| --- | --- |
| Ruby | Use the version specified in `.ruby-version` |
| Bundler | Required to install Ruby gems |
| Rails | Required for Rails commands |
| Database | SQLite or PostgreSQL depending on your environment |
| Git | Required to clone the repository |
## Getting Started
### Clone the repository
```bash
git clone https://github.com/nifetency/rails-example.git
cd rails-examplebundle installrails db:create
rails db:migraterails serverThen open the application at http://localhost:3000.
This project includes a Dockerfile for container-based execution.
docker build -t rails-example .docker run -p 3000:3000 rails-exampleAfter the container starts, open the app at http://localhost:3000.
You can deploy this application on Nife.io using either a Docker image, the source repository, or the CLI.1 2
First, build and push the image to your preferred container registry.
docker build -t rails-example .
docker tag rails-example <username>/rails-example:latest
docker push <username>/rails-example:latestThen configure a new application in Nife.io with the following settings.
| Setting | Value |
|---|---|
| Source | Docker Image |
| Registry | Docker Hub or another supported registry |
| Image | <username>/rails-example:latest |
| Internal Port | 3000 |
| External Port | 80 |
| Suggested Replicas | 1 |
You can also deploy the project directly from GitHub.
| Setting | Value |
|---|---|
| Source | Git Repository |
| Provider | GitHub |
| Branch | main |
| Internal Port | 3000 |
| External Port | 80 |
| Build Mode | Auto-Dockerize with runtime |
If you prefer the command line, use the following workflow.
nifectl auth login
nifectl init
nifectl deployFor step-by-step instructions, see the Nife.io Quick Deploy documentation and the nifectl quick start guide.
The following variables are commonly relevant for deployment.
| Variable | Description | Example |
|---|---|---|
RAILS_ENV |
Rails execution environment | production |
DATABASE_URL |
Database connection string | postgres://user:pass@host/db |
PORT |
Application port, if overridden by environment | 3000 |
| Path | Purpose |
|---|---|
app/ |
Main Rails application code |
config/ |
Framework and environment configuration |
db/ |
Database schema and migrations |
lib/ |
Library and support code |
public/ |
Static public assets |
test/ |
Test files |
Dockerfile |
Container build instructions |
Gemfile |
Ruby gem dependencies |
config.ru |
Rack configuration entry point |
| Issue | Suggested fix |
|---|---|
| Bundler install fails | Verify your Ruby version and rerun bundle install |
| Database is not created | Run rails db:create db:migrate |
Port 3000 is already in use |
Stop the conflicting process or remap the port |
| Docker build fails | Recheck the Dockerfile and local Ruby environment |
| Deployment fails on Nife.io | Verify ports, environment variables, and build settings |
| Application is unreachable | Check routing, service exposure, and deployment logs |
This repository is maintained by Nifetency as a sample deployment project for Nife.io.
If this repository is derived from an earlier template or upstream example, it is good practice to retain visible credit to the original author or source repository.
This project is licensed under the MIT License.