Snapshot của mislav/git-deploy: 2.1k★ · Ruby. git deployment made easy
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Straightforward, Heroku-style, push-based deployment. Your deploys can become as simple as this:
$ git push production master
To get started, install the "git-deploy" gem.
gem install git-deploy
Only the person who is setting up deployment for the first time needs to install
the gem. You don't have to add it to your project's Gemfile.
Which app languages/frameworks are supported?
Regardless of the fact that this tool is mostly written in Ruby, git-deploy can be useful for any kind of code that needs deploying on a remote server. The default scripts are suited for Ruby web apps, but can be edited to accommodate other frameworks.
Your deployment is customized with per-project callback scripts which can be written in any language.
The assumption is that you're deploying to a single host to which you connect over SSH using public/private key authentication.
Initial setup
Create a git remote for where you'll push the code on your server. The name of this remote in the examples is "production", but it can be whatever you wish ("online", "website", or other).
/apps/mynewapp is the directory where you want your code to reside on the
remote server. If the directory doesn't exist, the next step creates it.
Run the setup task:
git deploy setup -r "production"
This will initialize the remote git repository in the deploy directory
(/apps/mynewapp in the above example) and install the remote git hook.
Run the init task:
git deploy init
This generates default deploy callback scripts in the deploy/ directory.
You should check them in git because they are going to be executed on the
server during each deploy.
Push the code.
git push production master
Login to your server and manually perform necessary one-time administrative operations. This might include:
set up the Apache/nginx virtual host for this application;
check your config/database.yml and create the production database.
Everyday deployments
If you've set your app correctly, visiting http://example.com in your browser
should show it up and running.
Now, subsequent deployments are done simply by pushing to the branch that is
currently checked out on the remote:
git push production master
Because the deployments are performed with git, nobody else on the team needs to
install the "git-deploy" gem.
On every deploy, the default deploy/after_push script performs the following:
updates git submodules (if there are any);
runs bundle install --deployment if there is a Gemfile;
runs rake db:migrate if new migrations have been added;
clears cached CSS/JS assets in "public/stylesheets" and "public/javascripts";
restarts the web application.
You can customize all this by editing generated scripts in the deploy/
directory of your app.
Deployments are logged to log/deploy.log in your application's directory.
How it works
The git deploy setup command installed a post-receive git hook in the remote
repository. This is how your code on the server is kept up to date. This script
checks out the latest version of your project from the current branch and
runs the following callback scripts:
deploy/setup - on first push.
deploy/after_push - on subsequent pushes. It in turn executes:
deploy/before_restart
deploy/restart
deploy/after_restart
deploy/rollback - executed for git deploy rollback.
All of the callbacks are optional. These scripts are ordinary Unix executables.
The ones which get generated for you by git deploy init are written in shell
script and Ruby.
Extra commands
git deploy hooks - Updates git hooks on the remote repository
git deploy log [N=20] - Shows last 20 lines of deploy log on the server
git deploy rerun - Re-runs the deploy/after_push callback as if a git push happened
git deploy restart - Runs the deploy/restart callback
git deploy rollback - Undo a deploy by checking out the previous revision,
runs deploy/rollback if exists instead of deploy/after_push
git deploy upload <files> - Copy local files to the remote app
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/mislav/git-deploy là nguồn chính thức.
mislav/git-deploy có bao nhiêu sao?
mislav/git-deploy có 2.1k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/mislav/git-deploy. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
mislav/git-deploy có phải mã nguồn mở không?
Có — mislav/git-deploy phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/mislav/git-deploy.
mislav/git-deploy có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho mislav/git-deploy. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
mislav/git-deploy có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho mislav/git-deploy. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
mislav/git-deploy còn đang phát triển không?
Commit gần nhất trên mislav/git-deploy là 7.4 năm trước (theo timestamp GitHub). Repo có 130 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về git-deploy?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về git-deploy.