如何打包节点项目文件并将其部署到我的服务器?

时间:2022-03-15 10:35:37

I have a nodejs non open source web application project that I want to deploy to a production server and/or a staging server. Is there a default way for this, or some tool that does it? I want to package all files needed and exclude the files not needed like the .git folder, the tests and other files like Gruntfile, package.json and so on.

我有一个nodejs非开源Web应用程序项目,我想部署到生产服务器和/或登台服务器。有没有默认的方法,或一些工具呢?我想打包所需的所有文件,并排除不需要的文件,如.git文件夹,测试和其他文件,如Gruntfile,package.json等。

I could of course manually package the files in a tar.gz file and send them to the correct server. But I was hoping to find a more complete and configurable tool that can do it for me.

我当然可以手动将文件打包到tar.gz文件中并将它们发送到正确的服务器。但我希望找到一个更完整,可配置的工具,可以为我做。

1 个解决方案

#1


1  

Might be not exactly what you're asking for, but i like git for automated deployment.

可能不是你要求的,但我喜欢git进行自动部署。

You could have branches like staging and production, which are checked out on the remote server.

您可以拥有分段(如分段和生产),这些分支在远程服务器上签出。

You can set up a git hook like post-receive to update those remotely, every time you merge changes into those branches.

每次将更改合并到这些分支时,您都可以设置像post-receive这样的git钩子来远程更新这些钩子。

Here's a tutorial: http://wekeroad.com/2011/09/17/deploying-a-site-with-git-hooks

这是一个教程:http://wekeroad.com/2011/09/17/deploying-a-site-with-git-hooks

#1


1  

Might be not exactly what you're asking for, but i like git for automated deployment.

可能不是你要求的,但我喜欢git进行自动部署。

You could have branches like staging and production, which are checked out on the remote server.

您可以拥有分段(如分段和生产),这些分支在远程服务器上签出。

You can set up a git hook like post-receive to update those remotely, every time you merge changes into those branches.

每次将更改合并到这些分支时,您都可以设置像post-receive这样的git钩子来远程更新这些钩子。

Here's a tutorial: http://wekeroad.com/2011/09/17/deploying-a-site-with-git-hooks

这是一个教程:http://wekeroad.com/2011/09/17/deploying-a-site-with-git-hooks