当前位置: 首页 > 编程日记 > 正文

k8s aws 部署_如何在短短30分钟内使用CircleCI设置到AWS S3的持续部署

k8s aws 部署

by Adam Watt

通过亚当·瓦特

如何在短短30分钟内使用CircleCI设置到AWS S3的持续部署 (How to setup Continuous Deployment to AWS S3 using CircleCI in just 30 minutes)

Continuous Deployment might seem complicated at first, but don’t be intimidated. In this tutorial, I’ll show you how to implement Continuous Deployment to AWS S3 for a static website using CircleCI in less than 30 minutes.

乍一看,连续部署似乎很复杂,但不要被吓倒。 在本教程中,我将向您展示如何在不到30分钟的时间内使用CircleCI将静态网站实施到AWS S3的持续部署。

You’ll need both an AWS account and a CircleCI account. If you don’t have these yet, start by opening a free account for AWS here and a free CircleCI account here . Both AWS and CircleCI have a free tier that’s more than enough for what you will need for this tutorial.

您将同时需要一个AWS账户和一个CircleCI账户。 如果您还没有这些,请先在此处开设一个免费的AWS帐户,然后在此处开设一个免费的CircleCI帐户。 AWS和CircleCI都有免费层,足以满足本教程所需。

获取代码 (Getting the code)

First you will start by forking and cloning the following project repo on Github: S3ContinuousDeploy or if you prefer you can try this tutorial with one of your own repos as long as it’s a static site.

首先,您将在Github上创建并克隆以下项目存储库: S3ContinuousDeploy,或者,如果您愿意,可以使用自己的存储库尝试本教程,只要它是静态站点即可。

Next you will add the project to your CircleCI account.

接下来,将项目添加到CircleCI帐户。

Next select the S3ContinuousDeploy repo you just cloned and click build project.

接下来,选择刚刚克隆的S3ContinuousDeploy存储库,然后单击build project。

At this point the build will run, but you will be getting an error message warning you that the settings for your project couldn’t be detected. Which is normal since we don’t have a circle.yml configuration file in place, which is what you will be doing next.

此时,构建将运行,但是您将收到一条错误消息,警告您无法检测到项目的设置。 这是正常的,因为我们没有适当的circle.yml配置文件,这是您下一步要做的。

Looking at the docs at CircleCI you can get an idea of what the circle.yml should look like. Unfortunately the circle.yml file example provided will not work as is and will need some tweaking, so let’s do that.

查看CircleCI上的文档,您可以了解circle.yml的外观。 不幸的是,提供的circle.yml文件示例无法按原样工作,并且需要进行一些调整,所以让我们开始吧。

Below is the modified circle.yml file you will be using:

以下是您将使用的修改后的circle.yml文件:

Basically CircleCI creates the build within a Docker container, and the override under dependencies property (line 3) that I added instructs CircleCI to install the AWS command line interface (awscli) that will be used in this case to help manage and facilitate deployment to AWS S3.

基本上,CircleCI在Docker容器内创建构建,我添加的覆盖项依赖项属性(第3行)之下指示CircleCI安装AWS命令行界面(awscli),在这种情况下将用于帮助管理和促进向AWS的部署S3。

So make sure you add the file and commit it to your repo. Finally make sure you push this and other commits you might have made before you proceed to the next step.

因此,请确保您添加了文件并将其提交到您的仓库中。 最后,在继续下一步之前,请确保已推送此提交以及其他可能提交的提交。

As per CircleCI documentation the command for deploying is:

根据CircleCI文档,部署命令为:

The path-to-file was a bit tricky to figure out but by looking at the error logs I was able to finally get it right: home\ubuntu\projectName. So just replace projectName with the name of your project, in my case that will be S3ContinuousDeploy.

文件路径有点棘手,但是通过查看错误日志,我终于可以正确地找到它:home \ ubuntu \ projectName。 因此,只需将projectName替换为您的项目名称,在我的情况下为S3ContinuousDeploy。

The S3://bucket-URL on the other hand is not correct and should be S3://bucket-Name. Right now we don’t have a bucket name, so let’s get ourselves a bucket.

另一方面,S3:// bucket-URL不正确,应为S3:// bucket-Name。 现在我们没有存储桶名称,所以让我们自己获得一个存储桶。

创建S3存储桶 (Creating the S3 bucket)

In this step we will be heading to the AWS Console to create the S3 bucket for this project:

在此步骤中,我们将前往AWS控制台为该项目创建S3存储桶:

Enter the bucket name you would like to use for this project as well as the region. (The best practice is to use the region nearest to your site’s audience.)

输入您要用于此项目的存储区名称以及区域。 (最佳做法是使用距您的网站受众最近的区域。)

You will skip the other steps for now so press “Next” and then press “Create bucket” on the review screen.

您现在将跳过其他步骤,因此在查看屏幕上按“下一步”,然后按“创建存储桶”。

At this point if you go back to CircleCI and try to run the build again CircleCI will return a fatal error: Unable to locate credentials. So why don’t we fix that next.

此时,如果您返回CircleCI并尝试再次运行该构建,CircleCI将返回一个致命错误:无法找到凭据。 那么,为什么我们接下来不解决这个问题呢?

We need to first get the credentials from AWS and then provide them to CircleCI in order to allow the AWS cli to access and manage the S3 bucket. Best practice for this is to create a new Identity and Access Management (IAM) user specifically for CircleCI.

我们需要首先从AWS获取证书,然后将其提供给CircleCI,以允许AWS cli访问和管理S3存储桶。 最佳做法是为CircleCI创建一个新的身份和访问管理(IAM)用户。

On the AWS console go to Security, Identity & Compliance and press IAM and then Add user.

在AWS控制台上,转到安全,身份和合规性,然后按IAM,然后按添加用户。

In the Add User window type in CircleCI for User name, I already have an IAM user named CircleCI setup, So for the purposes of this tutorial and to illustrate these steps I will be using CircleCI2. Make sure you check Programmatic access for Access type.

在CircleCI中为用户名输入Add User窗口中,我已经有一个名为CircleCI setup的IAM用户,因此,出于本教程的目的并说明这些步骤,我将使用CircleCI2。 确保选中“访问程序类型”的“程序访问”。

For permissions choose Attach existing policies directly, and under Policy name check ‘AdministratorAccess’ and then click Create policy. This will provide your IAM user full access to your AWS S3 bucket.

对于权限,选择“直接附加现有策略”,然后在“策略名称”下选中“ AdministratorAccess”,然后单击“创建策略”。 这将为您的IAM用户提供对您的AWS S3存储桶的完全访问权限。

After creating the IAM user, make sure you keep both the Access key ID and the Secret access key, as we will need them in the next step.

创建IAM用户后,请确保同时保留访问密钥ID和秘密访问密钥,因为在下一步中我们将需要它们。

Now back to CircleCI, click on the settings button next to your project name to reveal the project settings menu then click on AWS Permissions. This is where you will paste the ID and Key from the previous step and then click “Save AWS keys.”

现在回到CircleCI,单击项目名称旁边的设置按钮以显示项目设置菜单,然后单击AWS Permissions。 在此处,您将粘贴上一步中的ID和密钥,然后单击“保存AWS密钥”。

Now our CircleCI Container has both the AWS Command Line Interface tool and the credentials to access the AWS S3 bucket. The following steps will show you how to reveal your static site to the world.

现在,我们的CircleCI容器同时具有AWS Command Line Interface工具和访问AWS S3存储桶的凭据。 以下步骤将向您展示如何向世界展示您的静态站点。

In the AWS console go to Storage and then click on S3 and then click on the bucket we created earlier in this tutorial.

在AWS控制台中,转到存储,然后单击S3,然后单击我们在本教程前面创建的存储桶。

You will notice that the code from the repo has already been successfully deployed.

您会注意到,来自存储库的代码已经成功部署。

Now before you can access this static site you need to configure your S3 bucket for website hosting.

现在,在您可以访问此静态站点之前,您需要配置S3存储桶以用于网站托管。

On the same screen click on Properties and then on Static website hosting.

在同一屏幕上,单击“属性”,然后单击“静态网站托管”。

In the following screen select Use this bucket to host a website and make sure you type in index.html for Index document.

在以下屏幕中,选择“使用此存储桶托管网站”,并确保您输入Index.html作为“索引”文档。

By the way, the HTTP address provided above is your access endpoint. But if you try it in the browser unfortunately it won’t work and you will get an access denied error message. But that’s normal you still have one step to do: Set up your bucket policy.

顺便说一下,上面提供的HTTP地址是您的访问端点。 但是,不幸的是,如果您在浏览器中尝试它,它将无法正常工作,并且您将收到拒绝访问的错误消息。 但这是正常的,您仍然有一个步骤要做:设置存储桶策略。

This Bucket policy will allow access to the AWS S3 bucket to anyone via a browser.

此存储桶策略将允许任何人通过浏览器访问AWS S3存储桶。

You can read up here on bucket policies and examples if you want to learn more.

如果您想了解更多信息,可以在这里阅读存储桶策略和示例。

Now you can copy the code snippet above and paste it in your Bucket policy Editor and Voila!

现在,您可以复制上面的代码片段并将其粘贴到存储桶策略编辑器和Voila中!

If you see the screen above, then Congratulations! You have successfully set up Continuous Deployment to an AWS S3 bucket using CircleCI.

如果您看到上面的屏幕,那么恭喜! 您已使用CircleCI成功设置了对AWS S3存储桶的持续部署。

Now every time you push changes to your Github repo, CircleCI will automatically deploy the changes to your AWS S3 bucket.

现在,每次将更改推送到Github存储库时,CircleCI都会自动将更改部署到您的AWS S3存储桶。

You might have noticed that even though the deployment was successful CircleCI shows you a red NO TESTS warning.

您可能已经注意到,即使部署成功,CircleCI也会显示红色的NO TESTS警告。

This is normal because in a Test Driven Development (TDD) environment you would write tests first, and then before going to production your code needs to pass all the tests. An example with tests is beyond the scope of this tutorial, but suffice it to say that had we written tests, CircleCI would only have deployed if all our tests passed.

这是正常现象,因为在测试驱动开发(TDD)环境中,您将首先编写测试,然后在生产之前,您的代码需要通过所有测试。 关于测试的示例不在本教程的讨论范围之内,但是可以说,如果我们编写了测试,那么只有在所有测试通过的情况下,CircleCI才会部署。

Using your own domain name to access this static site is also beyond the scope of this tutorial, but feel free to look here for instructions on how to configure Amazon Route 53 to route Internet traffic to your new site.

使用您自己的域名访问此静态站点也超出了本教程的范围,但是请随时在此处查找有关如何配置Amazon Route 53将Internet流量路由到新站点的说明。

I am hoping to do a tutorial involving a Continuous Integration/Deployment example with a full battery of tests sometimes in the future. Meanwhile, if you have a moment, answer a short survey about this tutorial here, like it on LinkedIn or post a comment in the comments section.

我希望将来能做一个涉及持续集成/部署示例的教程,其中包含全部测试。 同时,如果您有时间,请在此处回答有关本教程的简短调查,在LinkedIn上喜欢它,或在评论部分中发表评论。

Thanks for reading!

谢谢阅读!

翻译自: https://www.freecodecamp.org/news/how-to-set-up-continuous-deployment-to-aws-s3-using-circleci-in-under-30-minutes-a8e268284098/

k8s aws 部署

相关文章:

SharePoint 2010 单点登录

SharePoint2010单点登录 1.进入管理中心》应用程序管理 2.找到 Secure Store Service 应用程序代理 3.然后就是新建了 5.输入网站集管理员 6.这个时候SharePoint就知道你需要给OA这个系统做单点登录了。 7.下一步就是我们要把我们进OA系统的帐号密码告诉SharePoint&#xff0c…

Java IO流学习总结三:缓冲流-BufferedInputStream、BufferedOutputStream

Java IO流学习总结三:缓冲流-BufferedInputStream、BufferedOutputStream 转载请标明出处:http://blog.csdn.net/zhaoyanjun6/article/details/54894451 本文出自【赵彦军的博客】 InputStream |__FilterInputStream|__BufferedInputStream 首先抛出一个…

7-flutter Navigator 和Route

Route 和 Navigator 用于页面之间的跳转 一 Navigator 的 push 和 pop 用于页面之间的跳转 创建MaterialApp时可以指定routes参数,该参数是一个映射路由名称和构造器的Map 跳转的时候 使用 push 跳回的时候使用 pop import package:flutter/cupertino.dart; im…

小规模网络数据公开数据_大规模的在线公开课程曾经是100%免费的。 但是他们没有那样做。...

小规模网络数据公开数据I took one of the first Massive Open Online Courses (MOOCs) in 2011. Back then, everything was 100% free: the videos, the assignments, and the certificates. But in 2017, you can’t find this sort of free learning experience anymore.我…

swift -charts框架雷达图

参考资料 import UIKit import Chartsclass ViewController: UIViewController {let activities ["力量", "敏捷", "生命", "智力", "魔法"]override func viewDidLoad() {super.viewDidLoad()// Do any additional setup…

vector容器总结.xml

1 清空所有元素m_itemVector.clear(); 2 遍历vector<ITEM_CHECK>::iterator iterm_itemVector.begin(); for(i0;iter!m_itemVector.end();iter,i) { if(iter->flag-1) { break; } iter->flag1; } vector<ITEM_CHECK>::iterator iterm_itemVector.b…

Syncthing源码解析 - 第三方库

1&#xff0c;AudriusButkevicius/cli 网址&#xff1a;https://github.com/AudriusButkevicius/cli 2&#xff0c;bkaradzic/go-lz4 网址&#xff1a;https://github.com/bkaradzic/go-lz4 3&#xff0c;calmh 备注&#xff1a;这位是Syncthing项目创立者和最主要的开发者&…

安全工程师2017年真题_以下是2017年全球软件工程师的平均薪水

安全工程师2017年真题And here are those same salaries adjusted to San Francisco’s cost of living:以下是根据旧金山的生活费用调整后的相同工资&#xff1a; As you can see, cost of living is an important consideration. Also, you don’t need to move to San Fran…

测试思想 什么是软件测试(摘录)

什么是软件测试(摘录) by:授客 QQ&#xff1a;1033553122 IEEE 标准的定义:使用人工或自动的手段来运行或测定某个系统的过程&#xff0c;其目的在于检验;它是否满足规定的需求或是弄清预期结果与实际结果之间的差别。对软件测试还有一些不同的定义。 G.J.Myers给出的定义:“程…

8-flutter 异步和线程

线程和异步的UI 1 异步的使用 Dart 有一个单线程执行模型&#xff0c;支持Isolate&#xff08;一种在另外一种线程运行dart的方法&#xff09;,一个事件循环和异步编程。 可以使用async / await 来做网络请求不会挂起UI 使用http 导入 import ‘dart:io’; import ‘dart:c…

前端页面紫红色_谷歌正在开发一种神秘的新型移动操作系统,称为紫红色

前端页面紫红色Google seems to be building a replacement for Android called Fuchsia. Yesterday, they revealed what their new Armadillo user interface looks like (see photo above, courtesy of Ars Technica).谷歌似乎正在建立一个名为Fuchsia的 Android替代产品。 …

iOS UIButton 文字图片上下左右布局

例如文字在左 图片在右,iOS 9 之后一句话搞定 backBtn.semanticContentAttribute UISemanticContentAttributeForceRightToLeft;按钮标题居左实现 dateBtn.contentHorizontalAlignment UIControlContentHorizontalAlignmentLeft; dateBtn.contentEdgeInsets UIEdgeInsetsMak…

linux xampp eclipse xdebug 无法进入断点

一、xampp 版本 1.8.3-5 xampp安装后会自动集成xdebug,目录一般为 /opt/lampp/lib/php/extensions/***-debug-***目录 关于php 与php.ini路径 php程序路径为&#xff1a;/opt/lampp/bin/ php.ini配置文件路径为&#xff1a;/opt/lampp/etc/ 1、配置文件一般在/opt/lampp/etc/ph…

sliva数据库简介--转载

sliva rRNA数据库&#xff08;http://www.arb-silva.de/&#xff09;用来检查和比对RNA序列&#xff0c;既可以针对16S/18S,SSU&#xff0c;也可以针对23S/28S, LSU&#xff0c;包括了Bacteria, Archaea and Eukarya。同时也是ARB的官方指定数据库。 LSU: Large subunit (23S/2…

haproxy ssl_我们如何微调HAProxy以实现2,000,000个并发SSL连接

haproxy sslby Sachin Malhotra由Sachin Malhotra 我们如何微调HAProxy以实现2,000,000个并发SSL连接 (How we fine-tuned HAProxy to achieve 2,000,000 concurrent SSL connections) If you look at the above screenshot closely, you’ll find two important pieces of in…

OC文件操作(1)

1.文件的浅度遍历与深度遍历&#xff1a; //NSFileManager * fm [[NSFileManager alloc]init];//创建文件管理器 //第一步创建一个文件管理器 NSError * error nil; //显示路径下的内容,作用类似于ls -a指令 //返回值是把目录下的内容放到NSArray中 //浅度遍历 NSFileManager …

10-flutter 使用http包请求和网络指示器

使用http package 进行网络请求操作 1 安装步骤 Step1 在pubspec.yaml 文件中添加依赖 dependencies:http: ^0.12.01Step2 flutter packages getStep3 导入头文件 import ‘package:http/http.dart’ as http; 2 使用 var responseBody;http.Response response await http.…

使用nat方式解决虚拟机联网问题

本文全文参考&#xff1a;http://jingyan.baidu.com/album/4e5b3e1957979d91901e24f1.html?picindex1&#xff0c;谢谢 对于很多的linux初学者来说&#xff0c;最开始学习linux时通常是在虚拟机上进行的&#xff0c;然而对于新手来说虚拟机联网会对他们来说是比较困难的。…

老年痴呆 数字化_设计老年人愉快数字体验的5条原则

老年痴呆 数字化by Kaye Mao毛凯(Kaye Mao) 设计老年人愉快数字体验的5条原则 (5 Principles for Designing Delightful Digital Experiences for Seniors) When we got my grandfather his first smart phone, he was thrilled. He had heard all about the wonders of video…

hdu 3664 1~n排列(aii ) 为k个数

http://acm.hdu.edu.cn/showproblem.php?pid3664 求1~n的排列个数&#xff0c;使得逆序数&#xff08;ai>i ) 为给定的k. dp[i][j]表示前1~i的排列中&#xff0c;有j个数是逆序数的个数. #include <cstdio> #include <cstdlib> #include <cmath> #includ…

四边参数值的设定

border&#xff0c;margin&#xff0c;padding 拿border举例 border&#xff1a;上&#xff0c;右&#xff0c;下&#xff0c;左。 border&#xff1a;上下&#xff0c;左右。 border&#xff1a;上下左右。 border&#xff1a;上&#xff0c;左右&#xff0c;下。转载于:https…

11-flutter事件监听

事件监听 1 本身支持事件检测&#xff0c;就可以直接使用onpress body:Center(child: RaisedButton(child: Text("Click"),onPressed: (){print("我被Click了");}),),2 如果本身不支持事件的检测&#xff0c; 使用 GestureDetector 添加一个点击事件 hom…

react前端开发_是的,React正在接管前端开发。 问题是为什么。

react前端开发by Samer Buna通过Samer Buna 是的&#xff0c;React正在接管前端开发。 问题是为什么。 (Yes, React is taking over front-end development. The question is why.) Update: This article is now part of my book “React.js Beyond The Basics”.更新&#xf…

12-flutter Textfield的使用

获取用户的输入用 TextField 或者TextFormField 的实现&#xff0c;通过控制器来实现获取用户的输入。 1 TextField 的属性 const TextField({Key key,this.controller,this.focusNode,// 这个属性可以用来监听输入框是否获取this.decoration const InputDecoration(),Text…

MyEclipse10整合Axis2插件

1、下载axis2的eclipse插件 2、把下载好的两个插件包解压后放置myeclipse10安装目录下的dropins文件夹中 3、重启MyEclipse10后 File->New->Other 到此Axis2插件安装完毕。 转载于:https://www.cnblogs.com/dreammyle/p/4036224.html

STM32GPIO管脚设置

&#xff08;1&#xff09;GPIO_Mode_AIN 模拟输入 &#xff08;2&#xff09;GPIO_Mode_IN_FLOATING 浮空输入&#xff08;3&#xff09;GPIO_Mode_IPD 下拉输入 &#xff08;4&#xff09;GPIO_Mode_IPU 上拉输入 &#xff08;5&#xff09;GPIO_Mode_Out_OD 开漏输出&#x…

数据结构中等号表示什么_通过分析2016年最重要的252个中等故事我学到了什么...

数据结构中等号表示什么Medium may be struggling to find a sustainable business model, but they have years worth of funding left, and more readers than ever.中型企业可能很难找到一种可持续的商业模式&#xff0c;但他们还有数年的可用资金&#xff0c;而且读者比以往…

event事件

10.2.6 事件传播 当事件目标是Window对象或其他一些单独对象&#xff08;比如XMLHttpRequest&#xff09;时&#xff0c;浏览器会简单的通过调用对象上适当的处理程序响应事件。 在调用在目标元素上注册的事件处理函数后&#xff0c;大部分事件会“冒泡”到DOM树根。 发生在文档…

[原创]用命令行工具删除TFS2010服务器上的工作区信息

下面的示例显示有关所有计算机上的所有用户已在地址 http://myserver:8080/tfs/DefaultCollection 上的以下团队项目集合中创建的所有工作区的列表。 c:\projects>tf workspaces /owner:*/computer:* /collection:http://myserver:8080/tfs/DefaultCollection tf workspace …

13-flutter 加载图片

Image Widget 1 flutter 加载图片的方式 new Image从ImageProvider 中获取图像new Image.asset使用key 从assetBundle 获取图片Image.network从网络中获取图片Image.file从本地文件获取图片Image.memory用来加载Uint8List资源&#xff08;字节数组&#xff09;图片 2 image 支…