Skip to content

Latest commit

 

History

History
109 lines (73 loc) · 2.46 KB

File metadata and controls

109 lines (73 loc) · 2.46 KB

Refty Node Versions Service

This microservice automates the process of updating container image versions in Kubernetes deployment YAML files stored in a GitHub repository.

It receives a POST request with an image name and a new version tag, updates all relevant YAML files, commits the changes, and pushes them to the repository.


🚀 Features

  • REST API with /update-image endpoint
  • Automatic update of image versions in YAML files
  • Single commit with all changes
  • GitHub integration using Personal Access Token (PAT)
  • Optional Docker support for containerized deployment

🧰 Tech Stack

  • Python 3.10
  • Flask
  • GitPython
  • Docker (optional)
  • GitHub API

🛠️ Setup Instructions

✅ Requirements:

  • Python 3.10+
  • Git
  • GitHub repository (forked from https://github.com/alun/refty-infra-test)
  • GitHub Personal Access Token (with repo access)

1️⃣ Clone the Repository

git clone https://github.com/xusandev07/refty-node-versions-service.git && cd refty-node-versions-service

2️⃣ Create Virtual Environment & Install Requirements

python3 -m venv venv && source venv/bin/activate && pip install -r requirements.txt

3️⃣ Set Up Environment Variables

cp .env.example .env

Edit the .env file with your GitHub repository details and Personal Access Token.

4️⃣ Run the Service

python run.py

Now the service should be running on http://localhost:5000.

📬 API Usage

You can use tools like curl or Postman to send a POST request to the /update-image endpoint.

Request Format:

{
  "image": "ghcr.io/refty-yapi/refty-node/refty-node",
  "version": "10-07-ver"
}

Example cURL Command:

curl -X POST http://127.0.0.1:5000/update-image \
  -H "Content-Type: application/json" \
  -d '{"image": "ghcr.io/refty-yapi/refty-node/refty-node", "version": "10-07-ver"}'

🐳 Docker Support (Optional)

If you prefer to run the service in a Docker container, you can build and run it using the provided Dockerfile.

Build the Docker Image

docker build -t refty-node-service .

Run the Docker Container

docker run -p 5000:5000 --env-file .env refty-node-service

This will start the service on port 5000 inside the container, accessible at http://localhost:5000. Thanks for using the Refty Node Versions Service! If you have any questions or issues, feel free to open an issue on the GitHub repository.