Setting up a Multi-Cloud CI/CD Chain using Alibaba Tools

These days, having a continuous integration and delivery (CI/CD) pipeline in place is pretty much essential for any kind of software development. Therefore, the question isn’t so much if you should set up a CI/CD pipeline, but how.

And when it comes to the how of CI/CD, you have a lot of options. There are countless CI/CD solutions on the market, including commercial as well as open source platforms, both of which have their own distinct advantages and disadvantages over the other.

In this article, I outline the reasons why you may wish to use a commercial CI/CD platform, then walk through the steps of taking advantage of tools on Alibaba Cloud that allow you to set up a production-ready CI/CD pipeline.

Commercial vs Open Source

A commercial CI/CD platform is typically a hosted service that deals with the build and deployment steps in a standard pipeline. While there are privacy concerns that can be raised with commercial platforms, and the cost is generally higher than self-hosted solutions, they are a great way to establish a CI/CD pipeline with minimal resources. In addition to hosted services, on-premises commercial CI/CD solutions are available as well, which can help get around the privacy and security concerns that exist with hosted services.

Many commercial CI/CD platforms give back to the developer community by open-sourcing their CI/CD engines. While not every commercial platform open-sources their engine, and not every open source engine is backed by a commercial platform, these solutions provide a lot more control at the expense of ease-of-use. Spinning up an open source CI/CD platform is significantly more involved, and requires some sort of server to run on. Open source platforms are an excellent option for organizations that require more resources for their build processes, or even organizations that simply prefer to keep their code in-house whenever possible.

Alibaba + CI/CD

When it comes to hosting an application on Alibaba Cloud, both CI/CD solutions are viable—depending on the needs and use-cases of the application. To demonstrate, let's take a look at how to accomplish running remote commands and deploying a simple application using either a commercial or open source CI/CD platform. While the configuration of open source and commercial solutions differ, the process of actually implementing a CI/CD pipeline is pretty similar across the board, and interacting with servers—both in a private and public cloud—comes down to two commands: rsync and ssh.

Deployments in a Nutshell

Before we get started, let's assume that our CI/CD pipeline consists of only three parts: test -> build -> deploy. While the test and build processes can happen directly within the platform, deploying a build means that we will have to get creative with our deployment method. Some cloud providers offer APIs that make this solution feel more streamlined, but at a high level, the following method will work with any VPS. Thankfully, we can deploy any built code to a running ECS instance using standard shell commands:

rsync -r --delete-after --quiet /path/to/build <ssh-user>@<ecs-host>:path/to/files

rsync is a command line utility that is used to synchronize files across servers. It has been around for a while—The rsync algorithm is well-known as having been used by Dropbox to deal with file synchronization. The beauty of this deployment method is that it can be used regardless of the hosting provider you use, which means that you can deploy to multiple cloud providers simultaneously, both internally at Alibaba Cloud, and externally.

It is important to note that, in order to successfully authenticate to our ECS instance, you will have to generate an SSH key and give your CI/CD platform access to it. While out of the scope of this article, Digital Ocean has an excellent guide for generating SSH keys. (Take note: If you follow the Digital Ocean guide, you should not set up an SSH passphrase—otherwise your automated deploy process won't be able to use your key.)

Executing Commands

Now, imagine that we need to execute a new command on our CI/CD pipeline. Let's say, for example, that after deployment we need to run database migrations on ApsaraDB, updating our pipeline to test -> build -> deploy -> migrate. As with the above deployment command, this can be accomplished through a simple SSH command:

ssh <ssh-user>@<ecs-host> -C "<migration-command>"

The -C option of the SSH command will execute any command within the login shell you have created. Using this principle, we can accomplish significantly more than running simple database migrations. This allows us to interact with various Alibaba Cloud services, such as clearing a cache that is stored in ApsaraDB for Redis, which can only be accessed from within the Alibaba Cloud Intranet.

Next Steps

While the above commands are enough to deploy and interact with any VPS at a basic level, building out a more robust pipeline using the Alibaba Cloud API will give you far more control. It will give you the ability to more programmatically interact with resources, manage your load balancers, automatically provision staging servers, and more. This solution is far more involved, but will provide you with the same level of control you can find with other fully integrated CI/CD hosting platforms. When it comes down to it, building a proper CI/CD pipeline is about planning and automation, not the specific tool you use. Given the right commands, anything is possible, no matter what platform you use.

Bio

Zachary Flower (@zachflower) is a Fixate IO Contributor and lead developer at Emerson Stone, a Boulder-based design and branding agency. He has an eye for simplicity and usability, and strives to build products with both the end user and business goals in mind. From building projects for the NSA to creating features for companies like Name.com and Buffer, Zach has always taken a strong stand against needlessly reinventing the wheel, often advocating for the use of well established third-party and open source services and solutions to improve the efficiency and reliability of a development project.

时间: 2024-12-25 14:18:11

Setting up a Multi-Cloud CI/CD Chain using Alibaba Tools的相关文章

让天下没有难做的研发:解读阿里CI/CD、DevOps、分层自动化技术

在互联网时代,产品快速迭代的重要性不言而喻.不管是传统企业还是初创企业,在提升研发效能方面都有很强的需求,如果能使用一套对项目流程管理和专项自动化提效工具,来支持项目的快速迭代发布,实现24小时持续集成.持续交付整个流程,不但可以提高研发效率,还能增强产品的竞争力! 1月12日,阿里巴巴旗下一站式研发提效平台--云效联手 InfoQ 在阿里巴巴西溪园区举办了一场旨在帮助研发团队提升研发效率的线下沙龙,邀请了阿里巴巴技术专家之岳.许晓斌.鲁小川和一佛,分享了阿里云效平台从生态规划,到 CI/CD

唱吧DevOps的落地,微服务CI/CD的范本技术解读

1.业务架构:从单体式到微服务 K歌亭是唱吧的一条新业务线,旨在提供线下便捷的快餐式K歌方式,用户可以在一个电话亭大小的空间里完成K歌体验.K歌亭在客户端有VOD.微信和Web共三个交互入口,业务复杂度较高,如长连接池服务.用户系统服务.商户系统.增量更新服务.ERP等.对于服务端的稳定性要求也很高,因为K歌亭摆放地点不固定,很多场所的运营活动会造成突发流量. 为了快速开发上线,K歌亭项目最初采用的是传统的单体式架构,但是随着时间的推移,需求的迭代速度变得很快,代码冗余变多,经常会出现牵一发动全

唱吧DevOps的落地,微服务CI/CD的范本技术解读----最大的难点并不是实际业务代码的编写,而是服务的监控和调试以及容器的编排

1.业务架构:从单体式到微服务 K歌亭是唱吧的一条新业务线,旨在提供线下便捷的快餐式K歌方式,用户可以在一个电话亭大小的空间里完成K歌体验.K歌亭在客户端有VOD.微信和Web共三个交互入口,业务复杂度较高,如长连接池服务.用户系统服务.商户系统.增量更新服务.ERP等.对于服务端的稳定性要求也很高,因为K歌亭摆放地点不固定,很多场所的运营活动会造成突发流量. 为了快速开发上线,K歌亭项目最初采用的是传统的单体式架构,但是随着时间的推移,需求的迭代速度变得很快,代码冗余变多,经常会出现牵一发动全

基于Docker的CI/CD流水线实践

本文讲的是基于Docker的CI/CD流水线实践[编者的话]随着DevOps理念不断的传播,大部分IT从业者对于DevOps本身也有了一定的了解和认识,然而企业内部想根据DevOps思想实践,这并不是一件很简单的事情.一方面由于企业内部的历史环境以及组织结构问题,另外一方面因为业界并没有一套标准的开源工具集可以借鉴(关于几家基于Docker创业的服务提供商暂时除外). [3 天烧脑式容器存储网络训练营 | 深圳站]本次培训以容器存储和网络为主题,包括:Docker Plugin.Docker s

专访阿里巴巴B2B事业群高级专家鲁小川:CI&amp;CD的核心还是在于高效稳定的自动化

杭州·云栖大会将于2016年10月13-16日在云栖小镇举办,在这场标签为互联网.创新.创业的云计算盛宴上,众多行业精英都将在这几天里分享超过450个演讲主题. 为了帮助大家进一步了解这场全球前言技术共振盛会的内容,采访了各个论坛的大咖,以飨读者. 以下为正文: 鲁小川,阿里巴巴B2B事业群高级专家,主要负责阿里巴巴云效平台解决方案服务输出.在此之前是阿里巴巴B2B持续集成与持续交付系统宙斯盾系统平台(内部服务系统名称)的核心开发人员之一,负责系统的架构设计及代码研发,在测试自动化.测试环境.持

Kubernetes集群上基于Jenkins的CI/CD流程实践

本节我们通过在Kubernetes集群上创建并配置Jenkins Server实现应用开发管理的CI/CD流程,并且利用Kubernetes-Jenkins-Plugin实现动态的按需扩展jenkins-slave. 安装Kubernetes集群 首先,如果您没有Kubernetes集群,那么您需要创建一个.参见创建集群 安装Jenkins Server 为了让您的Jenkins Server可以具有Fail Over的能力,建议您将Jenkins的数据存储到阿里云NAS存储上. 步骤一: 首先

企业级互联网架构下CI/CD实践

摘要:本文的整理自2017云栖大会-成都峰会上阿里云高级技术专家许晓的分享讲义,讲义主要介绍了企业级互联网架构下CI/CD实践的相关内容,通过对阿里巴巴内部的实践效果介绍引出分析实际交付案例,支撑业务并行持续交付解决方案,建立面向CI/CD/DevOps的一站式研发效能平台. 在2017云栖大会-成都峰会上,阿里云高级技术专家许晓做了题为<企业级互联网架构下CI/CD实践>的分享.传统 IT 项目管理模式有其时代背景,越来越难适应快速创新周期.现代企业转型目标是技术促进业务实现快速.降低交付周

云原生(Cloud Native)- 移动App研发新范式

什么是云原生(Cloud Native)App 云原生的话题近期异常火热,对于它的概念,大家也有不同的解读.从我个人的视角而言,云原生代表了一种应用构建的方法论:如何最大程度地利用云计算服务模型的优势低成本.快速地构建一款弹性的应用.本质上而言,云原生的研发模型旨在降低业务的技术风险,让开发者的形态更单纯.专注: 所有的运行环境透明化,按需扩展: 所有的研发流程流水化,高效交付: 所有的基础设施服务化,按量付费: 云原生应用 我们通常意义下的云原生应用意指传统的后端应用,Container.Mi

在阿里云容器服务上,轻松搭建Concourse CI

Concourse CI是一款CI/CD工具,它的魅力在于极简设计,被广泛应用于Cloud Foundry各个模块的CI/CD.阿里云也推出了CI工具CodePipeline,开箱即用,推荐试用. Concourse CI官方提供了标准的Docker镜像,在阿里云容器服务部署一套 Concourse CI应用是很轻松的一件事儿. 准备Docker集群 首先,在阿里云容器服务控制台创建一个集群.简单起见,这里节点数为1,网络类型为经典网络. 集群创建过程大约几分钟,成功后的状态如下图: 然后需要开