Separate Git Deployments on a Single Server

 ̄綄美尐妖づ 提交于 2019-12-01 12:02:14

问题


I would like to have a feature in my application that allows a user to change between versions, specifically to see the differences in the application between sprints. The user would simply select a version (Sprint A, Sprint B, etc.) from a dropdown and the page would refresh, showing the state of the application at that time.

This itself shouldn't be too much of a problem. I think we'll have a Git deploy framework that will checkout the appropriate branch on the server.

The problem is I want to allow, for example, someone from business to be able to take a look at the application as of Sprint B, while a developer can give a demo of what he did for Sprint C at the same time, without one branch checkout clobbering the other.

Every time you change branches to view a version, it will affect everyone viewing that server.

Is there a way to allow one user to view another branch on the server without affecting anyone else, and possibly without making lasting changes to the files on that server?


回答1:


I think we'll have a Git deploy framework that will checkout the appropriate branch on the server.

That is a good approach, but it need to checkout/update the appropriate branch in different folders (and your webapp need to redirect pages according to the user choice)

A post-receive hook is typically used in order to trigger a per-branch process: see for instance "how to process files on a branch in post-receive hook in git"

#!/bin/bash

while read oldrev newrev ref
do
  branch=`echo $ref | cut -d/ -f3`

  if [ "master" == "$branch" ]; then
    ....


来源:https://stackoverflow.com/questions/23507398/separate-git-deployments-on-a-single-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!