# Docker Deployer **Repository Path**: oraclegao/docker-deployer ## Basic Information - **Project Name**: Docker Deployer - **Description**: A deployment tool for creating deployment project base on docker and docker-composer. - **Primary Language**: Shell - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2020-03-09 - **Last Updated**: 2025-09-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Docker Deployer #### 前置条件 - 执行下列指令自动安装最新版docker和docker-compose ``` shell bash <(curl -L -s https://gitee.com/oraclegao/docker-deployer/raw/master/init.sh) ``` - docker 镜像库加速和代理(/etc/docker/daemon.json) ``` json { "registry-mirrors": [ "https://docker.registry.cyou", "https://docker-cf.registry.cyou", "https://dockercf.jsdelivr.fyi", "https://docker.jsdelivr.fyi", "https://dockertest.jsdelivr.fyi", "https://mirror.aliyuncs.com", "https://dockerproxy.com", "https://mirror.baidubce.com", "https://docker.m.daocloud.io", "https://docker.nju.edu.cn", "https://docker.mirrors.sjtug.sjtu.edu.cn", "https://docker.mirrors.ustc.edu.cn", "https://mirror.iscas.ac.cn", "https://docker.rainbond.cc" ] } ``` #### 描述 - 部署工具,创建部署项目,创建的部署项目基于docker和docker-composer管理项目中的服务。包括三种类型服务,构建服务、成熟服务和工具服务。 ##### 构建服务(build service) - 需要构建打包镜像的服务,目前支持java(maven), python, php-fpm, node, 静态资源文件, golang ##### 成熟服务(mature service) - 无需构建打包安装即用的服务,目前支持mongo, rabbitmq, mysql, redis ### 工具服务(tool service) - 不与构建服务和成熟服务组合,而需独立部署的工具类服务,目前支持netdata #### 环境需求 - Ubuntu / CentOS 内核版本符合docker和docker-compose安装要求 - docker 17.05+ - docker-compose 1.18.0+ #### 指令 ##### 安装构建服务 ``` shell bash <(curl -L -s https://gitee.com/oraclegao/docker-deployer/raw/master/setup.sh) -h ``` ``` txt HELP: create deploy project and setup build service Usage: setup.sh [OPTIONS] <-t | --type > setup.sh -h | --help OPTIONS: -d, --deploy-path deploy path, (default: current path) -D, --debug debug mode, show debug message -h, --help show help and exit -n, --name service name, (default: git project name) (example: docker-deployer is the project name of 'https://gitee.com/oraclegao/docker-deployer.git') -p, --port app service port -t, --type app type(required), see TYPES --no-port service do not expose port --uncheck-git-url do not validate git url TYPES: node web serice compiled by nodejs golang golang service file nginx file service php-fpm php fpm service java java service(maven project) python python service GIT: clone url of the git code base, (example: https://gitee.com/oraclegao/docker-deployer.git) ``` ##### 安装成熟服务 ``` shell bash <(curl -L -s https://gitee.com/oraclegao/docker-deployer/raw/master/mature-setup.sh) -h ``` ``` txt HELP: create deploy project and setup mature service Usage: mature-setup.sh [OPTIONS] mature-setup.sh -h | --help OPTIONS: -d, --deploy-path deploy path, (default: current path) -D, --debug debug mode, show debug message -h, --help [SERVICE] show help and exit, show SERVICE setup help if sepcify the SERVICE -n, --name service name, (default: SERVICE, see ) -p, --port service port --list-version list valid service versions from docker hub repo (official) and exit --service-version service docker image version SERVICES: rabbitmq rabbitmq message queue mysql mysql relational database elasticsearch Elasticsearch is the distributed search and analytics engine at the heart of the Elastic Stack. redis redis memory database mongo mongo nosql database ``` ##### 安装工具服务 ``` shell bash <(curl -L -s https://gitee.com/oraclegao/docker-deployer/raw/master/tool-setup.sh) -h ``` ``` txt HELP: setup tool service Usage: tool-setup.sh [OPTIONS] tool-setup.sh -h | --help OPTIONS: -d, --deploy-path deploy path, (default: current path) -D, --debug debug mode, show debug message -h, --help show help and exit SERVICES: netdata Netdata is distributed, real-time performance and health monitoring for systems and applications. filebeat Filebeat is a lightweight shipper for forwarding and centralizing log (docker container log) data. kafdrop Kafdrop is a web UI for viewing Kafka topics and browsing consumer groups. kibana Explore and visualize your data and manage all things Elastic Stack. ``` ##### 更新部署项目命令脚本 ``` shell bash <(curl -L -s https://gitee.com/oraclegao/docker-deployer/raw/master/update.sh) -h ``` ``` HELP: update deployment project scripts Usage: update.sh [OPTIONS] update.sh -h | --help OPTIONS: -d, --deploy-path deployment project deploy path, (default: '.' current path) -D, --debug debug mode, show debug message -f, --force force update, ignore warning and error -h, --help display this help and exit -y assume Yes to startup and do not prompt ``` ##### 生成nginx网关 ``` shell bash <(curl -L -s https://gitee.com/oraclegao/docker-deployer/raw/master/gateway.sh) -h ``` ``` HELP: nginx revere proxy config generater. scan docker deploy project for build services, and generate the build services's nginx reverse proxy config for gateway. Usage: setup.sh [OPTIONS] -n setup.sh -h | --help OPTIONS: -d, --deploy-path deploy path, (default: current path) -D, --debug debug mode, show debug message -h, --help show help and exit -n, --domain-name service domain name, the server name of nginx config(required) -o, --output output into the file, (default: output into console) --cors add default CORS support into the nginx config --https-cert-name tls cert name, if specify the cert name, add tls config into the nginx config --https-cert-path tls cert path, overlooked if not specify the cert name. (default: /etc/nginx/cert) IPs: build services's ip adddress which gateway nginx can be reverse proxied. format: IP1,IP2,... ``` #### 创建jenkins流水线 ``` shell bash <(curl -L -s https://gitee.com/oraclegao/docker-deployer/raw/master/jenkins.sh) -h ``` ``` HELP: create jenkins pipeline job for docker deploy project ** must be executed in docker deploy project ** Usage: jenkins.sh -a -s [OPTIONS] URL -h | --help OPTIONS: -a, --auth jenkins auth info username: jenkins username apiToken: jenkins user api token -d, --docker-registry docker registry info repositroy: docker repository, examle: registry.cn-beijing.aliyuncs.com/xxx/xxx certId: cert id configed in jenkins using 'Username with password' kind -D, --debug debug mode, show debug message -h, --help show help and exit -n, --name jenkins pipeline job name, (default: docker deploy project name) -s, --ssh ssh node info, the docker deploy project on the node host: ssh host port: ssh port, (default: 22) certId: cert id configed in jenkins using 'Username with password' kind -y assume Yes and do not prompt URL: jenkins service http(s) url, (example: http://127.0.0.1:8080) ``` #### 功能演示 ##### 快速创建java maven部署项目 - [以github上开源项目Kafdrop为例](docs/java/kafdrop.md) #### 附录 - 安装docker: ``` shell bash <(curl -L -s https://get.docker.com/) ``` - 安装docker-compose ``` shell curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION:-v2.14.0}/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose ```