首先查看Platform.sh-开发和部署SaaS

tech2022-09-15  122

Not so long ago, many of us were satisfied handling deployment of our projects by uploading files via FTP to a web server. I was doing it myself until relatively recently and still do on occasion (don’t tell anyone!). At some point in the past few years, demand for the services and features offered by web applications rose, team sizes grew and rapid iteration became the norm. The old methods for deploying became unstable, unreliable and (generally) untrusted.

不久之前,我们中的许多人都满意地通过将文件通过FTP上传到Web服务器来处理项目的部署。 我直到最近才亲自做这件事,但仍然偶尔做(不要告诉任何人!)。 在过去几年的某个时候,对Web应用程序提供的服务和功能的需求增加,团队规模不断扩大,快速迭代成为常态。 旧的部署方法变得不稳定,不可靠并且(通常)不受信任。

So was born a new wave of tools, services and workflows designed to simplify the process of deploying complex web applications, along with a plethora of accompanying commercial services. Generally, they offer an integrated toolset for version control, hosting, performance and security at a competitive price.

于是诞生了一系列新的工具,服务和工作流,旨在简化复杂Web应用程序的部署过程以及大量附带的商业服务。 通常,它们以具有竞争力的价格提供用于版本控制,托管,性能和安全性的集成工具集。

Platform.sh is a newer player on the market, built by the team at Commerce Guys, who are better known for their Drupal eCommerce solutions. Initially, the service only supported Drupal based hosting and deployment, but it has rapidly added support for Symfony, WordPress, Zend and ‘pure’ PHP, with node.js, Python and Ruby coming soon.

Platform.sh是由Commerce Guys的团队构建的市场上新手 ,他们以Drupal电子商务解决方案而闻名。 最初,该服务仅支持基于Drupal的托管和部署,但是它已Swift增加了对Symfony,WordPress,Zend和“纯” PHP的支持,即将推出node.js,Python和Ruby。

It follows the microservice architecture concept and offers an increasing amount of server, performance and profiling options to add and remove from your application stack with ease.

它遵循微服务架构的概念,并提供了越来越多的服务器,性能和配置选项,可以轻松地从应用程序堆栈中添加和删除。

I tend to find these services make far more sense with a simple example. I will use a Drupal platform as it’s what I’m most familiar with.

我倾向于通过一个简单的例子来发现这些服务更有意义。 我将使用Drupal平台,因为这是我最熟悉的平台。

Platform.sh has a couple of requirements that vary for each platform. In Drupal’s case they are:

Platform.sh的几个要求因每个平台而异。 在Drupal的情况下,它们是:

An id_rsa public/private key pair

id_rsa公钥/私钥对 Git

吉特 Composer

作曲家 The Platform.sh CLI

Platform.sh CLI Drush

冲刺

I won’t cover installing these here; more details can be found in the Platform.sh documentation section.

我不会在这里介绍安装这些程序。 有关更多详细信息,请参见Platform.sh文档部分 。

I had a couple of test platforms created for me by the Platform.sh team, and for the sake of this example, we can treat these as my workplace adding me to some new projects I need to work on. I can see these listed by issuing the platform project:list command inside my preferred working directory.

我有一些由Platform.sh团队为我创建的测试平台,为了这个示例,我们可以将它们视为我的工作场所,将我添加到需要从事的一些新项目中。 通过在我的首选工作目录中发出platform project:list命令,可以看到这些platform project:list 。

Get a local copy of a platform by using the platform get ID command (The IDs are listed in the table we saw above).

使用platform get ID命令platform get ID平台的本地副本(ID列在我们上面看到的表中)。

This will download the relevant code base and perform some build tasks, any extra information you need to know is presented in the terminal window. Once this is complete, you will have the following folder structure:

这将下载相关的代码库并执行一些构建任务,您需要了解的任何其他信息都将显示在终端窗口中。 完成此操作后,您将具有以下文件夹结构:

The repository folder is your code base and here is where you make and commit changes. In Drupal’s case, this is where you will add modules, themes and libraries.

repository文件夹是您的代码库,在这里您可以进行更改并提交更改。 在Drupal的情况下,您将在其中添加模块,主题和库。

The build folder contains the builds of your project, that is the combination of drupal core, plus any changes you make in the repository folder.

build文件夹包含项目的构建,即drupal core的组合,以及您在repository文件夹中进行的所有更改。

The shared folder contains your local settings and files/folders, relevant to just your development copy.

shared文件夹包含您的本地设置和文件/文件夹,仅与您的开发副本相关。

Last is the www symlink, which will always reference the current build. This would be the DOCROOT of your vhost or equivalent file.

最后是www符号链接,它将始终引用当前版本。 这将是您的vhost或等效文件的DOCROOT 。

启动您的网站并运行 (Getting your site up and running)

Drupal is still dependent on having a database present to get started, so if we need it we can get the database from the platform we want by issuing:

Drupal仍然依赖于数据库启动,因此,如果需要,我们可以通过发出以下命令从所需平台获取数据库:

platform drush sql-dump > d7.sql

Then we can import the database into our local machine and update the credentials in shared/settings.local.php accordingly.

然后,我们可以将数据库导入本地计算机,并相应地更新shared/settings.local.php的凭据。

Voila! We’re up and working!

瞧! 我们正在工作!

让我们开始开发 (Let’s start developing)

Let’s do something simple: add the views and features modules. Platform.sh is using Drush make files, so it’s a different process from what you might be used to. Open the project.make file and add the relevant entry to it. In our case, it’s:

让我们做一些简单的事情:添加视图和功能模块。 Platform.sh使用的是Drush make文件,因此它与您习惯的过程有所不同。 打开project.make文件,并将相关条目添加到其中。 在我们的例子中是:

projects[ctools][version] = "1.6" projects[ctools][subdir] = "contrib" projects[views][version] = "3.7" projects[views][subdir] = "contrib" projects[features][version] = "2.3" projects[features][subdir] = "contrib" projects[devel][version] = "1.5" projects[devel][subdir] = "contrib"

Here, we are setting the projects we want to include, the specific versions and what subfolder of the modules folder we want them placed into.

在这里,我们正在设置要包含的项目,特定版本以及要将其放入模块文件夹的子文件夹。

Rebuild the platform with platform build. You should notice the devel, ctools, features and views module downloaded, and we can confirm this by making a quick visit to the modules page:

用platform build重建platform build 。 您应该注意到已下载了devel,ctools,功能和视图模块,我们可以通过快速访问模块页面来确认这一点:

You will notice that each time we issue the build command, a new version of our site is created in the builds folder. This is perfect for quickly reverting to an earlier version of our project in case something goes wrong.

您会注意到,每次发出build命令时,都会在builds文件夹中创建网站的新版本。 如果发生问题,此方法非常适合快速恢复到项目的早期版本。

Now, let’s take a typical Drupal development path, create a view and add it to a feature for sharing amongst our team. Enable all the modules we have just added and generate some dummy content with the Devel Generate feature, either through Drush or the module page.

现在,让我们采用典型的Drupal开发路径,创建一个视图并将其添加到功能中,以在我们的团队之间共享。 启用我们刚刚添加的所有模块,并通过Derush生成功能通过Drush或模块页面生成一些虚拟内容。

Now, create a page view that shows all content on the site:

现在,创建一个页面视图,显示网站上的所有内容:

Add it to a feature:

将其添加到功能:

Uncompress the archive created and add it into the repository -> modules folder. Commit and push this folder to version control. Now any other team member running the platform build command will receive all the updates they need to get straight into work.

解压缩创建的归档并将其添加到repository -> modules文件夹中。 提交此文件夹并将其推送到版本控制。 现在,其他任何运行platform build命令的团队成员都将收到他们需要投入工作的所有更新。

You can then follow your normal processes for getting modules, feature and theme changes applied to local sites such as update hooks or profile based development.

然后,您可以按照正常的过程来获取应用于本地站点的模块,功能和主题更改,例如更新挂钩或基于配置文件的开发。

Platform.sh还能做什么? (What else can Platform.sh do?)

This simplifies the development process amongst teams, but what else does Platform.sh offer to make it more compelling than other similar options?

这简化了团队之间的开发过程,但是Platform.sh还提供哪些其他功能以使其比其他类似的选择更具吸引力?

If you are an agency or freelancer that works on multiple project types, the broader CMS/Framework/Language support, all hosted in the same place and with unified version control and backups, is a compelling reason.

如果您是从事多个项目类型的代理机构或自由职业者,则更引人注目的理由是,所有CMS /框架/语言支持都托管在同一位置,并具有统一的版本控制和备份。

With regards to version control, platform.sh provides a visual management and record of your git commits and branches, which I always find useful for reviewing code and status of a project. Apart from this, you can create snapshots of your project, including code and database, at any point.

关于版本控制,platform.sh提供了可视化管理并记录了git提交和分支,这对于查看项目的代码和状态总是很有帮助的。 除此之外,您可以随时创建项目的快照,包括代码和数据库。

When you are ready to push your site live, it’s simple to allocate DNS and domains all from the project configuration pages.

当您准备好将站点投入使用时,很容易从项目配置页面分配DNS和域。

性能,性能分析和其他优点 (Performance, Profiling and other Goodies)

By default, your projects have access to integration with Redis, Solr and EntityCache / AuthCache. It’s just a case of installing the relevant Drupal modules and pointing them to the built-in server details.

默认情况下,您的项目可以与Redis , Solr和EntityCache / AuthCache集成 。 这只是安装相关的Drupal模块并将其指向内置服务器详细信息的一种情况。

For profiling, Platform.sh has just added support for Sensiolabs Blackfire, all you need to do is install the browser companion, add your credentials, create an account and you’re good to go.

为了进行分析, Platform.sh刚刚添加了对Sensiolabs Blackfire的支持 ,您所需要做的就是安装浏览器同伴 , 添加您的凭据 ,创建一个帐户,一切顺利。

Backups are included by default as well as the ability to restore from backups.

默认情况下包括备份以及从备份还原的功能。

Team members can be allocated permissions at project levels and environment levels, allowing for easy transitioning of team members across projects and the roles they undertake in each one.

可以在项目级别和环境级别为团队成员分配权限,从而可以轻松地跨项目跨团队成员及其在每个项目中承担的角色。

Platform.sh offers some compelling features over it’s closest competition (Pantheon and Acquia) and pricing is competitive. The main decision to be made with all of these SaaS offerings is if the restricted server access and ‘way of doing things’ is a help or a hindrance to your team and its workflows. I would love to know your experiences or thoughts in the comments below.

Platform.sh在最接近的竞争对手( Pantheon和Acquia )上提供了一些引人注目的功能,并且价格具有竞争力。 所有这些SaaS产品的主要决策是服务器访问受限和“处事方式”是否对您的团队及其工作流程有所帮助或阻碍。 我想在下面的评论中了解您的经历或想法。

翻译自: https://www.sitepoint.com/first-look-platform-sh-development-deployment-saas/

相关资源:jdk-8u281-windows-x64.exe
最新回复(0)