Skip to content

Repository files navigation

MyDeploy

       .
      ":"                 __  ___     ___           __
    ___:____     |"\/"|  /  |/  /_ __/ _ \___ ___  / /__  __ __
  ,'        `.    \  /  / /|_/ / // / // / -_) _ \/ / _ \/ // /
  |  O        \___/  | /_/  /_/\_, /____/\__/ .__/_/\___/\_, /
~^~^~^~^~^~^~^~^~^~^~^~       /___/        /_/          /___/

Self-hosted deployment platform. Deploy Docker containers to remote machines through a microservice backend and interactive TUI client.

Architecture

The system consists of several microservices, each responsible for a specific domain. Communication is handled via HTTP (public API) and gRPC (internal service-to-service).

  • Gateway: Single entry point, JWT validation, and request routing.
  • Auth Service: User management, registration, and authentication.
  • Agent Service: Manages connected agents via WebSockets.
  • Deploy Service: Handles deployment logic and communicates with agents.
  • Template Service: Provides application templates (Postgres, Redis, etc.).

Development & Deployment

Prerequisites

  • Go 1.24+
  • Docker & Docker Compose
  • Kubernetes (Minikube recommended for local testing)
  • Helm (for K8s deployment)

Local Development (Docker Compose)

The easiest way to start all services and databases:

docker compose up --build

The Gateway will be available at http://localhost:8080.

Remote Agent Install

Remote agent install currently supports Linux servers only and uses a short-lived bootstrap token.

  1. Log in locally with mydeploy.
  2. Generate a one-line installer command:
mydeploy agent-install-command \
  --name srv-01
  1. Run the printed curl -fsSL ... | sh command on the remote Linux server as root.

The installer will:

  • download mydeploy-agent
  • exchange the bootstrap token for a permanent agent token
  • write /root/.mydeploy/config.json
  • install and start a systemd service named mydeploy-agent

Current constraints:

  • Remote install is supported only for Linux servers.
  • The remote installer currently targets Linux x86_64/amd64.
  • The remote host must expose systemd, curl, install, and Docker access for the agent process.
  • The gateway must be configured with PUBLIC_URL and AGENT_BINARY_URL.

Optional overrides:

mydeploy agent-install-command \
  --name srv-01 \
  --public-url https://api.example.com \
  --binary-url https://downloads.example.com/mydeploy-agent-linux-amd64

Use them only if you intentionally want to override the server defaults.

Recommended next step for production convenience:

  • Publish versioned agent binaries for linux/amd64 and linux/arm64.
  • Add package-based install paths (.deb/.rpm) or a dedicated download endpoint.
  • Add bootstrap token cleanup / revocation policies in the agent service.

Kubernetes Deployment (Minikube)

To deploy the full stack into a local Kubernetes cluster:

  1. Start Minikube & Enable Ingress:

    minikube start
    minikube addons enable ingress
  2. Build and Load Images:

    make docker-build-all
    minikube image load my-registry/auth-service:v1.0.2
    minikube image load my-registry/agent-service:v1.0.2
    minikube image load my-registry/deploy-service:v1.0.2
    minikube image load my-registry/template-service:v1.0.2
    minikube image load my-registry/gateway-service:v1.0.2
  3. Install via Helm:

    make k8s-install
  4. Access the API: Run minikube tunnel in a separate terminal and add the following to your hosts file:

    127.0.0.1 api.my-deploy.local
    

Makefile Commands

Command Description
make build Build all Go binaries to bin/
make docker-build-all Build all Docker images (v1.0.2)
make k8s-install Install/Setup everything in Kubernetes
make k8s-status Check status of Pods, Services, and Ingress
make k8s-restart Restart all deployments to apply changes
make k8s-uninstall Remove all resources from the cluster

Database Migrations

The system features an automatic migration system. Upon startup, each service checks its respective migration directory and applies any missing .sql files:

  • Auth: migrations/auth/ -> auth_db
  • Agent: migrations/agent/ -> agent_db
  • Deploy: migrations/deploy/ -> deploy_db

API Testing

You can test the API using curl or Postman.

Health Check:

curl -i http://api.my-deploy.local/health

Registration (Sign-Up):

curl -X POST http://api.my-deploy.local/api/auth/sign-up \
     -H "Content-Type: application/json" \
     -d '{"email":"user@example.com", "password":"securepassword"}'

Tech Stack

  • Backend: Go (stdlib net/http, gRPC, WebSockets)
  • Database: PostgreSQL 16
  • Orchestration: Kubernetes (Helm) / Docker Compose
  • CLI: Bubble Tea (TUI)
  • Security: JWT Authentication

About

Self-hosted deployment platform - deploy Docker containers to remote machines via TUI client, REST API, and WebSocket agents.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages