rideshare
rideshare copied to clipboard
Add Dev Containers Docker Development Environment
Summary
This pull request introduces a comprehensive Docker-based development environment for the Rideshare application, enhancing developer productivity and ensuring a consistent setup across various environments. Key features include DevContainers configuration, PostgreSQL setup, and automatic database initialization.
Changes
-
DevContainer Configuration:
- Added
.devcontainer/devcontainer.json
to define the development container environment. - Configured the development container to use Docker Compose for service orchestration.
- Added
-
Docker Compose Integration:
- Created
compose.yml
to define services for the application and PostgreSQL. - Ensured the PostgreSQL service uses version 16 for compatibility with new features.
- Created
-
Environment Setup:
- Configured environment variables in
devcontainer.json
for database connections.
- Configured environment variables in
-
Database Configuration:
- Used Docker Compose to pass PostgreSQL configuration parameters directly, avoiding the need for a custom scripts.
Benefits
- Consistency: Ensures a consistent development environment across different machines and setups.
- Productivity: Reduces the time required for environment setup.
- Flexibility: Supports customization of PostgreSQL configurations directly via Docker Compose.
How to Test
- Clone the repository and checkout the branch.
- Ensure Docker and Docker Compose are installed on your system.
- Run the commands described in the README, to build and start the services.
- Verify the PostgreSQL container is running with the correct configurations.
- Confirm that the application container initializes correctly and that the database setup script runs without issues.
References
Remarks
I recently started reading the book "High Performance PostgreSQL for Rails" (thanks a lot for the great book! 🥇) and was disappointed to find that I had to spend hours setting up the environment before I could start working on the exercises.
This pull request aims to streamline the setup process, allowing you to get started more quickly. However, please note that I have not tested all features yet, as I have only reached the section where I need to create millions of rows in the database.
This PR is just the first step, from which we could start to improve the setup.