Skip to content

OperationsPAI/train-ticket

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

551 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Train Ticket: A New Version

Introduction

The legacy version of Train Ticket had become outdated and lacked active maintenance. To address this, we've built a new, modernized version with improved functionality, streamlined processes, and enhanced observability.

What's New

  • Simplified Development and Deployment: The development workflow now fully integrates with Kubernetes (k8s) and Helm, making setup and deployment more straightforward.
  • Pruned Redundancies: We've removed outdated or unnecessary components to improve efficiency and reduce complexity.
  • Enhanced Monitoring: Robust monitoring is now built-in, with support for tools like SkyWalking, OpenTelemetry, APO, providing deep insights into system performance.

Prerequisites

Before you begin, ensure you have the following tools installed:

  1. Helm: For managing Kubernetes applications.
  2. Skaffold: For building Docker images.
  3. Minikube: For running a local Kubernetes cluster (optional for local development).
  4. Docker: For building container images.
  5. JDK and Maven: For building the Java-based project. (JDK 8 or 17 is recommended; ensure your JAVA_HOME is set correctly.)
    • You can check your Java version with:
      java -version
    • Maven can be installed via package managers or downloaded from the Apache Maven website.

You’ll also need access to a container registry (e.g., Docker Hub, a private registry) to push and pull images.

Development Guide

Follow these steps to build the project:

  1. Build the Project:

    mvn clean package -Dmaven.test.skip=true
  2. Build Docker Images with Skaffold:

    skaffold build --default-repo=<your-registry>
    • Replace <your-registry> with a registry you have push access to (e.g., docker.io/yourusername, gcr.io/yourproject).
    • Example: skaffold build --default-repo=docker.io/myuser.
    • This builds and pushes images to the specified registry.

Deployment Instructions

Before deploying the application, you must build the Helm dependencies:

  1. Build Helm Dependencies:

    helm dependency build manifests/helm/generic_service

    This step is mandatory and will fetch all required dependencies specified in Chart.yaml (mysql, postgresql, rabbitmq, etc.).

  2. Basic Deployment with Specific Image Tag:

# alter: use the published helm chart
helm repo add train-ticket https://lgu-se-internal.github.io/train-ticket
helm repo update
helm search repo train-ticket
helm install ts manifests/helm/generic_service -n ts --create-namespace \
   --set global.monitoring=opentelemetry \
   --set skywalking.enabled=false \
   --set global.image.tag=3384da1c
  • ts: Release name (customizable).
  • -n ts: Namespace (created if it doesn’t exist).
  • --set: Customizes deployment options (e.g., monitoring type, image tag).
  1. Using Custom Image Registry:

    helm install ts manifests/helm/generic_service -n ts --create-namespace \
      --set global.monitoring=opentelemetry \
      --set skywalking.enabled=false \
      --set global.image.tag=latest \
      --set global.image.repository=registry.cn-shenzhen.aliyuncs.com/lincyaw
  2. Advanced Example (with APO): To enable specific configurations (e.g., nodePort for UI):

    helm upgrade ts manifests/helm/generic_service -n ts-dev --create-namespace \
      --set global.monitoring=opentelemetry \
      --set opentelemetry.enabled=false \
      --set services.tsUiDashboard.nodePort=30081 \
      --set global.image.tag=310a67e0
  3. Uninstall: To remove the deployment:

    helm uninstall ts -n ts

Note: If you change the release name, you must also update the values.yaml file accordingly. For instance, when disabling the PostgreSQL component for demo purposes (not recommended for production), ensure you configure the host to match your PostgreSQL service's hostname, as shown below:

postgresql:
  enabled: false # To disable the demo PostgreSQL deployment (not for production use).
  config:
    # Specify your PostgreSQL service's hostname (effective when postgresql.enabled is false).
    host: ts-postgresql # Important: Update this to match your service name!
  auth:

This new version is designed to offer a more streamlined, efficient, and powerful solution for managing train ticket services, leveraging the latest in technology and best practices.

About

Train Ticket - A Benchmark Microservice System

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 39.5%
  • JavaScript 32.3%
  • HTML 23.9%
  • CSS 1.8%
  • Python 1.0%
  • Dockerfile 0.7%
  • Other 0.8%