• Z5_318834
    了解作者
  • 100.3KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-15 09:17
    上传日期
使用GoCD,Docker和Mesos的微服务演示部署管道 该项目用作示例部署管道,以作为Apache Mesos集群中的Docker容器来构建,部署和测试微服务。 部署管道 在项目的/vagrant目录中,运行vagrant up 。 该命令将启动三个虚拟机: mesos_master将安装Apache Mesos,并将vm配置为Mesos主节点。 mesos_slave将安装Apache Mesos,并将vm配置为Mesos从节点。 gocd GoCD服务器,本地GoCD代理和Docker私有注册表将安装在此vm上。 一旦启动了所有虚拟机,便可以使用以下应用程序: Mesos应该有两个从属节点:172.17.8.10和172.17.8.11 请注意,运行所有三个虚拟机将为每个虚拟机消耗4G物理内存。 如果要减少内存占用,请编辑/vagrant/vm-config.yml文件并
massive-octo-bear-master.zip
内容介绍
# Demonstration Deployment Pipeline for Micro-Services using GoCD, Docker and Mesos This project serves as example deployment pipeline to build, deploy and test micro-services as Docker containers in an Apache Mesos cluster. ## Deployment Pipeline From the project's ```/vagrant``` directory run ```vagrant up```. This command will start three virtual machines: * *mesos_master* Apache Mesos will be installed and the vm configured as a Mesos master node. * *mesos_slave* Apache Mesos will be installed and the vm configured as a Mesos slave node. * *gocd* GoCD server, a local GoCD agent, and Docker private registry will be installed on this vm. Once all virtual machines have been started, the following applications are available: * [GoCD Server](http://172.17.8.12:8153) * [Apache Mesos](http://172.17.8.10:5050) Mesos should have two slave nodes: 172.17.8.10 and 172.17.8.11 * [Apache Mesos Marathon Framework](http://172.17.8.10:8080) * [Apache Mesos Chronos Framework](http://172.17.8.10:8081) *Note* running all three virtual machines will consume 4G physical memory per virtual machine. If you want to reduce the memory footprint, edit the ```/vagrant/vm-config.yml``` file and set the memory for each virtual machine. Running the examples with less memory may introduce errors. ### Build GoCD Agents Before the example service projects can be built and deployed, several GoCD agents will need to be built and registered as agents. These agents are deployed as Docker containers on the GoCD virtual machine. Log into the [GoCD server](http://http://172.17.8.12:8153) and run the *Agent Pipeline.* After these jobs complete, there should be GoCD agents with labels: * *Java8* This agent can be used for building projects that use Java version 8. * *Cucumber* This agent can be used for BDD test execution. * *Docker* This agent is not a Docker container but deployed directly on the GoCD vm. It can be used to build or publish Docker images. ### Build and Deploy Micro-Services in Mesos Once all the GoCD agents are built and registered then the *BuildEchoService* pipeline can be executed. The pipeline will: 1. Build the example Java Echo Service application. 2. Assemble the Echo Service into a Docker image and publish the image into the private Docker registry. 3. Deploy the service and its dependent backing service Cassandra into Mesos via a Marathon Application Group. *TODO* Add automated tests for the Echo service pipeline. ### Docker Monitoring with cAdvisor All three virtual machines with Docker installed can be monitored with [cAdvisor](https://github.com/google/cadvisor). Once the virtual machines have been started, cAdvisor will be available at these URLs: * [GoCD Server cAdvisor](http://172.17.8.12:9999) * [Mesos Master cAdvisor](http://172.17.8.10:9999) * [Mesos Slave cAdvisor](http://172.17.8.11:9999) ## Service Projects Example micro-service projects can be found under ```/service/${language}``` directory. ### Java Echo Service The Java Echo service found under ```/service/java/echo``` is a simple REST service that can echo and log (persist to Cassandra) service requests. The service uses the following tools: * Dropwizard REST service framework: http://www.dropwizard.io/ * Google Dagger 2.0 Dependency Injection: http://google.github.io/dagger/ * Apache Cassandra Database: http://cassandra.apache.org/ * Gradle Build tool: https://gradle.org/ To build the service: * cd to ```/service/java/echo``` * run ```./gradlew shadowJar``` This will assemble an all inclusive shadow jar under ```/service/java/echo/build/libs```. #### Running Service Outside of Docker The service can be run locally if a Cassandra database is available. You will need the hostname or IP address of a Cassandra host in the Cassandra cluster. This hostname or IP address will be injected into the service configuration via the CASSANDRA_SEED_HOST environment variable. * cd to ```/service/java/echo``` * Run ```export CASSANDRA_SEED_HOSTS=${your cassandra seed host or ip address}``` * Run ```java -jar ./build/libs/echo-0.1-all.jar server echo-service.yml``` * ```curl localhost:8080/echo``` should return a json response from the service If you have started one of the Vagrant Docker boxes described above, by default they will run and expose Cassandra CQL port and its private network IP address can be used as the CASSANDRA_SEED_HOST. ## Tool Dependencies This project has been tested with the following tools. Using alternate versions might result in unexpected results. ### Workstation Host Platforms * Windows 7 (with msysGit Bash shell) * Linux Ubuntu 15.04 ### Local Virtual Machines * Vagrant version 1.7.2 * VirtualBox version 4.3.28 ### Java Services * Java JDK version 8
评论
    相关推荐