onebusaway-application-modules icon indicating copy to clipboard operation
onebusaway-application-modules copied to clipboard

Implement Docker Support for Simplified Development Environment Setup

Open aaronbrethorst opened this issue 11 months ago • 3 comments

Why Docker?

Our current development setup for OBA presents several challenges that can hinder productivity and create barriers for new contributors. These challenges include:

  • Complex Dependency Management: The app requires a specific set of dependencies, which can vary across development environments. This often leads to the "works on my machine" problem, where the app runs on one developer's machine but not on another's due to slight differences in the environment or installed versions.
  • Time-Consuming Setup: Setting up the development environment from scratch involves multiple steps, including installing Java, Spring dependencies, and other tools. This process is not only time-consuming but also prone to errors, leading to further delays.
  • Database Integration: The app needs to be connected to a database for development and testing. Setting up a local database and configuring the app to connect to it can be complicated and error-prone, especially for new developers or when switching between projects.
  • Environment Consistency: Ensuring a consistent development environment across all team members and CI/CD pipelines is crucial for eliminating bugs that occur due to environment discrepancies. However, achieving this consistency manually is challenging.

How Docker Can Help

Docker can address these challenges by containerizing the application and its environment. With Docker, we can:

  • Ensure Environment Consistency: Docker containers package the application along with its environment and dependencies, ensuring that it runs the same way on every machine.
  • Simplify Setup: Developers can get started with just Docker installed on their machine, without the need to manually install and configure various dependencies.
  • Streamline Database Integration: Using docker-compose, we can define and run multi-container Docker applications, including our app and its database, with simple commands.
  • Facilitate Development and Testing: Docker makes it easy to spin up isolated instances of the application for development, testing, and debugging, without affecting the local machine's setup.

Task: Create Dockerfile and docker-compose.yaml

Objective

Create a Dockerfile and docker-compose.yaml for our Java Spring web app to containerize the application and its dependencies, including the database, to streamline the development and deployment process.

Starting Points

Dockerfile: Begin by creating a Dockerfile in the root of the project. This file will specify the base image (e.g., a Java image), the application's dependencies, and how to build and run the application.

docker-compose.yaml file: Create a docker-compose.yaml file to define how our app container interacts with other services, like a database.

Assistance:

  • You can (and definitely should) use the build and run guide to help you kickstart this process. Note: there are definitely some elements of that guide that are out of date. Don't be surprised when something doesn't work and you need to troubleshoot it.
  • You should also investigate the work that has already been done to containerize the built and published project binaries. You'll find many answers to your questions in there: https://github.com/onebusaway/onebusaway-docker

Expected Outcome

  • A Dockerfile that defines the environment and instructions to build and run our Java Spring web app inside a Docker container.
  • A docker-compose.yaml file that orchestrates the app and its database, ensuring they can be spun up together with minimal setup.
  • Documentation in the README.md on how to use Docker to set up, run, and debug the project.

Acceptance Criteria

  • The Dockerfile and docker-compose.yaml should be tested to ensure they work correctly.
  • Documentation must be clear and concise, allowing new developers to get started with the project quickly using Docker.
  • Debugging does not have to work in every IDE imaginable, but you should pick 1 or 2 IDEs that existing OBA server developers use regularly.
  • Ensure that the application, when run through Docker, functions identically to its non-Dockerized counterpart, including database interactions and transit bundle-loading.

This Docker integration will make our development process more efficient, reduce setup time, and eliminate environment-specific issues, leading to a smoother and more consistent development experience for all team members.

aaronbrethorst avatar Feb 26 '24 04:02 aaronbrethorst

Hey @aaronbrethorst I am interested in solving this issue. Also is this related to the project idea 'OBA Server - Containerize development and deployment" for GSoC 2024 or is an independent issue. Thank you

VivekJaiswal18 avatar Feb 26 '24 07:02 VivekJaiswal18

@VivekJaiswal18 it is related to the GSoC project idea you mentioned.

aaronbrethorst avatar Feb 28 '24 22:02 aaronbrethorst

@aaronbrethorst Can I get to know more details about this idea? IMO there is need to add some more context of this idea in GSOC-2024 Ideas List.

Saturn225 avatar Mar 02 '24 14:03 Saturn225