README.rst 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. Pagure
  2. ======
  3. :Author: Pierre-Yves Chibon <pingou@pingoured.fr>
  4. Pagure is a git-centered forge, python based using pygit2.
  5. With pagure you can host your project with its documentation, let your users
  6. report issues or request enhancements using the ticketing system and build your
  7. community of contributors by allowing them to fork your projects and contribute
  8. to it via the now-popular pull-request mechanism.
  9. Homepage: https://pagure.io/pagure
  10. See it at work: https://pagure.io
  11. Playground version: https://stg.pagure.io
  12. If you have any questions or just would like to discuss about pagure,
  13. feel free to drop by on IRC in the channel ``#pagure`` of the freenode server
  14. About its name
  15. ==============
  16. The name Pagure is taken from the French word 'pagure'. Pagure in French is used as the
  17. common name for the crustaceans from the `Paguroidea <https://en.wikipedia.org/wiki/Hermit_crab>`_
  18. superfamily, which is basically the family of the Hermit crabs.
  19. Originating from French it is pronounced with a strong 'g' as you can hear
  20. on `this recording <https://pagure.io/how-do-you-pronounce-pagure/raw/master/f/pingou.ogg>`_.
  21. Get it running
  22. ==============
  23. There are several options when it comes to a development environment. Vagrant
  24. will provide you with a virtual machine which you can develop on, or you can
  25. install it directly on your host machine.
  26. Vagrant
  27. ^^^^^^^
  28. For a more thorough introduction to Vagrant, see
  29. https://fedoraproject.org/wiki/Vagrant.
  30. An example Vagrantfile is provided as ``Vagrantfile.example``. To use it,
  31. just copy it and install Vagrant::
  32. $ cp dev/Vagrantfile.example Vagrantfile
  33. $ sudo dnf install ansible libvirt vagrant-libvirt vagrant-sshfs vagrant-hostmanager
  34. $ vagrant up
  35. If you get this error ``Block in synced_folders: Internal error. Invalid: sshfs``,
  36. when you run ``vagrant up`` , you need to install vagrant sshfs plugin, which can be done by::
  37. $ vagrant plugin install vagrant--sshfs
  38. and then::
  39. $ vagrant up
  40. The default ``Vagrantfile`` forwards ports from the host to the guest,
  41. so you can interact with the application as if it were running on your
  42. host machine.
  43. .. note::
  44. ``vagrant-hostmanager`` will automatically maintain /etc/hosts for you so you
  45. can access the development environment from the host using its hostname, which
  46. by default is ``pagure-dev.example.com``. You can choose not to use this
  47. functionality by simply not installing the ``vagrant-hostmanager`` plugin, but
  48. if you want Pagure to provide valid URLs in the UI for git repositories, you
  49. will need to adjust Pagure's configuration found in ~/pagure.cfg on the guest.
  50. Docker Compose
  51. ^^^^^^^^^^^^^^
  52. Create the folder that will receive the projects, forks, docs, requests and
  53. tickets' git repo::
  54. mkdir -p lcl/{repos,remotes,attachments,releases}
  55. A docker compose environment is available to run pagure. First use the following
  56. command to build the containers. ::
  57. $ docker-compose -f dev/docker-compose.yml build
  58. Once all the containers are built, run the following command to start the containers. ::
  59. $ docker-compose -f dev/docker-compose.yml up -d
  60. Once all the containers have started, you can access pagure on http://localhost:5000
  61. To stop the containers, run the following ::
  62. $ docker-compose -f dev/docker-compose.yml stop
  63. More information about docker-compose cli see https://docs.docker.com/compose/reference/.
  64. Running the unit-tests
  65. **********************
  66. To run the unit-tests, there is container available with all the dependencies needed.
  67. Use the following command to run the tests ::
  68. $ ./dev/run-tests-docker.py
  69. This command will build a fedora based container and execute the test suite.
  70. If you wish to execute the test suite on a centos based container run the following command ::
  71. $ ./dev/run-tests-docker.py --centos
  72. When the test container image has been built you can skip the building step to save time
  73. and run directly the test suite. ::
  74. $ ./dev/run-tests-docker.py --skip-build
  75. $ ./dev/run-tests-docker.py --centos --skip-build
  76. You can also run a single test case ::
  77. $ ./dev/run-tests-docker.py tests/test_pagure_flask_ui_priorities.py
  78. Or a single test ::
  79. $ ./dev/run-tests-docker.py tests/test_pagure_flask_ui_priorities.py:PagureFlaskPrioritiestests.test_ticket_with_no_priority
  80. You can also get `run-tests-docker` help ::
  81. $ ./dev/run-tests-docker.py --help
  82. Manually
  83. ^^^^^^^^
  84. * Install the needed system libraries::
  85. sudo dnf install git python3-virtualenv libgit2-devel redis \
  86. libjpeg-devel gcc libffi-devel redhat-rpm-config
  87. .. note:: Do note the version of libgit2 that you install, for example
  88. in ``libgit2-0.23.4-1`` you need to keep in mind the ``0.23``
  89. .. note:: On RHEL and derivative (CentOS, Scientific Linux) the package
  90. `python3-virtualenv` is named `python34-virtualenv` and is
  91. available through EPEL.
  92. * Retrieve the sources::
  93. git clone https://pagure.io/pagure.git
  94. cd pagure
  95. * Install dependencies
  96. * create the virtualenv::
  97. virtualenv-3 pagure_env
  98. source ./pagure_env/bin/activate
  99. * Install the correct version of pygit2::
  100. pip install pygit2==<version of libgit2 found>.*
  101. So in our example::
  102. pip install pygit2==0.23.*
  103. * Install the rest of the dependencies::
  104. pip install -r requirements.txt
  105. * Create the folder that will receive the projects, forks, docs, requests and
  106. tickets' git repo::
  107. mkdir -p lcl/{repos,remotes,attachments,releases}
  108. * Copy and edit the alembic.ini file (especially the ``script_location`` key)::
  109. cp files/alembic.ini .
  110. vim alembic.ini
  111. * Set the ``script_location`` to ``alembic``, ie: the folder where the revisions
  112. are stored, relative to the location of the ``alembic.ini`` file.
  113. * Create the inital database scheme::
  114. python createdb.py --initial alembic.ini
  115. * Enable and start redis server::
  116. systemctl enable redis
  117. systemctl start redis
  118. * Start a worker, in one terminal::
  119. ./runworker.py
  120. * Run the application, in another terminal::
  121. ./runserver.py
  122. * To get some profiling information you can also run it as::
  123. ./runserver.py --profile
  124. This will launch the application at http://127.0.0.1:5000
  125. * To run unit-tests on pagure
  126. * Install the dependencies::
  127. pip install -r tests_requirements.txt
  128. * Run it::
  129. ./runtests.sh
  130. .. note:: While testing for worker tasks, pagure uses celery in /usr/bin/
  131. Celery then looks for eventlet (which we use for testing only) at
  132. system level and not in virtualenv. You will need to install eventlet
  133. outside of your virtualenv if you are using one.