1, Deployment installation
(1) Common installation methods
1. curl https://syncd.cc/install.sh | bash
2. dockerfile installation mode is under test
(2) Installation references
1.https://syncd.cc/docs/#/install
2.https: //github.com/dreamans/syncd
3.https: //gitee.com/dreamans/syncd
2, Specification for use
(I) service address
1. http://syncd.cascc.cn/login Account: syncd password: 111111
(II) operation
1. Project configuration
Project space is the basic organizational unit of a project and the main boundary for project and multi-user isolation and access control.
Project - > space management - > new project space
project management
Project - > Project Management - > switch project space - > add new project
Member management
Only when the user is added to the project space and becomes a member of the space can he / she have the corresponding permission.
Project - > member management - > switch project space - > add new member
In the add new member input side box, enter the keywords of the member to be added, select the user and click Add.
2. Cluster configuration
Add cluster
Before creating a project, you need to add the server cluster required by the project. The steps for creating a new cluster are as follows:
Server - > cluster management - > Add cluster
Enter the cluster name according to the actual situation, as shown in the figure:
Add server
Add server information to the new cluster as follows:
Server - > server management - > new server
Secret key configuration
Because the communication between the deployment server (the server where Syncd service is located) and the production server (the target machine for code deployment) is via ssh protocol, the company that deploys the server (generally here:) $HOME/.ssh/id_rsa.pub needs to be added to the trust list of the production machine (generally here $HOME/.ssh/authorized_keys)
You can use the SSH copy ID command to add, or copy manually
Don't forget to test connectivity after setup. ssh {production user name} @ {production address}
Note: the $HOME of the deployment server must be the same as the user running SYNCD, otherwise SSH's password free login will be invalid.
3. Build configuration
Configuration description
Edit the build script from build settings in the project list. The script needs to be triggered manually in the online list, and the system will use / bin/bash -c {script file} to execute.
Build script supported variables
-
-
- ${env_workspace}
-
Code warehouse local copy directory
-
-
- ${env_pack_file}
-
Package the absolute address of the file. After the construction, package the code that needs to be deployed online into this file. You must use the tar -zcf command to package.
The deployment module will distribute the compressed package to the target host and extract it to the specified directory. Please pack as required, or the deployment will fail.
Simple build example
cd ${env_workspace} tar --exclude='.git' -zcvf ${env_pack_file} *
Laravel build example
cd ${env_workspace} composer install tar --exclude='.git' -zcvf ${env_pack_file} *
Front end project building example
cd ${env_workspace} yarn yarn build cd ./dist tar -zcvf ${env_pack_file} *
Java project building example
cd ${env_workspace} mvn -U clean install -Dmaven.test.skip=true -Dmaven.javadoc.skip=true cd ${env_workspace}/neon-xxx-web/target tar -czvf ${env_pack_file} ./*.tar.gz cd ${env_workspace} mvn -U clean install -Dmaven.test.skip=true -Dmaven.javadoc.skip=true cd ${env_workspace}/target tar -czvf ${env_pack_file} ./*.tar.gz
Syncd build example
cd ${env_workspace} make cd ./output tar -zcvf ${env_pack_file} *
4. Hook command
Example of python3
#!/usr/bin/env python3 import json import requests import sys # def send_msg(url, reminders, msg): # headers = {'Content-Type': 'application/json;charset=utf-8'} # data = { # "msgtype": "text", # Send message type as text # "at": { # "atMobiles": reminders, # "isAtAll": False, # No @ everyone # }, # "text": { # "content": msg, # Message text # } # } # r = requests.post(url, data=json.dumps(data), headers=headers) # return r.text # if __name__ == '__main__': # msg = sys.argv[1] # reminders = [] # url = 'https://oapi.dingtalk.com/robot/send?access_token=185016f02b17a162ebba2cc5c781d1f4514778d58208b3bf42b3098adf7ae6b7' # print(send_msg(url, reminders, msg)) # def send_msg(url, reminders, msg, env_apply_id, env_apply_name, env_pack_file, env_build_output, env_build_errmsg, env_build_status): # headers = {'Content-Type': 'application/json;charset=utf-8'} # data = { # "msgtype": "link", # Send message type as text # "at": { # "atMobiles": reminders, # "isAtAll": False, # No @ everyone # }, # "link": { # "title": "app name" + msg # "text": "application form ID:" + env ﹣ apply ﹣ ID + "--" + "application form name:" + env ﹣ apply ﹣ name + "--" + "absolute path of packed file:" + env ﹣ pack ﹣ file + "\ n \ n" + "original output of build script:" + env ﹣ build ﹣ + "--" + "build result status:" + env ﹣ build ﹣ status, # "messageUrl": "https://mp.weixin.qq.com/s?__biz=MzA4NjMwMTA2Ng==&mid=2650316842&idx=1&sn=60da3ea2b29f1dcc43a7c8e4a7c97a16&scene=2&srcid=09189AnRJEdIiWVaKltFzNTw&from=timeline&isappinstalled=0&key=&ascene=2&uin=&devicetype=android-23&version=26031933&nettype=WIFI" # } # } # r = requests.post(url, data=json.dumps(data), headers=headers) # return r.text # if __name__ == '__main__': # msg = sys.argv[1] # env_apply_id = sys.argv[2] # env_apply_name = sys.argv[3] # env_pack_file = sys.argv[4] # env_build_output = sys.argv[5] # env_build_errmsg = sys.argv[6] # env_build_status = sys.argv[7] # reminders = [] # url = 'https://oapi.dingtalk.com/robot/send?access_token=185016f02b17a162ebba2cc5c781d1f4514778d58208b3bf42b3098adf7ae6b7' # print(send_msg(url, reminders, msg, env_apply_id, env_apply_name, env_pack_file, env_build_output, env_build_errmsg, env_build_status)) def send_msg(url, reminders, msg, env_apply_id, env_apply_name, env_pack_file, env_build_output, env_build_errmsg, env_build_status): headers = {'Content-Type': 'application/json;charset=utf-8'} data = { "msgtype": "markdown", # Send message type as text "at": { "atMobiles": reminders, "isAtAll": False, # No @ everyone }, "markdown": { "title": "apply name"+ msg, "text": "- Application form ID: "+ env_apply_id +"\n" +"- Application form name:"+ env_apply_name +"\n" + "- Absolute path of packed file:"+ env_pack_file +"\n" +"- Build the original output of the script:"+ env_build_output+"\n" +"- Build error message:"+ env_build_errmsg+"\n" +"- Build result status:"+ env_build_status, } } r = requests.post(url, data=json.dumps(data), headers=headers) return r.text if __name__ == '__main__': msg = sys.argv[1] env_apply_id = sys.argv[2] env_apply_name = sys.argv[3] env_pack_file = sys.argv[4] env_build_output = sys.argv[5] env_build_errmsg = sys.argv[6] env_build_status = sys.argv[7] reminders = [15230505700] url = 'https://oapi.dingtalk.com/robot/send?access_token=185016f02b17a162ebba2cc5c781d1f4514778d58208b3bf42b3098adf7ae6b7' print(send_msg(url, reminders, msg, env_apply_id, env_apply_name, env_pack_file, env_build_output, env_build_errmsg, env_build_status))
(III) operation precautions
1. Online application shall be submitted before online release, and the application shall be copied to the email of the reviewer.
2. Fill in the online form to describe the online content and online branches. In general, the default branch develop ment qa release will be set.
3. Before filling in the online form, specify the rollback task to prevent the online failure from rolling back quickly.
4. There will be a nail reminder when the production online construction and deployment operation fails, which needs to be noticed as soon as possible.