README.swift 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. Openstack Swift as backend for Dulwich
  2. ======================================
  3. Fabien Boucher <fabien.boucher@enovance.com>
  4. The module dulwich/contrib/swift.py implements dulwich.repo.BaseRepo
  5. in order to being compatible with Openstack Swift.
  6. We can then use Dulwich as server (Git server) and instead of using
  7. a regular POSIX file system to store repository objects we use the
  8. object storage Swift via its own API.
  9. c Git client <---> Dulwich server <---> Openstack Swift API
  10. This implementation is still a work in progress and we can say that
  11. is a Beta version so you need to be prepared to find bugs.
  12. Configuration file
  13. ------------------
  14. We need to provide some configuration values in order to let Dulwich
  15. talk and authenticate against Swift. The following config file must
  16. be used as template:
  17. [swift]
  18. # Authentication URL (Keystone or Swift)
  19. auth_url = http://127.0.0.1:5000/v2.0
  20. # Authentication version to use
  21. auth_ver = 2
  22. # The tenant and username separated by a semicolon
  23. username = admin;admin
  24. # The user password
  25. password = pass
  26. # The Object storage region to use (auth v2) (Default RegionOne)
  27. region_name = RegionOne
  28. # The Object storage endpoint URL to use (auth v2) (Default internalURL)
  29. endpoint_type = internalURL
  30. # Concurrency to use for parallel tasks (Default 10)
  31. concurrency = 10
  32. # Size of the HTTP pool (Default 10)
  33. http_pool_length = 10
  34. # Timeout delay for HTTP connections (Default 20)
  35. http_timeout = 20
  36. # Chunk size to read from pack (Bytes) (Default 12228)
  37. chunk_length = 12228
  38. # Cache size (MBytes) (Default 20)
  39. cache_length = 20
  40. Note that for now we use the same tenant to perform the requests
  41. against Swift. Therefor there is only one Swift account used
  42. for storing repositories. Each repository will be contained in
  43. a Swift container.
  44. How to start unittest
  45. ---------------------
  46. There is no need to have a Swift cluster running to run the unitests.
  47. Just run the following command in the Dulwich source directory:
  48. $ PYTHONPATH=. python -m dulwich.contrib.test_swift
  49. How to start functional tests
  50. -----------------------------
  51. We provide some basic tests to perform smoke tests against a real Swift
  52. cluster. To run those functional tests you need a properly configured
  53. configuration file. The tests can be run as follow:
  54. $ DULWICH_SWIFT_CFG=/etc/swift-dul.conf PYTHONPATH=. python -m dulwich.contrib.test_swift_smoke
  55. How to install
  56. --------------
  57. Install the Dulwich library via the setup.py. The dependencies will be
  58. automatically retrieved from pypi:
  59. $ python ./setup.py install
  60. How to run the server
  61. ---------------------
  62. Start the server using the following command:
  63. $ python -m dulwich.contrib.swift daemon -c /etc/swift-dul.conf -l 127.0.0.1
  64. Note that a lot of request will be performed against the Swift
  65. cluster so it is better to start the Dulwich server as close
  66. as possible of the Swift proxy. The best solution is to run
  67. the server on the Swift proxy node to reduce the latency.
  68. How to use
  69. ----------
  70. Once you have validated that the functional tests is working as expected and
  71. the server is running we can init a bare repository. Run this
  72. command with the name of the repository to create:
  73. $ python -m dulwich.contrib.swift init -c /etc/swift-dul.conf edeploy
  74. The repository name will be the container that will contain all the Git
  75. objects for the repository. Then standard c Git client can be used to
  76. perform operations againt this repository.
  77. As an example we can clone the previously empty bare repository:
  78. $ git clone git://localhost/edeploy
  79. Then push an existing project in it:
  80. $ git clone https://github.com/enovance/edeploy.git edeployclone
  81. $ cd edeployclone
  82. $ git remote add alt git://localhost/edeploy
  83. $ git push alt master
  84. $ git ls-remote alt
  85. 9dc50a9a9bff1e232a74e365707f22a62492183e HEAD
  86. 9dc50a9a9bff1e232a74e365707f22a62492183e refs/heads/master
  87. The other Git commands can be used the way you do usually against
  88. a regular repository.
  89. Note the daemon subcommands starts a Git server listening for the
  90. Git protocol. Therefor there is no authentication or encryption
  91. at all between the cGIT client and the GIT server (Dulwich).
  92. Note on the .info file for pack object
  93. --------------------------------------
  94. The Swift interface of Dulwich relies only on the pack format
  95. to store Git objects. Instead of using only an index (pack-sha.idx)
  96. along with the pack, we add a second file (pack-sha.info). This file
  97. is automatically created when a client pushes some references on the
  98. repository. The purpose of this file is to speed up pack creation
  99. server side when a client fetches some references. Currently this
  100. .info format is not optimized and may change in future.