带有Toran代理的个人打包专家

tech2023-08-11  109

Most of you reading this already know Composer. For those who don’t, you can read a previous article of mine before contuing. We can all agree that Composer has brought many good things into the PHP world. If one dares however to look for drawbacks, or better put, not included features, he could state that it is not possible to work with private repositories. That argument won’t hold anymore, since there is Toran Proxy.

大部分阅读此书的人都已经知道Composer了 。 对于那些不喜欢的人,可以在继续学习之前阅读我的上一篇文章 。 我们都可以同意Composer为PHP世界带来了很多好处。 但是,如果有人敢于寻找缺点或更好地介绍不包含的功能,那么他可以说不可能使用私有存储库。 由于存在Toran Proxy ,该论点不再成立。

萨蒂斯时代的终结 (The end of the Satis era)

Before Toran, those that really wanted to use private repositories, could use Satis. Satis enables you to generate a privately hosted Packagist website, with mirrored repositories and your own private repositories. It was compatible with private projects on bitbucket and github and guaranteed security by usage of SSH keys. By mirroring the packages you are using (hosting them on your own server) you will get faster download speeds. Satis was a fine solution but about a month ago Toran was released as a better alternative.

在Toran之前,那些真正想使用私有存储库的人可以使用Satis 。 Satis使您能够生成带有镜像存储库和您自己的私有存储库的私人托管的Packagist网站。 它与bitbucket和github上的私有项目兼容,并通过使用SSH密钥保证了安全性。 通过镜像您正在使用的软件包(将它们托管在您自己的服务器上),您将获得更快的下载速度。 Satis是一个很好的解决方案,但是大约一个月前,Toran被发布为更好的选择。

Toran:更难,更好,更快,更强大 (Toran: harder, better, faster, stronger)

Toran uses the following description on its website:

Toran在其网站上使用以下描述:

Toran acts as a proxy for Packagist and GitHub. It is meant to be set up on your own server or even inside your office.

Toran担任Packagist和GitHub的代理。 它可以在您自己的服务器上甚至在办公室内部设置。

This is a better method than what Satis uses: Satis urls override the original packages completely. This means that when your Satis server doesn’t work, all package fetching will fail. With Toran, you can always fall back to the original source (either Github or BitBucket).

这是比Satis使用的更好的方法:Satis网址完全覆盖原始软件包。 这意味着,当您的Satis服务器不工作时,所有软件包的获取将失败。 使用Toran,您始终可以退回到原始来源(Github或BitBucket)。

Download speeds will also increase: when you are not living close to the US East Coast (where the github servers are located), having a server close to you will help you to download your components faster. Toran mirrors git repositories, which was not possible with Satis. Source installations will also be faster this way.

下载速度也会提高:当您不住在美国东海岸(github服务器所在的地方)附近时,拥有一台服务器将帮助您更快地下载组件。 Toran镜像了git存储库,而Satis无法做到。 这样,源安装也将更快。

设置东西 (Setting things up)

If you want to verify everything I say here, you can download a personal edition from the website. The installation instructions are easy (just copy paste) and half of it can be done by using the web interface. You need to enter the host domain, the subdomain and optional git mirroring locations. Future updating can be done by executing a simple command.

如果您想验证我在这里说的所有内容,可以从网站上下载个人版本。 安装说明很简单(只需复制粘贴),其中一半可以使用Web界面完成。 您需要输入主机域,子域和可选的git镜像位置。 将来的更新可以通过执行简单的命令来完成。

Toran on Homestead改进 (Toran on Homestead Improved)

I will quickly demonstrate how to set up your own Toran site. For easy configuration I will use Homestead Improved, read this if you want to learn how to set it up.

我将快速演示如何设置您自己的Toran网站。 为了便于配置,我将使用Homestead Enhanced,如果您想学习如何设置它,请阅读本手册 。

服务器设置 (Server Setup)

After that installation, open the Homestead.yaml file and under sites: add:

安装完成后,打开Homestead.yaml文件并在sites:下sites:添加:

- map: toran.app to: /home/vagrant/Code/Toran/web

Also add toran.app to your hosts file. Now download the personal edition of Toran and extract it in the Toran folder inside your Homestead folder (the Homestead folder is where Homestead.yaml is located). If you connect to your vagrant box via SSH, /home/vagrant/Code is the folder in question. This hostname is pointed to the web folder in the Toran folder you just extracted.

toran.app添加到您的主机文件。 现在下载Toran的个人版本,并将其解压缩到Homestead文件夹内的Toran文件夹中(Homestead文件夹是Homestead.yaml所在的位置)。 如果您通过SSH连接到无业游民的盒子,则/home/vagrant/Code是有问题的文件夹。 该主机名指向您刚提取的Toran文件夹中的Web文件夹。

In order for Toran to work, there is only one server configuration setting left to change. Connect to your homestead box via SSH, and edit /etc/nginx/sites-available/toran.app Change:

为了使Toran正常工作,仅剩一个服务器配置设置需要更改。 通过SSH连接到您的宅基地盒,然后编辑/etc/nginx/sites-available/toran.app更改:

location / { try_files $uri $uri/ /index.php$query_string; }

to:

至:

location / { try_files $uri /app.php$is_args$args; }

组态 (Configuration)

This was all the required server configuration. Now go inside /Toran/app/config/ and rename parameters.yml.dist to parameters.yml. Open it and change following settings:

这是所有必需的服务器配置。 现在进入/Toran/app/config/ ,并将parameters.yml.dist重命名为parameters.yml 。 打开它并更改以下设置:

toran_http_port: 8000 toran_host: toran.app

Finally, exit the VM and reload it with vagrant reload.

最后,退出VM并使用vagrant reload加载它。

魔法师 (The Wizard)

You are only a couple of clicks away from using Toran. Navigate to http://toran.app:8000 and the installation will come up. This is where you can enter your license code (see next paragraph) but in our case you can check the box that it is for personal use underneath.

您只需单击几下即可使用Toran。 导航至http://toran.app:8000 ,安装将启动。 您可以在此处输入许可证代码(请参阅下一段),但在我们这种情况下,您可以在下面选中用于个人使用的复选框。

Next, you will define what the cronjob will do: if you don’t want to prefetch any packages, use the lazy setting. If you want to prefetch all defined packages, pick all. After that, there are optional settings for where the git clones will be stored and what prefix URL will be used. This is if your repositories are not publicly available.

接下来,您将定义cronjob的作用:如果您不想预取任何软件包,请使用惰性设置。 如果要预取所有定义的包,请选择all 。 之后,有一些可选设置,用于存储git克隆的存储位置以及将使用的前缀URL。 这是您的存储库未公开可用的情况。

If you had a Satis configuration before, you can enter it in the last textbox. Click the install button and we’re done.

如果您之前有Satis配置,则可以在最后一个文本框中输入它。 单击安装按钮,我们完成。

进一步维护 (Further maintenance)

Now you need to manually update everything using the command:

现在,您需要使用以下命令手动更新所有内容:

php app/console toran:update

After that, you can set up a cronjob to do this automatically. Specific instructions for your server are given when you navigate to http://toran.app:8000/post-install.

之后,您可以设置一个cronjob以自动执行此操作。 当您导航到http://toran.app:8000/post-install时,将给出服务器的特定说明。

执照 (Licenses)

With the development of Toran, its main (and for the moment only developer) Jordi Boggiano decided to not make it open-source. While Composer and Packagist remain open-source, Toran comes with licenses and fees. You can use Toran personally for free, but when you want to use Toran for your business you’ll have to pay a yearly fee. Exact pricing can be found on the website and custom pricing can be requested.

随着Toran的发展,其主要(目前仅是开发商) Jordi Boggiano决定不使其开源。 尽管Composer和Packagist仍然是开源的,但Toran带有许可证和费用。 您可以免费使用Toran个人服务,但是如果您想将Toran用于您的业务,则需要支付年费。 可以在网站上找到确切的价格,也可以要求自定义价格。

结论 (Conclusion)

I want to thank Jordi Boggiano for additional clarifications on this project. If you have a business and want to simplify your dependency management, make sure to check this application out. Comments? Feedback? Leave it below!

我要感谢Jordi Boggiano对这个项目的其他说明。 如果您经营一家公司,并且想要简化依赖性管理,请确保检出此应用程序。 注释? 反馈? 留在下面!

翻译自: https://www.sitepoint.com/personal-packagist-toran-proxy/

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