@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at recaptime-dev/main 319 lines 12 kB view raw
1@title Diffusion User Guide: URIs 2@group userguide 3 4Guide to configuring repository URIs for fetching, cloning and mirroring. 5 6Overview 7======== 8 9Phorge can create, host, observe, mirror, proxy, and import repositories. 10For example, you can: 11 12**Host Repositories**: Phorge can host repositories locally. Phorge 13maintains the writable master version of the repository, and you can push and 14pull the repository. This is the most straightforward kind of repository 15configuration, and similar to repositories on other services like GitHub or 16Bitbucket. 17 18**Observe Repositories**: Phorge can create a copy of an repository which 19is hosted elsewhere (like GitHub or Bitbucket) and track updates to the remote 20repository. This will create a read-only copy of the repository in Phorge. 21 22**Mirror Repositories**: Phorge can publish any repository to mirrors, 23overwriting them with an exact copy of the repository that stays up to date as 24the source changes. This works with both local repositories that Phorge is 25hosting and remote repositories that Phorge is observing. 26 27**Proxy Repositories**: If you are observing a repository, you can allow users 28to read Phorge's copy of the repository. Phorge supports granular 29read permissions, so this can let you open a private repository up a little 30bit in a flexible way. 31 32**Import Repositories**: If you have a repository elsewhere that you want to 33host on Phorge, you can observe the remote repository first, then turn 34the tracking off once the repository fully synchronizes. This allows you to 35copy an existing repository and begin hosting it in Phorge. 36 37You can also import repositories by creating an empty hosted repository and 38then pushing everything to the repository directly. 39 40You configure the behavior of a Phorge repository by adding and 41configuring URIs and marking them to be fetched from, mirrored to, clonable, 42and so on. By configuring all the URIs that a repository should interact with 43and expose to users, you configure the read, write, and mirroring behavior 44of the repository. 45 46The remainder of this document walks through this configuration in greater 47detail. 48 49 50Host a Repository 51================= 52 53You can create new repositories that Phorge will host, like you would 54create repositories on services like GitHub or Bitbucket. Phorge will 55serve a read-write copy of the repository and you can clone it from Phorge 56and push changes to Phorge. 57 58If you haven't already, you may need to configure Phorge for hosting 59before you can create your first hosted repository. For a detailed guide, 60see @{article:Diffusion User Guide: Repository Hosting}. 61 62This is the default mode for new repositories. To host a repository: 63 64 - Create a new repository. 65 - Activate it. 66 67Phorge will create an empty repository and allow you to fetch from it and 68push to it. 69 70 71Observe a Repository 72==================== 73 74If you have an existing repository hosted on another service (like GitHub, 75Bitbucket, or a private server) that you want to work with in Phorge, 76you can configure Phorge to observe it. 77 78When observing a repository, Phorge will keep track of changes in the 79remote repository and allow you to browse and interact with the repository from 80the web UI in Diffusion and other applications, but you can continue hosting it 81elsewhere. 82 83To observe a repository: 84 85 - Create a new repository, but don't activate it yet. 86 - Add the remote URI you want to observe as a repository URI. 87 - Set the **I/O Type** for the URI to **Observe**. 88 - If necessary, configure a credential. 89 - Activate the repository. 90 91Phorge will perform an initial import of the repository, creating a local 92read-only copy. Once this process completes, it will continue keeping track of 93changes in the remote, fetching them, and reflecting them in the UI. 94 95 96Mirror a Repository 97=================== 98 99NOTE: Mirroring is not supported in Subversion. 100 101You can create a read-only mirror of an existing repository. Phorge will 102continuously publish the state of the source repository to the mirror, creating 103an exact copy. 104 105For example, if you have a repository hosted in Phorge that you want to 106mirror to GitHub, you can configure Phorge to automatically maintain the 107mirror. This is how the upstream repositories are set up. 108 109The mirror copy must be read-only for users because any writes made to the 110mirror will be undone when Phorge updates it. The mirroring process copies 111the entire repository state exactly, so the remote state will be completely 112replaced with an exact copy of the source repository. This may remove or 113destroy information. Normally, you should only mirror to an empty repository. 114 115You can mirror any repository, even if Phorge is only observing it and not 116hosting it directly. 117 118To begin mirroring a repository: 119 120 - Create a hosted or observed repository by following the relevant 121 instructions above. 122 - Add the remote URI you want to mirror to as a repository URI. 123 - Set the **I/O Type** for the URI to **Mirror**. 124 - If necessary, configure a credential. 125 126To stop mirroring: 127 128 - Disable the mirror URI; or 129 - Change the **I/O Type** for the URI to **None**. 130 131 132Import a Repository 133=================== 134 135If you have an existing repository that you want to move so it is hosted on 136Phorge, there are three ways to do it: 137 138**Observe First**: //(Git, Mercurial)// Observe the existing repository first, 139according to the instructions above. Once Phorge's copy of the repository 140is fully synchronized, change the **I/O Type** for the **Observe** URI to 141**None** to stop fetching changes from the remote. 142 143By default, this will automatically make Phorge's copy of the repository 144writable, and you can begin pushing to it. If you've adjusted URI 145configuration away from the defaults, you may need to set at least one URI 146to **Read/Write** mode so you can push to it. 147 148**Push Everything**: //(Git, Mercurial, Subversion)// Create a new empty hosted 149repository according to the instructions above. Once the empty repository 150initializes, push your entire existing repository to it. 151 152In Subversion, you can do this with the `svnsync` tool. 153 154**Copy on Disk**: //(Git, Mercurial, Subversion)// Create a new empty hosted 155repository according to the instructions above, but do not activate it yet. 156 157Using the **Storage** tab, find the location of the repository's working copy 158on disk, and place a working copy of the repository you wish to import there. 159 160For Git and Mercurial, use a bare working copy for best results. 161 162This is the only way to import a Subversion repository because only the master 163copy of the repository has history. 164 165Once you've put a working copy in the right place on disk, activate the 166repository. 167 168 169Builtin Clone URIs 170================== 171 172By default, Phorge automatically exposes and activates HTTP, HTTPS and 173SSH clone URIs by examining configuration. 174 175**HTTP**: The `http://` clone URI will be available if these conditions are 176satisfied: 177 178 - `diffusion.allow-http-auth` must be enabled or the repository view policy 179 must be "Public". 180 - The repository must be a Git or Mercurial repository. 181 - `security.require-https` must be disabled. 182 183**HTTPS**: The `https://` clone URI will be available if these conditions are 184satisfied: 185 186 - `diffusion.allow-http-auth` must be enabled or the repository view policy 187 must be "Public". 188 - The repository must be a Git or Mercurial repository. 189 - The `phabricator.base-uri` protocol must be `https://`. 190 191**SSH**: The `ssh://` or `svn+ssh://` clone URI will be available if these 192conditions are satisfied: 193 194 - `phd.user` must be configured. 195 196 197Customizing Displayed Clone URIs 198================================ 199 200If you have an unusual configuration and want the UI to offers users specific 201clone URIs other than the URIs that Phorge serves or interacts with, you 202can add those URIs with the **I/O Type** set to **None** and then set their 203**Display Type** to **Always**. 204 205Likewise, you can set the **Display Type** of any URIs you do //not// want 206to be visible to **Never**. 207 208This allows you to precisely configure which clone URIs are shown to users for 209a repository. 210 211 212Reference: I/O Types 213==================== 214 215This section details the available **I/O Type** options for URIs. 216 217Each repository has some **builtin** URIs. These are URIs hosted by Phorge 218itself. The modes available for each URI depend primarily on whether it is a 219builtin URI or not. 220 221**Default**: This setting has Phorge guess the correct option for the 222URI. 223 224For **builtin** URIs, the default behavior is //Read/Write// if the repository 225is hosted, and //Read-Only// if the repository is observed. 226 227For custom URIs, the default type is //None// because we can not automatically 228guess if you want to ignore, observe, or mirror a URI and //None// is the 229safest default. 230 231**Observe**: Phorge will observe this repository and regularly fetch any 232changes made to it to a local read-only copy. 233 234You can not observe builtin URIs because reading a repository from itself 235does not make sense. 236 237You can not add a URI in Observe mode if an existing builtin URI is in 238//Read/Write// mode, because this would mean the repository had two different 239authorities: the observed remote copy and the hosted local copy. Take the 240other URI out of //Read/Write// mode first. 241 242WARNING: If you observe a remote repository, the entire state of the working 243copy that Phorge maintains will be deleted and replaced with the state of 244the remote. If some changes are present only in Phorge's working copy, 245they will be unrecoverably destroyed. 246 247**Mirror**: Phorge will push any changes made to this repository to the 248remote URI, keeping a read-only mirror hosted at that URI up to date. 249 250This works for both observed and hosted repositories. 251 252This option is not available for builtin URIs because it does not make sense 253to mirror a repository to itself. 254 255It is possible to mirror a repository to another repository that is also 256hosted by Phorge by adding that other repository's URI, although this is 257silly and probably very rarely of any use. 258 259WARNING: If you mirror to a remote repository, the entire state of that remote 260will be replaced with the state of the working copy Phorge maintains. If 261some changes are present only in the remote, they will be unrecoverably 262destroyed. 263 264**None**: Phorge will not fetch changes from or push changes to this URI. 265For builtin URIs, it will not let users fetch changes from or push changes to 266this URI. 267 268You can use this mode to turn off an Observe URI after an import, stop a Mirror 269URI from updating, or to add URIs that you're only using to customize which 270clone URIs are displayed to the user but don't want Phorge to interact 271with directly. 272 273**Read Only**: Phorge will serve the repository from this URI in read-only 274mode. Users will be able to fetch from it but will not be able to push to it. 275 276Because Phorge must be able to serve the repository from URIs configured 277in this mode, this option is only available for builtin URIs. 278 279**Read/Write**: Phorge will serve the repository from this URI in 280read/write mode. Users will be able to fetch from it and push to it. 281 282URIs can not be set into this mode if another URI is set to //Observe// mode, 283because that would mean the repository had two different authorities: the 284observed remote copy and the hosted local copy. Take the other URI out of 285//Observe// mode first. 286 287Because Phorge must be able to serve the repository from URIs configured 288in this mode, this option is only available for builtin URIs. 289 290 291Reference: Display Types 292======================== 293 294This section details the available **Display Type** options for URIs. 295 296**Default**: Phorge will guess the correct option for the URI. It 297guesses based on the configured **I/O Type** and whether the URI is 298**builtin** or not. 299 300For //Observe//, //Mirror// and //None// URIs, the default is //Never//. 301 302For builtin URIs in //Read Only// or //Read/Write// mode, the most 303human-readable URI defaults to //Always// and the others default to //Never//. 304 305**Always**: This URI will be shown to users as a clone/checkout URI. You can 306add URIs in this mode to customize exactly what users are shown. 307 308**Never**: This URI will not be shown to users. You can hide less-preferred 309URIs to guide users to the URIs they should be using to interact with the 310repository. 311 312 313Next Steps 314========== 315 316Continue by: 317 318 - configuring Phorge to host repositories with 319 @{article:Diffusion User Guide: Repository Hosting}.