You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To run tests simply use `bin/rspec`. You can also you `bin/quality` to check for code style issues.
75
+
To run tests, simply use `bin/rspec`. You can also use `bin/quality` to check for code style issues.
76
+
77
+
# Docker Development Environment
78
+
79
+
This project is containerised 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
+
```
90
+
cp .env.example .env
91
+
```
92
+
93
+
2. Configure the environment variables in `.env` as needed. These variables set up the containerised services. Update the `.env.example` file with any new or changed variables.
94
+
95
+
3. To view the uploaded files from http://localstack:4566 in your browser, add the following line to your `/etc/hosts` to resolve `localstack` to your host system:
96
+
```
97
+
127.0.0.1 localstack
98
+
```
99
+
100
+
4. Build and start the containers:
101
+
```
102
+
docker compose up
103
+
```
104
+
105
+
This will build the images and initialise the containers. You can exit and stop the containers using CTRL+C.
106
+
107
+
## Container Architecture
108
+
The development environment consists of three containerised services:
109
+
110
+
* app : Rails application service
111
+
* Handles the main application logic
112
+
* Runs on Ruby on Rails
113
+
* db : PostgreSQL database service
114
+
* Persists application data
115
+
* Runs independently from the application
116
+
* localstack : AWS S3 emulator
117
+
* Provides local S3-compatible storage
118
+
* Enables development without actual AWS setup
119
+
120
+
## Development Workflow
121
+
122
+
We provide a Makefile to simplify common development tasks. Here are the most frequently used commands:
123
+
```
124
+
make build # Build image containers
125
+
make start [service] # Start all containers or a specific service
126
+
make stop [service] # Stop all containers or a specific service
127
+
make shell # Open a bash shell in the app container
128
+
make console # Start Rails console
129
+
make test # Run all tests
130
+
```
131
+
132
+
For a complete list of available commands:
133
+
```bash
134
+
make help
135
+
```
136
+
137
+
## Common Tasks
138
+
### Rebuilding the Environment
139
+
To completely rebuild your development environment:
140
+
141
+
```bash
142
+
make rebuild
143
+
```
144
+
This command will clean existing containers, rebuild images, and prepare the database.
145
+
146
+
### Viewing Logs
147
+
To monitor service logs:
148
+
```
149
+
make logs # View all container logs
150
+
make logs app # View only Rails application logs
151
+
```
152
+
153
+
### Container Management
154
+
Individual services can be managed using:
155
+
```
156
+
make start db # Start only the database container
157
+
make stop app # Stop only the application container
158
+
make restart db # Restart only the database container
159
+
```
160
+
161
+
### Troubleshooting
162
+
If you encounter issues:
163
+
- Ensure all required ports are available on your system
164
+
- Verify that your .env file contains all necessary variables
165
+
- Try rebuilding the environment with make rebuild
166
+
- Check container logs for specific error messages
0 commit comments