🚁

ပျံသန်းမှု

CI/CD & DevOps

ရိုးရှင်းသော YAML ပြင်ဆင်မှုပါရှိသော Container-native continuous integration platform

ဖြန့်ချိမှုဆိုင်ရာ အချက်အလက်များ

ဖြန့်ကျက်ခြင်း: ၂-၅ မိနစ်
အမျိုးအစား: CI/CD & DevOps
အနည်းဆုံး RAM: 1024MB
ပံ့ပိုးမှု: မှတ်ပုံတင်နှင့်အီးမေးလ်

ဒီလမ်းညွှန်ကိုမျှဝေပါ

အကျဉ်းချုပ်

Drone သည် Docker ပေါ်တွင် တည်ဆောက်ထားသော ခေတ်မီ container-native continuous integration နှင့် continuous delivery (CI/CD) platform ဖြစ်သည်။ ရိုးရှင်းမှု၊ ပေါ့ပါးသော architecture နှင့် deploy၊ scale နှင့် ထိန်းသိမ်းရလွယ်ကူစေသော cloud-native ဒီဇိုင်းဖြင့် ထင်ရှားသည်။ ကျယ်ပြန့်သော infrastructure နှင့် configuration လိုအပ်သော ရိုးရာ CI/CD စနစ်များနှင့် မတူဘဲ Drone သည် dependency နည်းသော binary တစ်ခုတည်းအဖြစ် လည်ပတ်ပြီး မည်သည့်အရွယ်အစား team အတွက်မဆို သင့်လျော်သည်။

Drone ၏ ထူးခြားချက်မှာ containerized pipeline ချဉ်းကပ်နည်း ဖြစ်သည်: build တိုင်းသည် သီးခြား Docker container များတွင် လည်ပတ်ပြီး ရှင်းလင်းပြီး ပြန်လည်ထပ်ခါတလဲလဲ ပြုလုပ်နိုင်သော build များကို conflict မရှိဘဲ သေချာစေသည်။ pipeline configuration သည် သင့် repository တွင် သိမ်းထားသော ရိုးရှင်းသည့် YAML ဖြစ်ပြီး version control လုပ်ရန်နှင့် project များအကြား ပွားရန် လွယ်ကူသည်။ Drone သည် code push လုပ်သည့်အခါ၊ pull request ဖွင့်သည့်အခါ သို့မဟုတ် release tag လုပ်သည့်အခါ အလိုအလျောက် သိရှိပြီး သင့်လျော်သော pipeline များကို ချက်ချင်း trigger လုပ်သည်။

Drone ၏ plugin ecosystem သည် ကျယ်ပြန့်ပြီး AWS၊ Kubernetes၊ Docker registry၊ Slack notification နှင့် အခြားသို့ deploy လုပ်ရန် community ရေးထားသော plugin ရာပေါင်းများစွာ ရှိသည်။ Docker-native ဖြစ်သောကြောင့် pipeline step တစ်ခုအဖြစ် မည်သည့် Docker image ကိုမဆို run နိုင်ပြီး အကန့်အသတ်မရှိ ပြောင်းလွယ်မှုကို ပေးသည်။ Python 3.11 တွင် test လုပ်ရန် လိုအပ်ပါသလား။ AWS သို့ deploy လုပ်ရန် လိုအပ်ပါသလား။ Slack notification ပို့ရန် လိုအပ်ပါသလား။ သင့်လျော်သော Docker image ကို pipeline တွင် ရည်ညွှန်းရုံသာ လုပ်ပါ။

ပလက်ဖောင်းသည် GitHub၊ GitLab၊ Bitbucket နှင့် Gitea အပါအဝင် version control system အားလုံးကို ပံ့ပိုးပြီး ချောမွေ့သော authentication အတွက် native OAuth integration ရှိသည်။ Drone သည် runner node များ ထပ်ထည့်ခြင်းဖြင့် horizontal ချဲ့နိုင်ပြီး server အများအပြားတွင် build ရာပေါင်းများစွာကို တစ်ပြိုင်နက် ကိုင်တွယ်နိုင်သည်။ stateless architecture ကြောင့် ရှုပ်ထွေးသော clustering မလိုဘဲ လိုအပ်ချက်အပေါ် မူတည်၍ scale up သို့မဟုတ် down လုပ်နိုင်သည်။

Drone သည် multiple version များအတွက် စမ်းသပ်ရန် matrix build၊ branch သို့မဟုတ် tag pattern အပေါ် အခြေခံသော conditional execution၊ credential သိမ်းဆည်းရန် secrets management နှင့် ထပ်ခါတလဲလဲ build များကို မြန်စေရန် build caching ကဲ့သို့ အစွမ်းထက်သော အင်္ဂါရပ်များကို ပေးသည်။ web interface သည် သန့်ရှင်းပြီး နားလည်လွယ်ပြီး real-time log၊ build history နှင့် pipeline step တစ်ခုချင်းစီ၏ အသေးစိတ် insight များကို ပြသသည်။

enterprise team များအတွက် Drone သည် RBAC (role-based access control)၊ audit log နှင့် လုံခြုံရေးအတွက် မည်သည့် repository က မည်သည့် plugin ကို သုံးနိုင်သည်ကို ကန့်သတ်နိုင်မှုကဲ့သို့ အဆင့်မြင့် အင်္ဂါရပ်များကို ပေးသည်။ autoscaling စွမ်းရည်က ကုန်ကျစရိတ်သက်သာစေသည်။ build များ queue ဖြစ်နေသည့်အခါသာ runner များကို ဖွင့်ပြီး အလုပ်မလုပ်သောအခါ ပိတ်နိုင်သည်၊ ၎င်းသည် တစ်မိနစ်ချင်း ပေးချေရသော cloud ပတ်ဝန်းကျင်များအတွက် အထူးသင့်လျော်သည်။

Drone သည် community နှင့် enterprise edition နှစ်မျိုးလုံးဖြင့် open source ဖြစ်သည်။ community edition သည် အင်္ဂါရပ်အပြည့်အစုံ ပါဝင်ပြီး အသေးစားမှ အလတ်စား team များအတွက် သင့်လျော်သည်။ enterprise edition က support contract၊ အဆင့်မြင့် လုံခြုံရေးအင်္ဂါရပ်များနှင့် priority support ကို ထပ်ထည့်သည်။ startup ဖြစ်စေ enterprise ဖြစ်စေ Drone သည် သင့်လိုအပ်ချက်နှင့်အတူ ကြီးထွားသည်။

အဓိကအင်္ဂါရပ်များ

Container-Native Pipeline များ

build step တိုင်းသည် dependency မလိုဘဲ ရှင်းလင်းပြီး ပြန်လည်ထပ်ခါတလဲလဲ ပြုလုပ်နိုင်သော build များအတွက် သီးခြား Docker container များတွင် လည်ပတ်သည်

ရိုးရှင်းသော YAML Configuration

သင့် repository တွင် သိမ်းထားသော နားလည်လွယ်သည့် YAML syntax ဖြင့် code အဖြစ် pipeline

ကျယ်ပြန့်သော Plugin Ecosystem

deploy၊ notification၊ testing နှင့် မည်သည့် service နှင့်မဆို ပေါင်းစပ်ရန် plugin ရာပေါင်းများစွာ

Auto-Scaling Runner များ

runner node အများအပြားဖြင့် horizontal ချဲ့ခြင်း၊ ဆိုင်းငံ့နေသော job ပမာဏပေါ် မူတည်၍ အလိုအလျောက် provision/deprovision

ရင်းမြစ် VCS ပေါင်းစပ်မှု

OAuth နှင့် webhook automation ပါသော GitHub၊ GitLab၊ Bitbucket၊ Gitea အတွက် ပထမတန်းစား ပံ့ပိုးမှု

လျှို့ဝှက်ချက်များ စီမံခန့်ခွဲခြင်း

repository သို့မဟုတ် organization တစ်ခုချင်းစီအတွက် အသေးစိတ် access ထိန်းချုပ်မှုပါသော ကုဒ်ဝှက်ထားသည့် secret သိုလှောင်မှု

အသုံးပြုမှုအခြေအနေများ

• Microservices CI/CD: ဆားဗစ်တစ်ခုချင်းစီအတွက် သီးခြား ကွန်တိန်နာပါသော ပိုက်လိုင်းများဖြင့် မိုက်ခရိုဆားဗစ် အများအပြားကို build နှင့် deploy လုပ်ပါ
• Multi-Language Projects: matrix build (Python 3.8-3.11၊ Node 14-18 စသည်) ကို အသုံးပြု၍ ဘာသာစကား/version မတူညီသော project များကို စမ်းသပ်ပါ
• Docker Image Builds: Docker Hub၊ AWS ECR သို့မဟုတ် private registry များသို့ Docker image များကို build၊ tag နှင့် push လုပ်ပါ
• Kubernetes Deployments: build အောင်မြင်ပြီးနောက် Helm chart သို့မဟုတ် kubectl plugin ဖြင့် Kubernetes deployment များကို အလိုအလျောက် လုပ်ပါ
• Pull Request Testing: merge မလုပ်မီ PR တိုင်းတွင် အလိုအလျောက် test run ပြီး GitHub/GitLab တွင် status check များ ပေါင်းစပ်ပါ
• Multi-Environment Deployments: branch pattern နှင့် လူကိုယ်တိုင် အတည်ပြုချက်များအပေါ် အခြေခံ၍ dev/staging/production ပတ်ဝန်းကျင်များသို့ deploy လုပ်ပါ
• Infrastructure as Code: automated pipeline များဖြင့် Terraform၊ CloudFormation သို့မဟုတ် Ansible configuration များကို စမ်းသပ်ပြီး deploy လုပ်ပါ

သွင်းနည်းလမ်းညွှန်

Ubuntu VPS ပေါ်တွင် တပ်ဆင်ခြင်း:

1. Docker ကို တပ်ဆင်ခြင်း (မတပ်ဆင်ရသေးပါက):
# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

# Add current user to docker group
sudo usermod -aG docker $USER
newgrp docker

# Verify installation
docker --version
2. Drone Server Configuration ဖန်တီးခြင်း:
# Create directory for Drone
sudo mkdir -p /var/lib/drone
sudo chown -R $USER:$USER /var/lib/drone

# Create environment file
cat > /var/lib/drone/.env <<'EOF'
# Drone Server Settings
DRONE_SERVER_HOST=drone.yourdomain.com
DRONE_SERVER_PROTO=https
DRONE_RPC_SECRET=$(openssl rand -hex 16)
DRONE_DATABASE_DRIVER=sqlite3
DRONE_DATABASE_DATASOURCE=/data/database.sqlite

# GitHub Integration (or use GitLab/Bitbucket)
DRONE_GITHUB_CLIENT_ID=your_github_oauth_app_id
DRONE_GITHUB_CLIENT_SECRET=your_github_oauth_secret

# Admin user (your GitHub username)
DRONE_USER_CREATE=username:yourgithubusername,admin:true

# Optional: Enable registration
DRONE_REGISTRATION_CLOSED=false
EOF
3. RPC Secret ထုတ်ခြင်း:
# Generate a secure RPC secret
openssl rand -hex 16
# Update DRONE_RPC_SECRET in .env file
4. GitHub OAuth Application ကို စတင်ခြင်း:
- သွားရန်: https://github.com/settings/applications/new
- Application အမည်: Drone CI
- ပင်မစာမျက်နှာ URL: https://drone.yourdomain.com
- ခွင့်ပြုချက် callback URL: https://drone.yourdomain.com/login
- Client ID နှင့် Client Secret ကို .env ဖိုင်သို့ ကူးထည့်ပါ

5. Drone Server ကို စတင်ခြင်း:
docker run   --volume=/var/lib/drone:/data   --env-file=/var/lib/drone/.env   --publish=8080:80   --publish=443:443   --restart=always   --detach=true   --name=drone   drone/drone:2
6. Drone Server ကို စစ်ဆေးခြင်း:
# Check container status
docker ps | grep drone

# Check logs
docker logs drone

# Test web interface
curl http://localhost:8080
7. Drone Runner ကို တပ်ဆင်ခြင်း (Docker Runner):
docker run --detach   --volume=/var/run/docker.sock:/var/run/docker.sock   --env=DRONE_RPC_PROTO=http   --env=DRONE_RPC_HOST=localhost:8080   --env=DRONE_RPC_SECRET=your_rpc_secret_from_env   --env=DRONE_RUNNER_CAPACITY=2   --env=DRONE_RUNNER_NAME=my-first-runner   --publish=3000:3000   --restart=always   --name=runner   drone/drone-runner-docker:1
8. Nginx Reverse Proxy ကို configure လုပ်ခြင်း (Production):
sudo nano /etc/nginx/sites-available/drone

# Add this configuration:
server {
    listen 80;
    server_name drone.yourdomain.com;

    location / {
        proxy_pass http://localhost:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

# Enable site
sudo ln -s /etc/nginx/sites-available/drone /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
9. Let's Encrypt ဖြင့် SSL ကို သတ်မှတ်ခြင်း:
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d drone.yourdomain.com
10. နမူနာ Pipeline ဖန်တီးခြင်း (.drone.yml):
kind: pipeline
type: docker
name: default

steps:
  - name: test
    image: node:18
    commands:
      - npm install
      - npm test

  - name: build
    image: node:18
    commands:
      - npm run build

  - name: docker
    image: plugins/docker
    settings:
      repo: yourusername/yourapp
      tags: latest
      username:
        from_secret: docker_username
      password:
        from_secret: docker_password
    when:
      branch:
        - main
11. Repository ထည့်ခြင်း:
- Drone web UI သို့ ဝင်ပါ: https://drone.yourdomain.com
- GitHub ဖြင့် authenticate လုပ်ပါ
- သင့် repository ကို activate လုပ်ပါ
- .drone.yml ကို သင့် repo သို့ push လုပ်ပါ
- build trigger အလိုအလျောက် စတင်ခြင်းကို ကြည့်ပါ!

12. Secret များ ထည့်ခြင်း (CLI သို့မဟုတ် UI ဖြင့်):
# Install Drone CLI
curl -L https://github.com/harness/drone-cli/releases/latest/download/drone_linux_amd64.tar.gz | tar zx
sudo install -t /usr/local/bin drone

# Configure CLI
export DRONE_SERVER=https://drone.yourdomain.com
export DRONE_TOKEN=your_user_token_from_ui

# Add secrets
drone secret add --repository yourusername/yourrepo --name docker_username --data yourvalue
drone secret add --repository yourusername/yourrepo --name docker_password --data yourvalue

ပြုပြင်ထိန်းသိမ်းမှု အကြံပြုချက်များ

အရေးကြီးသော Configuration:

1. Server Configuration (.env ဖိုင်):
# Core Settings
DRONE_SERVER_HOST=drone.example.com
DRONE_SERVER_PROTO=https
DRONE_RPC_SECRET=supersecretkey

# Database
DRONE_DATABASE_DRIVER=postgres
DRONE_DATABASE_DATASOURCE=postgres://user:pass@localhost:5432/drone?sslmode=disable

# VCS Integration (GitHub example)
DRONE_GITHUB_CLIENT_ID=github_oauth_app_id
DRONE_GITHUB_CLIENT_SECRET=github_oauth_secret

# User Management
DRONE_USER_CREATE=username:admin,admin:true
DRONE_USER_FILTER=organization_name  # Only allow specific org
2. Pipeline Configuration (.drone.yml)၊ အခြေခံ:
kind: pipeline
type: docker
name: build-test-deploy

steps:
  - name: install
    image: node:18
    commands:
      - npm ci

  - name: test
    image: node:18
    commands:
      - npm test
      - npm run lint

  - name: build
    image: node:18
    commands:
      - npm run build

  - name: deploy
    image: plugins/ssh
    settings:
      host: production.example.com
      username: deploy
      key:
        from_secret: ssh_private_key
      script:
        - cd /var/www/app
        - git pull
        - npm install
        - pm2 restart app
    when:
      branch:
        - main
3. Matrix Build များ (Version အများအပြား):
kind: pipeline
type: docker
name: matrix-test

steps:
  - name: test
    image: python:${PYTHON_VERSION}
    commands:
      - pip install -r requirements.txt
      - pytest

matrix:
  PYTHON_VERSION:
    - "3.8"
    - "3.9"
    - "3.10"
    - "3.11"
4. Docker Build နှင့် Push:
kind: pipeline
type: docker
name: docker-build

steps:
  - name: build-and-push
    image: plugins/docker
    settings:
      repo: username/myapp
      tags:
        - latest
        - ${DRONE_COMMIT_SHA:0:8}
      username:
        from_secret: docker_username
      password:
        from_secret: docker_password
      dockerfile: Dockerfile
      context: .
5. Kubernetes ဖြန့်ကျက်ခြင်း:
kind: pipeline
type: docker
name: k8s-deploy

steps:
  - name: deploy-to-k8s
    image: sinlead/drone-kubectl
    settings:
      kubernetes_server: https://k8s.example.com
      kubernetes_token:
        from_secret: k8s_token
      kubernetes_cert:
        from_secret: k8s_cert
    commands:
      - kubectl set image deployment/myapp myapp=username/myapp:${DRONE_COMMIT_SHA}
      - kubectl rollout status deployment/myapp
    when:
      branch:
        - main
6. အခြေအနေအလိုက် လုပ်ဆောင်ခြင်း:
kind: pipeline
type: docker
name: conditional-deploy

steps:
  - name: deploy-staging
    image: plugins/ssh
    commands:
      - deploy to staging
    when:
      branch:
        - develop

  - name: deploy-production
    image: plugins/ssh
    commands:
      - deploy to production
    when:
      branch:
        - main
      event:
        - push
        - tag

  - name: deploy-on-tag
    image: plugins/ssh
    commands:
      - deploy release
    when:
      event:
        - tag
      ref:
        - refs/tags/v*
7. Services (Database၊ Testing အတွက် Redis):
kind: pipeline
type: docker
name: integration-tests

services:
  - name: postgres
    image: postgres:14
    environment:
      POSTGRES_USER: testuser
      POSTGRES_PASSWORD: testpass
      POSTGRES_DB: testdb

  - name: redis
    image: redis:7

steps:
  - name: test
    image: python:3.11
    environment:
      DATABASE_URL: postgres://testuser:testpass@postgres:5432/testdb
      REDIS_URL: redis://redis:6379
    commands:
      - pip install -r requirements.txt
      - pytest tests/integration/
8. လျှို့ဝှက်ချက်များ စီမံခန့်ခွဲခြင်း:
# Via CLI
drone secret add --repository user/repo --name aws_access_key --data value
drone secret add --repository user/repo --name aws_secret_key --data value

# In pipeline
kind: pipeline
type: docker
name: default

steps:
  - name: deploy
    image: plugins/s3
    settings:
      access_key:
        from_secret: aws_access_key
      secret_key:
        from_secret: aws_secret_key
      bucket: my-bucket
      source: dist/**/*
9. Dependency များကို Cache လုပ်ခြင်း:
kind: pipeline
type: docker
name: cached-build

steps:
  - name: restore-cache
    image: drillster/drone-volume-cache
    volumes:
      - name: cache
        path: /cache
    settings:
      restore: true
      mount:
        - ./node_modules

  - name: build
    image: node:18
    commands:
      - npm ci
      - npm run build

  - name: rebuild-cache
    image: drillster/drone-volume-cache
    volumes:
      - name: cache
        path: /cache
    settings:
      rebuild: true
      mount:
        - ./node_modules

volumes:
  - name: cache
    host:
      path: /var/lib/drone/cache
10. Notification (Slack၊ Email):
kind: pipeline
type: docker
name: notify

steps:
  - name: build
    image: node:18
    commands:
      - npm run build

  - name: slack
    image: plugins/slack
    settings:
      webhook:
        from_secret: slack_webhook
      channel: deployments
      template: >
        {{#success build.status}}
          ✅ Build #{{build.number}} succeeded. Branch: {{build.branch}}
        {{else}}
          ❌ Build #{{build.number}} failed. Branch: {{build.branch}}
        {{/success}}
    when:
      status:
        - success
        - failure
အကောင်းဆုံးလေ့ကျင့်မှုများ:
- Sensitive ဒေတာကို secret များတွင် သိမ်းပါ၊ .drone.yml တွင် ဘယ်တော့မှ မထည့်ပါနှင့်
- latest အစား သတ်မှတ်ထားသော image tag (node:18) ကို သုံးပါ
- build မြန်စေရန် cache ကို ဖွင့်ပါ (node_modules၊ pip package များ)
- တကယ့် database များဖြင့် integration testing အတွက် services ကို အသုံးပြုပါ
- version အများအပြားကို စမ်းသပ်ရန် matrix build များကို အကောင်အထည်ဖော်ပါ
- မလိုအပ်သော deployment များကို တားဆီးရန် conditional execution ကို အသုံးပြုပါ
- branch protection ကို သင့်လျော်စွာ သတ်မှတ်ပါ (main/master မှသာ deploy လုပ်ပါ)
- build စွမ်းဆောင်ရည်ကို စောင့်ကြည့်ပြီး နှေးသော step များကို optimize လုပ်ပါ

နည်းပညာဆိုင်ရာလိုအပ်ချက်များ

စနစ်လိုအပ်ချက်များ

  • မှတ်ဉာဏ်: 1024RAM 1MB

ဤဆောင်းပါးကို အဆင့်သတ်မှတ်ပါ

★★★★★
-
ဖွင့်နေသည်...

သင့်အပလီကေးရှင်းကို ဖြန့်ကျက်ရန် အဆင်သင့်ဖြစ်ပြီလား။ ပျံသန်းမှု?

ကျွန်တော်တို့ရဲ့ရိုးရှင်းတဲ့ VPS ဖြန့်ချိလုပ်ငန်းစဉ်နှင့်အတူမိနစ်အနည်းငယ်အတွင်းစတင်

Deploy in about 2 minutes • Full root access • Support by ticket and email