怎么部署项目解析域名
任务概述: (Task Overview :)
Here I’m trying to provide an solution for on-premise application deployments to enterprise clients and here i’m doing it for Atlan, So we are going to deploy Parse Server on a cluster of machines.
在这里,我试图为企业客户端的本地应用程序部署提供一个解决方案,在这里,我为Atlan做到这一点,因此我们将在机器集群上部署Parse Server。
This is the list of some foreseeable problems related to an on-premise deployment, and i’m trying to solve it in this task!
这是与本地部署相关的一些可预见问题的列表,我正在尝试通过此任务解决它!
- Ease of clustered enterprise level deployments. 易于集群企业级部署。
- Incremental remotely triggered application updates. 增量远程触发的应用程序更新。
- Easy remote debugging. 简单的远程调试。
- Health Alerts and Monitoring. 健康警报和监视。
- Application Security (with source code protection). 应用程序安全性(具有源代码保护)。
- Disaster management. 灾害管理。
安装/使用说明: (Installation / Usage Instructions :)
So basically for reaching the solution requirement i’m using this below given Platform and software's:
因此,基本上为了达到解决方案要求,我在给定的平台和软件的下方使用了此功能:
Docker: Docker a tool designed to make it easier to create, deploy, and run applications by using containers.
Docker: Docker是一种工具,旨在使使用容器更轻松地创建,部署和运行应用程序。
Google Kubernetes Engine: GKE clusters are fully managed by Google Site Reliability Engineers, ensuring your cluster is available and up-to-date. GKE runs on Container-Optimized OS.
Google Kubernetes引擎: GKE群集由Google网站可靠性工程师完全管理,以确保您的群集可用且最新。 GKE在容器优化的OS上运行。
Google Cloud Platform: Google Cloud Platform is a suite of public cloud computing services offered by Google. The platform includes a range of hosted services for compute, storage and application development that run on Google hardware.
Google Cloud Platform: Google Cloud Platform是Google提供的一套公共云计算服务。 该平台包括一系列在Google硬件上运行的用于计算,存储和应用程序开发的托管服务。
Rancher: Rancher is an open source project that provides a container management platform built for organizations that deploy containers in production.
Rancher: Rancher是一个开放源代码项目,它为在生产中部署容器的组织提供了一个容器管理平台。
Helm & Helm Charts: Helm helps you manage Kubernetes applications and Helm Charts help you define, install, and upgrade even the most complex Kubernetes application.
Helm&Helm Charts: Helm帮助您管理Kubernetes应用程序,Helm Charts帮助您定义,安装和升级最复杂的Kubernetes应用程序。
Prometheus and Grafana: Prometheus is an open-source systems monitoring and alerting toolkit and Grafana is an open-source analytics and interactive visualization web application. It provides charts, graphs, and alerts for the web when connected to supported data sources.
Prometheus和Grafana: Prometheus是一个开源系统监视和警报工具包,而Grafana是一个开源分析和交互式可视化Web应用程序。 当连接到受支持的数据源时,它会为Web提供图表,图形和警报。
Weave Cloud: Weave Cloud is an automation and management platform for development and DevOps teams.
Weave Cloud: Weave Cloud是面向开发和DevOps团队的自动化和管理平台。
Velero: Velero is an open source tool to safely backup and restore, perform disaster recovery, and migrate Kubernetes cluster resources and persistent volumes.
Velero: Velero是一个开源工具,可安全地备份和还原,执行灾难恢复以及迁移Kubernetes集群资源和持久卷。
I am using Google Cloud Platform Compute-Engine VM instances for this task, So lets gets started for the deployment.
我正在为此任务使用Google Cloud Platform Compute-Engine VM实例,因此让我们开始进行部署。
Step-by-Step Detailed Overview:
分步详细概述:
Step 1:
第1步:
First I’m creating a Centos VM using Google Cloud Platform and then installing Docker on it. Once done with installing the Docker setup then i’m creating a Rancher container.
首先,我要使用Google Cloud Platform创建Centos VM,然后在其上安装Docker。 安装完Docker设置后,我将创建一个Rancher容器。
docker run -dti --restart unless-stopped -p 80:80 -p 443:443 rancher/rancher
using the above given link we will get running Rancher as container on port 80. We can access the web UI of Rancher using VM external IP.
使用上面给定的链接,我们将在端口80上将Rancher作为容器运行。我们可以使用VM外部IP访问Rancher的Web UI。
Then i’m setting up a admin password for further use.
然后,我要设置管理员密码以备将来使用。
Step 2:
第2步:
After successfully logged in to Rancher UI. I am creating a Kubernetes cluster for deploying Parse Server. Here I am using Google GKE (Google Kubernetes Engine) for creating a cluster with 3 nodes.
成功登录到Rancher UI之后。 我正在创建用于部署Parse Server的Kubernetes集群。 在这里,我使用Google GKE(Google Kubernetes引擎)创建具有3个节点的集群。
Then in Rancher Global tab select Clusters then Add Cluster and select Google GKE.
然后在“ Rancher全局”选项卡中,选择“群集”,然后选择“添加群集”,然后选择“ Google GKE”。
After selecting the Google GKE we will need GCP service account JSON Private key. Then go to GCP console and follow these steps for creating Key.
选择Google GKE之后,我们将需要GCP服务帐户JSON私钥。 然后转到GCP控制台,并按照以下步骤创建密钥。
Then Upload key to ‘Read from a File’ section and fill up the required fields. after that you will see active running cluster i.e provided by Google GKE. In my case I named it as ‘Atlantask’.
然后将密钥上传到“从文件读取”部分,并填写必填字段。 之后,您将看到正在运行的集群,即由Google GKE提供的集群。 就我而言,我将其命名为“ Atlantask”。
Step 3:
第三步:
In this step I am going to deploy the Parse Server application in ‘Atlantask’. Parse Server is a application that needs Database pod also, So here I am using MongoDB server in one pod and then installing Parse Server application in other pods.
在这一步中,我将在“ Atlantask”中部署Parse Server应用程序。 Parse Server是一个还需要数据库pod的应用程序,所以这里我在一个pod中使用MongoDB服务器,然后安装Parse Server 在其他广告连播中的应用。
So for this here I am using Helm Charts. Below are the steps to deploy Parse using Helm Chart.
所以在这里我使用舵图。 以下是使用Helm Chart部署Parse的步骤。
Go to Rancher Global then Tools then Catalogs and add a Helm catalog by entering this url:
依次转到Rancher Global,“工具”和“目录”,并通过输入以下URL添加Helm目录:
https://kubernetes-charts.storage.googleapis.com/
Then wait for it to turn into active state.
然后等待它变成活动状态。
Then Go to Rancher Global then in Apps and click Launch button.
然后转到Rancher Global,然后在Apps中单击启动按钮。
After that in the search bar, type “Parse” and you will see Parse Helm Chart available there.
之后,在搜索栏中输入“ Parse”,您将看到“ Parse Helm Chart”可用。
After that click on the Parse Helm Chart. Then type the name you want I am typing parseserver and also select Target Project Default.
之后,单击“解析舵图”。 然后输入您要输入的名称,即我输入parseserver的名称,然后选择“ Target Project Default”。
Then click on Launch. You will see it Active in some sec.
然后单击启动。 您会在几秒钟内看到它处于活动状态。
Then open Parse Server you can see 2 active pods one for MangoDB and one for Parse Server, And finally Parse Server is deployed Successfully on Kubernetes Cluster.
然后打开Parse Server,您会看到2个活动的Pod,一个用于MangoDB,一个用于Parse Server,最后,Parse Server成功地部署在Kubernetes Cluster上。
Step 4:
第4步:
For remotely triggered application updates I am using Weave Cloud for setting up a pipeline for this project. For making changes directly from the Source Repository via CI/CD pipleline.
对于远程触发的应用程序更新,我正在使用Weave Cloud来为此项目设置管道。 通过CI / CD管线直接从源代码库进行更改。
So, For this I am going to cloud.weave.works to manage CI/CD. In my case I already connected my cluster to Weave Cloud and named it is Atlan Task.
因此,为此,我要去cloud.weave.works管理CI / CD。 就我而言,我已经将集群连接到Weave Cloud,并将其命名为Atlan Task。
After successfully connected to the Weave Cloud. You will see all the live metrics, resources and graphs.
成功连接到Weave Cloud之后。 您将看到所有实时指标,资源和图表。
Now for the CI/CD click on the settings icon and then configure. Paste the Git source repository where configuration YAML is present.
现在,对于CI / CD,单击设置图标,然后进行配置。 将Git源存储库粘贴到存在配置YAML的位置。
Step 5:
步骤5:
In this step I am setting up Prometheus Monitoring and enabling Grafana Dashboard for live metrics monitoring.
在此步骤中,我将设置Prometheus Monitoring,并启用Grafana Dashboard进行实时指标监视。
For this go to Rancher Global then Clusters then Atlantask and then Dashboard
为此,先转到Rancher Global,然后依次到Clusters,Atlantask和Dashboard
After that click on Enable Monitoring to see live metrics it will also enable Grafana Dashboard for you. In my case I already done that part, You will see enable option there in highlighted yellow field.
之后,单击“启用监视”以查看实时指标,它还将为您启用Grafana仪表板。 就我而言,我已经完成了该部分,您将在突出显示的黄色字段中看到启用选项。
After clicking on any of Grafana icons. It will launch Grafana Dashboard. You will see beautiful graphical UI of Dashboard.
单击任何Grafana图标之后。 它将启动Grafana仪表板。 您将看到仪表盘的漂亮图形用户界面。
Step 6:
步骤6:
And in this last step I am setting up the Disaster management. After searching for backup tools I was able to find ‘Velero’ by Heptio to help me with backing up and restoring my Kubernetes cluster resources as well as persistent volumes.
在这最后一步中,我将设置灾难管理。 搜索备份工具后,我能够找到Heptio的“ Velero”来帮助我备份和还原我的Kubernetes集群资源以及持久卷。
Velero helps you with:
Velero可帮助您:
- Backup and restore of your Kubernetes cluster. 备份和还原Kubernetes集群
- Copy cluster resources from one cluster to another 将群集资源从一个群集复制到另一群集
- Replicate your production environment for development and testing environments. 复制生产环境以用于开发和测试环境。
For installing Install velero-cli. In my case I am installing it in GKE.
要安装,请安装velero-cli。 就我而言,我将其安装在GKE中。
brew install velero
Create a Google Cloud Storage bucket.
创建一个Google Cloud Storage存储桶。
gsutil mb gs://
Create service account / permissions / policies and then add credentials to your GKE Cluster.
创建服务帐户/权限/策略,然后将凭据添加到GKE群集。
To backup my entire cluster, I have used:
要备份整个集群,我使用了:
velero backup create atlantaskbk
To see the status of your backup just run:
要查看备份状态,请运行:
velero get backups
This tools have saved me tons of hours as well as greatly simplified the overall process of mapping, backing up and restoring Kubernetes resources .
该工具节省了我很多时间,并且大大简化了映射,备份和还原Kubernetes资源的整个过程。
用例,边缘条件和假设 (Use Cases, Edge Conditions and Assumptions)
- It is assumed that Source Code Protection is all managed by Professional coding team. 假定“源代码保护”全部由专业编码团队管理。
- Configuration.yaml file in GitHub is only a sample code file. It is assumed that it can be used for automatic triggered updates. GitHub中的Configuration.yaml文件只是示例代码文件。 假定它可用于自动触发的更新。
- It is assumed that clusters are managed by load balancers and can be scaled as per loads. 假定群集由负载平衡器管理,并且可以根据负载进行扩展。
- It is assumed that for saving up backup data we have good storage capacity and also it is stored in different Zone. 假设为了保存备份数据,我们具有良好的存储容量,并且将其存储在不同的区域中。
工作流程 (Workflow)
All the actions of this is task are sequentially taken from the assignment problem document.
任务的所有操作均从分配问题文档中按顺序进行。
Ease of clustered enterprise level deployments:
易于集群企业级部署:
For getting parse server up on clusters I used Rancher. Rancher runs inside a Docker container and gives UI for all the On-Prem cluster deployment requirements.
为了在群集上建立解析服务器,我使用了Rancher。 Rancher在Docker容器中运行,并为所有本地群集部署要求提供UI。
Incremental remotely triggered application updates:
增量远程触发的应用程序更新:
For remotely triggered incremental updates, Here I used Weave Cloud because it also provides CI/CD.
对于远程触发的增量更新,此处使用了Weave Cloud,因为它还提供CI / CD。
Weave Cloud is an automation and management platform for development and DevOps teams.
Weave Cloud是面向开发和DevOps团队的自动化和管理平台。
Easy remote debugging:
简单的远程调试:
For remote debugging, Here I used Prometheus because the metrics collected by Prometheus, Grafana are used for remote debugging only by cluster administrators or DevOps engineers.
对于远程调试,此处使用Prometheus是因为Prometheus,Grafana收集的度量标准仅由集群管理员或DevOps工程师用于远程调试。
Health Alerts and Monitoring:
健康警报和监视:
Here also I used Prometheus and Grafana i.e provided by Rancher we didn't required to install any monitoring tool by ourselves, just we have to enable the monitoring api from the rancher.
在这里我也使用了Prometheus和Grafana,即Rancher提供的,我们不需要自己安装任何监视工具,只需要启用rancher的监视api。
And for Alerts here I used Weave Cloud because Alert system and Health Check is much easier here. The operation team members receive email alerts automatically when something is down in cluster. they don’t have to configure the notifiers here.
对于这里的警报,我使用了Weave Cloud,因为这里的警报系统和运行状况检查要容易得多。 当群集中发生故障时,操作团队成员会自动收到电子邮件警报。 他们不必在这里配置通知程序。
for testing you can send yourself an test email of verify it’s working or not.
为了进行测试,您可以向自己发送测试电子邮件,以验证其是否正常运行。
here is the email that I received from Weave Cloud.
这是我从Weave Cloud收到的电子邮件。
Application Security (with source code protection):
应用程序安全性(具有源代码保护):
As we all know that in today’s age of malware and increasingly persistent hackers, software developers are often faced with more challenges like this. For prevent our code there are some precautions, let’s review just a few basic ones that you can consider.
众所周知,在当今恶意软件和黑客不断增长的时代,软件开发人员通常面临更多这样的挑战。 为了防止我们的代码存在一些预防措施,让我们回顾一下您可以考虑的一些基本预防措施。
- Copyright and patents: As we mentioned, lapsed copyrights are among the biggest reasons why many companies aren’t protecting their source code like they should. Don’t make the same mistake. Be sure that all your software and coding is protected by copyright law and necessary patents. 版权和专利:正如我们提到的那样,版权失效是许多公司未像应有的那样保护其源代码的最大原因之一。 不要犯同样的错误。 确保您的所有软件和代码均受版权法和必要专利的保护。
Encryption and monitoring: Your source code is one of your most prized commodities on the programming side of things. So ensure that it includes the ability to encrypt the relevant data both in transit and at rest, as this will go a long way toward keeping it away from prying eyes.
加密和监视:在事物的编程方面,您的源代码是您最有价值的商品之一。 因此,请确保它具有在传输过程中和静止时都对相关数据进行加密的能力,因为这将使数据远离窥视。
- Redundancy: Although many effective ways to protect your source code are on the table, this is one case in which the more methods you have in place, the better off you’ll be in the long run. In many cases, businesses opt to limit redundancy, since it amounts to an excess expense of resources. 冗余:尽管有很多保护源代码的有效方法,但是在这种情况下,使用的方法越多,从长远来看就会越好。 在许多情况下,企业会选择限制冗余,因为这会浪费过多的资源。
Disaster management:
灾害管理:
For Disaster Management I am using Velero by Heptio. Velero helps you with:
对于灾难管理,我使用的是Heptio的Velero。 Velero可帮助您:
- Backup and restore of your Kubernetes cluster. 备份和还原Kubernetes集群
- Copy cluster resources from one cluster to another 将群集资源从一个群集复制到另一群集
- Replicate your production environment for development and testing environments. 复制生产环境以用于开发和测试环境。
数据格式和报告 (Data formats and Reporting)
All the data that Prometheus and Grafana is providing from Rancher server, this data can be used by DevOps engineer or a system Admin for analyzing various statistical data from the running cluster. These statistics can then be used for processing information about the health of the application clusters, take productive measures checks and finally debugging the issues if any bugs are founded.
Prometheus和Grafana从Rancher服务器提供的所有数据,DevOps工程师或系统管理员可以使用此数据来分析正在运行的群集中的各种统计数据。 然后,这些统计信息可用于处理有关应用程序集群运行状况的信息,进行生产性检查,并在发现任何错误的情况下最终调试问题。
Metrices received from Prometheus monitoring 从普罗米修斯监测获得的指标性能和扩展 (Performance and Scaling)
Generally Scaling is used when traffic of work loads are increased and here we have Rancher for making it really easy to perform scaling by just few clicks.
通常,在增加工作量时使用缩放,在这里,我们拥有Rancher,使您只需单击几下即可真正轻松地执行缩放。
For this go to Rancher then Atlantask then System then Apps, and click on parseserver application.
为此,请依次转到Rancher,Atlantask,System,Apps,然后单击parseserver应用程序。
then scale it to 1 from 2
然后从2缩放到1
Now you can see your workload is increased with 2 running pods.
现在您可以看到2个运行的Pod增加了您的工作量。
尚未解决的问题 (Unresolved issues)
Incremental remotely triggered application updates is not currently working because I had put a sample configuration file on GitHub, It’s actually because I am not confirmed in providing the updates to Kubernetes Cluster or to the application deployed in the Parse Server.
由于我已经在GitHub上放置了一个示例配置文件,因此增量远程触发的应用程序更新当前无法正常工作,这实际上是因为未确认是否向Kubernetes Cluster或Parse Server中部署的应用程序提供了更新。
Here I am using GitHub as a version control system.
在这里,我使用GitHub作为版本控制系统。
Link : https://github.com/Prathmesh98/atlantask
链接: https : //github.com/Prathmesh98/atlantask
翻译自: https://medium.com/@pmandve810/on-premise-parse-server-deployment-2e3710982da3
怎么部署项目解析域名