Syncd – Automated deployment tool

Syncd is an open source code deployment tool that improves team productivity with simplicity, efficiency, and ease of use.

Project address github.com/dreamans/sy…

directory

  • features
  • The principle of
  • The installation
  • use
  • help
  • authorization

features

  • Go language development, simple compilation, efficient operation
  • Web interface access, friendly interaction
  • Flexible role permission configuration
  • Support for Git repositories
  • Branch and tag are online
  • Deploying Hook support
  • Complete on-line workflow
  • Email Notification mechanism

The principle of

Git

The Syncd service pulls the specified tag(branch) code from the repository via git-SSH (or password)

build

Run the configured build script and compile it into a ready-to-go package

In this step, you can run unit tests (e.g. Go Test PHP PHPUnit, download dependencies (e.g. Go: Glide install PHP: Composer install), and compile packages (e.g. Js: NPM build Go: Go build xx.go Java: javac xx. Java C: cc xx.c) etc.

distribution

Use the SCP command to distribute the software package to a temporary directory on the production server in each equipment room, remotely run the pre-deploy command, decompress the software package to the target directory, and then run the post-deploy command

The distribution online process is executed in serial. If any step fails to be executed, the entire online order will be terminated and the status will be set to online failed. Click online again and try again.

Parallel execution on the same cluster server and serial publishing between clusters will be supported in the future

SSH trust

Trust is established between the production server and the deployment server using sSH-key

For details, see Key Configuration

The installation

The preparatory work

  • Go

Go1.10 or later is recommended for compiling source code

  • Nginx

Web services depend on Nginx

  • MySQL

The system relies on Mysql to store persistent data. Mysql 5.7 is recommended

  • Linux + Bash

The system uses git, SSH, SCP and other commands. Therefore, you are advised to use these commands only on Linux. You need to install or update the latest versions of these commands in advance

  • The secret key configuration

Because the deployment server (where the Syncd service is located) communicates with the production server (where the code deployment target is located) over SSH, the public key of the deployment machine (typically here) is required: ~/.ssh/id_rsa.pub) adds to the trusted list of the production machine (usually ~/.ssh/authorized_keys)

You can run the ssh-copy-id command to add the id or copy the id manually. SSH {username of the production machine}@{address of the production machine}

You are advised to add the following configuration to the SSH configuration /etc/ssh/ssh_config of the deployment server to disable the display of the public key summary to prevent background scripts from running properly

Host *
    StrictHostKeyChecking no
Copy the code

Note: You need to set SSH directory permission by clicking this button. Otherwise, you may fail to log in secret-free

~/.ssh  0700
~/.ssh/authorized_keys 0600
Copy the code

The installation

  • Run the following command
curl https://raw.githubusercontent.com/dreamans/syncd/master/install.sh |bash
Copy the code

If the syncd-deploy or syncd-deploy-xxx directory is generated in the current directory, the installation is successful

The generated syncd-deploy directory can be copied or moved wherever you want, but do not try to copy the directory to run on another server, as this can cause unexpected results.

  • Database dependency

You will need to github.com/dreamans/syncd/syncd.sql data table structure and data import to MySQL database

  • Modifying a Configuration File

Modify the configuration information in syncd-deploy/etc/syncd.ini. For details about the configuration, see the comments

  • Start the service
cdSyncd - deploy ➜ syncd - deploy. / bin/syncd - c. / etc/syncd. Ini __ __ __ ____ _____ _____ _____ / / / ___ / / / / / / __ / / ___/ / __ / (__ ) / /_/ / / / / / / /__ / /_/ / /____/ \__, / /_/ /_/ \___/ \__,_/ /____/ Service: syncd Version: 1.0.0 Config Loaded:./etc/syncd.ini Log: stdout Database: 127.0.0.1 Mail Enable: 0 HTTP Service: :8868 Start Running...Copy the code
  • Add Nginx configuration
Upstream syncdServer {server 127.0.0.1:8868 weight=1; } server { listen 80; server_name deploy.syncd.cc;# Replace this with your real domain name
    access_log   logs/deploy.syncd.cc.log;

    location / {
        try_files $uri $uri/ /index.html;
        root /path/syncd-deploy/public; # Replace this /path with the real path
        index index.html index.htm;
    }

    location ^~ /api/ {
        proxy_pass          http://syncdServer;
        proxy_set_header    X-Forwarded-Host $host:$server_port;
        proxy_set_header    X-Real-IP     $remote_addr;
        proxy_set_header    Origin        $host:$server_port;
        proxy_set_header    Referer       $host:$server_port; }}Copy the code

Restart the nginx service

Modify the hosts

If the domain name is not resolved, modify hosts to resolve the domain name temporarily

Sudo vim /etc/hosts 127.0.0.1 deploy. Syncd. cc;Copy the code

The installation is complete

Open your browser and visit http://deploy.syncd.cc

Initial Account:

User name: syncd Email: [email protected] Password: syncd.ccCopy the code

!!!!!!!!! Change the password as soon as possible after login

use

System Flow chart

Use the screenshot

help

Please make an issue when you have a problem

Or add wechat to a discussion group

authorization

This project adopts the MIT Open Source LICENSE, and the complete LICENSE description has been placed in the LICENSE file