Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarifies systemd and settings docs #63

Merged
merged 1 commit into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 70 additions & 18 deletions docs/installation/configuration.rst
Original file line number Diff line number Diff line change
@@ -1,22 +1,47 @@
.. _configuration:

Configuration
=============

.. _configuration:
Pulp uses `dynaconf <https://dynaconf.readthedocs.io/en/latest/>`_ for its settings which allows you
to configure Pulp in a few ways:

-----------

Pulp uses `dynaconf <https://dynaconf.readthedocs.io/en/latest/>`_ for its settings. dynaconf
allows storing `settings in multiple file formats <https://dynaconf.readthedocs
.io/en/latest/guides/examples.html>`_. By default Pulp looks for settings in ``/etc/pulp/settings
.py``. An alternate location for the settings file is specified by setting the ``PULP_SETTINGS``
environment variable. Each of the settings can also be set by prepending ``PULP_`` to the name
and setting it as an environment variable. The comprehensive list of settings can be found in
`Django docs <https://docs.djangoproject.com/en/2.1/ref/settings/>`_. `Environment variables
<https://dynaconf.readthedocs.io/en/latest/guides/environment_variables
.html#environment-variables>`_ take precedence over all other configuration sources. `TOML inline
table notation <https://github.com/toml-lang/toml#inline-table>`_ should be used to express any
nested environment variables such as ``PULP_LOGGING`` or ``PULP_DATABASES``. Python is the
recommended language for expressing configuration in a settings file.
By Configuration File
---------------------

Non-default settings can be specified in the ``/etc/pulp/settings.py``. The presence of this file is
optional. The expected location and format can be changed by specifying the ``PULP_SETTINGS``
environment variable. Dynaconf supports `settings in multiple file formats <https://dynaconf.
readthedocs.io/en/latest/guides/examples.html>`_


By Environment Variables
------------------------

Each of the settings can also be configured using Dynaconf by prepending ``PULP_`` to the name of
the setting and specifying that as an environment variable. For example the ``SECRET_KEY`` can be
specified by exporting the ``PULP_SECRET_KEY`` variable.


Settings
--------

Pulp uses three types of settings:

* `Django settings <django-settings>`_ Pulp is configuring
* `Pulp defined settings <pulp-settings>`_
* `RQ settings <rq-settings>`_ Pulp is using


.. _django-settings:

Django Settings
---------------

Pulp is a Django project, so any Django `Django setting
<https://docs.djangoproject.com/en/2.1/ref/settings/>`_ can also be set to configure your Pulp
deployment.

SECRET_KEY
^^^^^^^^^^
Expand Down Expand Up @@ -67,12 +92,25 @@ LOGGING
refer to `Django documenation on logging <https://docs.djangoproject.com/en/2
.1/topics/logging/#configuring-logging>`_.

WORKING_DIRECTORY
^^^^^^^^^^^^^^^^^

The directory used by workers to store files temporarily. This defaults to
``/var/lib/pulp/tmp/``.
.. _rq-settings:

RQ Settings
-----------

The following RQ settings can be set in your Pulp config:

* REDIS_URL
* REDIS_HOST
* REDIS_PORT
* REDIS_DB
* REDIS_PASSWORD
* SENTINEL

These will be used by any worker loaded with the ``-c 'pulpcore.rqconfig'`` option.

Below are some common settings used for RQ configuration. See the `RQ settings documentation
<http://python-rq.org/docs/workers/#using-a-config-file>`_ for information on these settings.

REDIS_HOST
^^^^^^^^^^
Expand All @@ -92,6 +130,20 @@ REDIS_PASSWORD
The password for Redis.


.. _pulp-settings:

Pulp Settings
-------------

Pulp defines the following settings itself:

WORKING_DIRECTORY
^^^^^^^^^^^^^^^^^

The directory used by workers to store files temporarily. This defaults to
``/var/lib/pulp/tmp/``.


CONTENT_HOST
^^^^^^^^^^^^

Expand Down
10 changes: 3 additions & 7 deletions docs/installation/instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ After installing and configuring Redis, you should configure it to start at boot
Systemd
-------

To run the Pulp services, three systemd files needs to be created in /etc/systemd/system/. Make
sure to substitute ``Environment=PULP_SETTINGS=/path/to/pulp/server.yaml`` with the real location
of :ref:`configuration file <configuration>`.
To run the Pulp services, three systemd files needs to be created in /etc/systemd/system/. You can
apply custom configuration here using the ``Environment`` option using settings from the
:ref:`Pulp settings documentation <configuration>`.

``pulp-resource-manager.service``::

Expand All @@ -150,8 +150,6 @@ of :ref:`configuration file <configuration>`.
Wants=network-online.target

[Service]
# Set Environment if server.yaml is not in the default /etc/pulp/ directory
Environment=PULP_SETTINGS=/path/to/pulp/server.yaml
Environment="DJANGO_SETTINGS_MODULE=pulpcore.app.settings"
User=pulp
WorkingDirectory=/var/run/pulp-resource-manager/
Expand All @@ -173,8 +171,6 @@ of :ref:`configuration file <configuration>`.
Wants=network-online.target

[Service]
# Set Environment if server.yaml is not in the default /etc/pulp/ directory
Environment=PULP_SETTINGS=/path/to/pulp/server.yaml
Environment="DJANGO_SETTINGS_MODULE=pulpcore.app.settings"
User=pulp
WorkingDirectory=/var/run/pulp-worker-%i/
Expand Down
12 changes: 8 additions & 4 deletions pulpcore/app/serializers/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,14 @@ def get_content_summary(self, obj):
The summary of contained content.

Returns:
dict: {'added': {<_type>: {'count': <count>, 'href': <href>},
'removed': {<_type>: {'count': <count>, 'href': <href>},
'present': {<_type>: {'count': <count>, 'href': <href>},
}
dict: The dictionary has the following format.::

{
'added': {<_type>: {'count': <count>, 'href': <href>},
'removed': {<_type>: {'count': <count>, 'href': <href>},
'present': {<_type>: {'count': <count>, 'href': <href>},
}

"""
to_return = {'added': {}, 'removed': {}, 'present': {}}
for count_detail in obj.counts.all():
Expand Down