rideshare icon indicating copy to clipboard operation
rideshare copied to clipboard

Add Dev Containers Docker Development Environment

Open viktorianer opened this issue 7 months ago • 3 comments

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

  1. DevContainer Configuration:

    • Added .devcontainer/devcontainer.json to define the development container environment.
    • Configured the development container to use Docker Compose for service orchestration.
  2. 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.
  3. Environment Setup:

    • Configured environment variables in devcontainer.json for database connections.
  4. 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

  1. Clone the repository and checkout the branch.
  2. Ensure Docker and Docker Compose are installed on your system.
  3. Run the commands described in the README, to build and start the services.
  4. Verify the PostgreSQL container is running with the correct configurations.
  5. 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.

viktorianer avatar Jun 25 '24 17:06 viktorianer