README.rst 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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.
  24. They are: Docker Compose, Vagrant, and manual. Choose an option below.
  25. Docker Compose
  26. ^^^^^^^^^^^^^^
  27. Docker Compose will provide you with a container which you can develop on.
  28. Install it `with these instructions <https://docs.docker.com/compose/install/>`_.
  29. For more information about docker-compose cli, see: https://docs.docker.com/compose/reference/.
  30. Once installed, create the folder that will receive the projects, forks, docs,
  31. requests and tickets' git repo. Run this command exactly as it appears::
  32. $ mkdir -p lcl/{repos,remotes,attachments,releases}
  33. A docker compose environment is available to run pagure. First use the following
  34. command to build the containers. ::
  35. $ docker-compose -f dev/docker-compose.yml build
  36. Once all the containers are built, run the following command to start the containers. ::
  37. $ docker-compose -f dev/docker-compose.yml up
  38. Once all the containers have started, you can access pagure on http://localhost:5000.
  39. To stop the containers, press Ctrl+C.
  40. To populate the container with test data and create a new account, run ::
  41. $ docker-compose -f dev/docker-compose.yml exec web python dev-data.py --all
  42. You can then login with any of the created users.
  43. Vagrant
  44. ^^^^^^^
  45. For a more thorough introduction to Vagrant, see
  46. https://fedoraproject.org/wiki/Vagrant.
  47. An example Vagrantfile is provided as ``Vagrantfile.example``. To use it,
  48. just copy it and install Vagrant. Instructions for Fedora::
  49. $ cp dev/Vagrantfile.example Vagrantfile
  50. $ sudo dnf install ansible libvirt vagrant-libvirt vagrant-sshfs vagrant-hostmanager
  51. $ vagrant up
  52. On Ubuntu, install Vagrant directly `from the website <https://www.vagrantup.com/downloads.html>`_
  53. then run these commands instead::
  54. $ cp dev/Vagrantfile.example Vagrantfile
  55. $ sudo add-apt-repository ppa:ansible/ansible
  56. $ sudo apt update
  57. $ sudo apt install ansible libvirt0 openssh-server qemu libvirt-bin ebtables dnsmasq libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev
  58. $ vagrant plugin install vagrant-libvirt vagrant-sshfs vagrant-hostmanager
  59. If you get this error ``Block in synced_folders: Internal error. Invalid: sshfs``,
  60. when you run ``vagrant up`` , you need to install vagrant sshfs plugin, which can be done by::
  61. $ vagrant plugin install vagrant--sshfs
  62. and then::
  63. $ vagrant up
  64. The default ``Vagrantfile`` forwards ports from the host to the guest,
  65. so you can interact with the application as if it were running on your
  66. host machine.
  67. .. note::
  68. ``vagrant-hostmanager`` will automatically maintain /etc/hosts for you so you
  69. can access the development environment from the host using its hostname, which
  70. by default is ``pagure-dev.example.com``. You can choose not to use this
  71. functionality by simply not installing the ``vagrant-hostmanager`` plugin, but
  72. if you want Pagure to provide valid URLs in the UI for git repositories, you
  73. will need to adjust Pagure's configuration found in ~/pagure.cfg on the guest.
  74. When the vagrant VM is up and running, connect to it with::
  75. $ vagrant ssh
  76. This will log you into the VM as the user ``vagrant`` which has a couple of aliases
  77. preconfigured::
  78. $ pstart # Starts pagure, the workers and other tasks
  79. $ pstop # Stops all those tasks again
  80. $ pstatus # Shows pagure status
  81. The Vagrant pagure doesn't have its own log file, use ``journalctl -f`` to
  82. show the pagure output. The verbosity can be configured in the pagure config file
  83. with the ``LOGGING`` parameter.
  84. Running the unit-tests
  85. **********************
  86. To run the unit-tests, there is container available with all the dependencies needed.
  87. Use the following command to run the tests ::
  88. $ ./dev/run-tests-docker.py
  89. This command will build a fedora based container and execute the test suite.
  90. If you wish to execute the test suite on a centos based container run the following command ::
  91. $ ./dev/run-tests-docker.py --centos
  92. When the test container image has been built you can skip the building step to save time
  93. and run directly the test suite. ::
  94. $ ./dev/run-tests-docker.py --skip-build
  95. $ ./dev/run-tests-docker.py --centos --skip-build
  96. You can also run a single test case ::
  97. $ ./dev/run-tests-docker.py tests/test_pagure_flask_ui_priorities.py
  98. Or a single test ::
  99. $ ./dev/run-tests-docker.py tests/test_pagure_flask_ui_priorities.py:PagureFlaskPrioritiestests.test_ticket_with_no_priority
  100. You can also get `run-tests-docker` help ::
  101. $ ./dev/run-tests-docker.py --help
  102. Manually
  103. ^^^^^^^^
  104. * Install the needed system libraries::
  105. sudo dnf install git python3 python3-devel libgit2-devel redis \
  106. libjpeg-devel gcc libffi-devel redhat-rpm-config
  107. .. note:: Do note the version of libgit2 that you install, for example
  108. in ``libgit2-0.23.4-1`` you need to keep in mind the ``0.23``
  109. .. note:: On RHEL and derivative (CentOS, Scientific Linux) there is no
  110. `python3` package. Just `python36` or `python34` available in
  111. EPEL 7 (EPEL 6 only has `python34`). Choose the one you prefer
  112. (3.6 is newer and generally a better choice).
  113. * Retrieve the sources::
  114. git clone https://pagure.io/pagure.git
  115. cd pagure
  116. * Install dependencies
  117. * create the virtual environment (use `pytohn3.X` explicitly on EPEL)::
  118. python3 -m venv pagure_env
  119. source ./pagure_env/bin/activate
  120. * Install the correct version of pygit2::
  121. pip install pygit2==<version of libgit2 found>.*
  122. So in our example::
  123. pip install pygit2==0.23.*
  124. * Install the rest of the dependencies::
  125. pip install -r requirements.txt
  126. * Create the folder that will receive the projects, forks, docs, requests and
  127. tickets' git repo::
  128. mkdir -p lcl/{repos,remotes,attachments,releases}
  129. * Copy and edit the alembic.ini file (especially the ``script_location`` key)::
  130. cp files/alembic.ini .
  131. vim alembic.ini
  132. * Set the ``script_location`` to ``alembic``, ie: the folder where the revisions
  133. are stored, relative to the location of the ``alembic.ini`` file.
  134. * Create the inital database scheme::
  135. python createdb.py --initial alembic.ini
  136. * Enable and start redis server::
  137. sudo systemctl enable redis
  138. sudo systemctl start redis
  139. * Start a worker, in one terminal::
  140. ./runworker.py
  141. * Run the application, in another terminal::
  142. ./runserver.py
  143. * To get some profiling information you can also run it as::
  144. ./runserver.py --profile
  145. This will launch the application at http://127.0.0.1:5000
  146. * To run unit-tests on pagure
  147. * Install the dependencies::
  148. pip install -r tests_requirements.txt
  149. * Run it::
  150. python runtests.py run
  151. You may use::
  152. python runtests.py --help
  153. to check other options supported or read the source code ;-)
  154. .. note:: While testing for worker tasks, pagure uses celery in /usr/bin/
  155. Celery then looks for eventlet (which we use for testing only) at
  156. system level and not in virtual environment. You will need to
  157. install eventlet outside of your virtual environment if you are
  158. using one.