This document includes step-by-step instructions for configuring the Rails application and MySQL database.
Run the following commands to clone the application source code:
git clone <repository-url>
cd new_Rails
To build the container image for the Rails application using Podman, run:
podman build -t new_rails -f Podmanfile .
This installs all necessary dependencies, including Ruby, Bundler, and associated gem libraries.
Establish a custom network for the application and database communication:
podman network create my-network
Deploy the MySQL database container with:
podman run -d --name mysql-server \
--network my-network \
-e MYSQL_ROOT_PASSWORD=your_password \
-e MYSQL_DATABASE=your_app_development \
-p 3307:3306 \
mysql:latest
Access Credentials:
- Username:
root
- Password:
your_password
- Database:
your_app_development
Update the config/database.yml
file with:
default: &default
adapter: mysql2
encoding: utf8mb4
pool: 5
username: root
password: your_password
host: mysql-server # MySQL container hostname
port: 3306
development:
<<: *default
database: your_app_development
test:
<<: *default
database: your_app_test
Start the Rails application container within the established network:
podman run -d --rm --name my-new-app \
--network my-network \
-v $(pwd):/app -p 3000:3000 new_rails
The application will be accessible at http://localhost:3000.
-
Access the running Rails container:
podman exec -it my-new-app bash
-
Run database setup commands:
rails db:create rails db:migrate
- Open
http://localhost:3000
in your web browser. - Perform CRUD operations within the TODO list interface.
To stop running containers:
podman stop my-new-app
podman stop mysql-server
To remove containers permanently:
podman rm my-new-app
podman rm mysql-server
- Ensure the Rails container is running:
podman ps
- Check Rails logs for errors:
podman logs my-new-app
docker-compose build
docker-compose up