@@ -21,7 +21,7 @@ Clone the codebase
2121git clone [email protected] :rubyforgood/skillrx.git 2222```
2323
24- Run the setup script to prepare DB and assets
24+ Run the setup script to prepare the DB and assets
2525``` sh
2626bin/setup
2727```
@@ -73,3 +73,88 @@ This project uses:
7373* ` factory_bot ` for making records
7474
7575To run tests simply use ` bin/rspec ` . You can also you ` bin/quality ` to check for code style issues.
76+
77+ # Docker Development Environment
78+
79+ This project is containerized using Docker to ensure consistent development environments across the team.
80+
81+ ## Prerequisites
82+
83+ - Docker Engine installed on your system
84+ - Docker Compose V2 or later
85+
86+ ## Initial Setup
87+
88+ 1 . Copy the environment configuration file:
89+ ``` bash
90+ cp .env.example .env
91+ ```
92+ 2 . Configure the environment variables in .env according to your needs. These variables control the behavior of the containerized services.
93+
94+ 3 . Build and start the containers:
95+ ``` bash
96+ docker compose up
97+ ```
98+
99+ This will build the images and initialise the containers. You can exit and stop the containers using CTRL+C.
100+
101+ # # Container Architecture
102+ The development environment consists of three containerized services:
103+
104+ * app : Rails application service
105+ * Handles the main application logic
106+ * Runs on Ruby on Rails
107+ * db : PostgreSQL database service
108+ * Persists application data
109+ * Runs independently from the application
110+ * localstack : AWS S3 emulator
111+ * Provides local S3-compatible storage
112+ * Enables development without actual AWS setup
113+
114+ # # Development Workflow
115+
116+ We provide a Makefile to simplify common development tasks. Here are the most frequently used commands:
117+ ```
118+ make build # Build image containers
119+ make start [ service] # Start all containers or a specific service
120+ make stop [ service] # Stop all containers or a specific service
121+ make shell # Open a bash shell in the app container
122+ make console # Start Rails console
123+ make test # Run all tests
124+ ```
125+
126+ For a complete list of available commands:
127+ ```bash
128+ make help
129+ ```
130+
131+ ## Common Tasks
132+ ### Rebuilding the Environment
133+ To completely rebuild your development environment:
134+
135+ ``` bash
136+ make rebuild
137+ ```
138+ This command will clean existing containers, rebuild images, and prepare the database.
139+
140+ ### Viewing Logs
141+ To monitor service logs:
142+ ```
143+ make logs # View all container logs
144+ make logs app # View only Rails application logs
145+ ```
146+
147+ ### Container Management
148+ Individual services can be managed using:
149+ ```
150+ make start db # Start only the database container
151+ make stop app # Stop only the application container
152+ make restart db # Restart only the database container
153+ ```
154+
155+ ### Troubleshooting
156+ If you encounter issues:
157+ - Ensure all required ports are available on your system
158+ - Verify that your .env file contains all necessary variables
159+ - Try rebuilding the environment with make rebuild
160+ - Check container logs for specific error messages
0 commit comments