Skip to content

iamonah/rideshare

Repository files navigation

Ride-Sharing Microservices Platform

This repository contains a ride-sharing platform built with a microservices architecture. The current workspace includes Go services, a Next.js web client, local Kubernetes development with Tilt, and production deployment assets for selected services.

Architecture

Trip Scheduling Flow

Repository Components

  • services/apigateway: HTTP and WebSocket gateway
  • services/trip-service: trip orchestration and trip domain logic
  • services/driver-service: driver-related backend service
  • web: Next.js frontend
  • infra/deploy/development: local Kubernetes and Docker assets used by Tilt
  • infra/deploy/production: production Dockerfiles and Kubernetes manifests currently available in this repository

Prerequisites

Install the following tools before starting the local environment:

  • Docker
  • Go
  • Tilt
  • kubectl
  • A local Kubernetes cluster such as Minikube or Docker Desktop Kubernetes

macOS

  1. Install Homebrew.
  2. Install Docker Desktop.
  3. Install Minikube.
  4. Install Tilt.
  5. Install Go:
brew install go
  1. Install kubectl.

Windows (WSL)

Use WSL for the local development workflow.

  1. Install WSL.
  2. Install Docker Desktop.
  3. Install Minikube.
  4. Install Tilt.
  5. Install Go inside WSL:
wget https://dl.google.com/go/go1.23.0.linux-amd64.tar.gz
sudo tar -xvf go1.23.0.linux-amd64.tar.gz
sudo mv go /usr/local
  1. Add Go to your shell configuration:
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
  1. Reload your shell and verify the installation:
go version
  1. Install kubectl.

Local Development

Start the development environment with Tilt:

tilt up

Monitor workloads with:

kubectl get pods

Or open the Minikube dashboard:

minikube dashboard

Production Deployment Example (Google Cloud)

This section describes a manual deployment flow to Google Cloud. It is best used as a reference before formalizing the process in CI/CD.

1. Set environment variables

export REGION="europe-west1"
export PROJECT_ID="<your-gcp-project-id>"

2. Build production images

The production Dockerfiles currently present in this repository are:

docker build -t ${REGION}-docker.pkg.dev/${PROJECT_ID}/ride-sharing/api-gateway:latest --platform linux/amd64 -f infra/deploy/production/docker/api-gateway.Dockerfile .
docker build -t ${REGION}-docker.pkg.dev/${PROJECT_ID}/ride-sharing/trip-service:latest --platform linux/amd64 -f infra/deploy/production/docker/trip-service.Dockerfile .

3. Create an Artifact Registry repository

Create a Docker repository in Google Cloud Artifact Registry to store the built images.

4. Push the images

docker push ${REGION}-docker.pkg.dev/${PROJECT_ID}/ride-sharing/api-gateway:latest
docker push ${REGION}-docker.pkg.dev/${PROJECT_ID}/ride-sharing/trip-service:latest

If authentication fails:

  1. Run gcloud auth login and select the correct project.
  2. Configure Docker authentication:
gcloud auth configure-docker ${REGION}-docker.pkg.dev

5. Create a GKE cluster

Create a Google Kubernetes Engine cluster either through the gcloud CLI or the Google Cloud Console.

6. Connect to the cluster

gcloud container clusters get-credentials ride-sharing --region ${REGION} --project ${PROJECT_ID}

7. Update image references in the manifests

The production manifests under infra/deploy/production/k8s use {{PROJECT_ID}} placeholders. Replace those placeholders before applying the manifests.

8. Apply the manifests

kubectl apply -f infra/deploy/production/k8s/app-config.yaml
kubectl apply -f infra/deploy/production/k8s/trip-service-deployment.yaml
kubectl apply -f infra/deploy/production/k8s/api-gateway-deployment.yaml

For redeployments:

kubectl apply -f infra/deploy/production/k8s
kubectl rollout restart deployment

9. Verify service exposure

Retrieve the external address for the API gateway:

kubectl get services

To switch back to your local Kubernetes context:

kubectl config get-contexts

# Docker Desktop
kubectl config use-context docker-desktop

# Minikube
kubectl config use-context minikube

About

RideShare is a backend-driven microservice ride-hailing application that enables real-time ride requests, driver matching, and trip tracking using event-based communication.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors