【云星数据---mesos实战系列003】:marathon实战008--marathon部署一套最简单的前端程序

本文介绍如何使用Marathon和Mesos部署一个简单的前端程序。包括创建web工程、编写Dockerfile及Marathon配置文件,并验证部署结果。

marathon部署一套最简单的前端程序

1.要求:

  成功部署一个index.html到Nginx.

2.实现:

1.建立一个最简单的web工程 first-portal,目录结构如下:
这里写图片描述

说明: 
    index.html是主要的入口文件。
    images中存储的是index.html中使用的图片(用于测试)
    Dockerfile是改工程的docker编译文件,用于打包docker镜像

2.Dockerfile中的内容如下:

FROM nginx
COPY index.html /usr/share/nginx/html/index.html
COPY images/  /usr/share/nginx/html/images/

3.marathon部署文件如下:

cat Marathon.json

{
  "id": "/bigdata-common-frontend-services/first-portal-service",
  "container": {
    "type": "DOCKER",
    "docker": {
      "image": "10.100.134.3:5000/bigdata-common-frontend-services/first-portal-service",
      "network": "BRIDGE",
      "forcePullImage": true,
      "portMappings": [
        {
          "hostPort": 0,
          "containerPort": 80,
          "protocol": "tcp"
        }
      ]
    }
  },
  "healthChecks": [
    {
      "protocol": "HTTP",
      "portIndex": 0,
      "path": "/",
      "gracePeriodSeconds": 5,
      "intervalSeconds": 20,
      "maxConsecutiveFailures": 3
    }
  ],
  "instances": 1,
  "cpus": 0.4,
  "mem": 128
}

3.测试:

    1.查看marathon提供的端口
    2.使用浏览器能访问到index.html

4.说明:

    1.通过部署一个最简单的web应用,来验证自定义前端。
    2.使用marathon+mesos来实现管理docker容器的目的。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值