Skip to content

Commit

Permalink
Merge branch '2.6' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
jblomer committed Jul 29, 2019
2 parents d22730a + 111110f commit 0bf82b1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 97 deletions.
2 changes: 2 additions & 0 deletions apx-parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ CVMFS_REPOSITORY_TTL | The frequency in seconds of client lookups
| Defaults to 4 minutes.
CVMFS_ROOT_KCATALOG_LIMIT | Maximum thousands of files allowed in root catalogs, default 200
| (see also *CVMFS_NESTED_KCATALOG_LIMIT* and *CVMFS_ENFORCE_LIMITS*
CVMFS_SNAPSHOT_GROUP | Group name for subset of repositories used with ``cvmfs_server snapshot -a -g``.
| Added with ``cvmfs_server add-replica -g``.
CVMFS_SPOOL_DIR | Location of the upstream spooler scratch directories;
| the read-only CernVM-FS moint point and copy-on-write storage reside here.
CVMFS_STRATUM0 URL of the master copy (*stratum0*) of this specific repository.
Expand Down
112 changes: 16 additions & 96 deletions cpt-notification-system.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,118 +16,38 @@ software build and test pipeline, where later stages of the pipeline depend on
artifacts published at earlier stages of the pipeline already being available
in replicas of the repository.

The main components of the notification system are the message broker and a
command-line tool used to publish new messages and subscribe to notifications.
Additionally, CernVM-FS clients can also be configured to receive and react to
notifications.

The message broker
==================

RabbitMQ, an open-source message broker, drives the notification system.
Besides offering very high performance, RabbitMQ ensures the reliable delivery
of messages and persists the message queue in case of crashes.

RabbitMQ clients communicate with the broker using the AMQ protocol (AQMP 0.9).
To avoid distributing the AMQP credentials (username and password) to every
client of the CernVM-FS notification system, the ``cvmfs-notify`` service,
installed from the package with the same name, functions as a proxy in front of
the broker: the cvmfs-notify daemon maintains an AMQP connection to the broker
and accepts message submissions over HTTP and subscriptions over Websockets.
The ``cvmfs-notify`` service should be colocated with the RabbitMQ instance.

Configuration
-------------

First, install the ``rabbitmq-server`` package. The firewall port 5672/TCP
should be open if remote AMQP access is desired, while the web administration
console runs on port 15672/TCP.

Start and enable the RabbitMQ service: ::

# systemctl start rabbitmq-server
# systemctl enable rabbitmq-server

The web administration console can be enabled, if needed, simplifying the
configuration of RabbitMQ: ::

# rabbitmq-plugins enable rabbitmq_management

The default guest user should be deleted: ::

# rabbitmqctl delete_user guest

Add the "/cvmfs" vhost if needed: ::

# rabbitmqctl add_vhost /cvmfs

Add and configure the administrator user, which can be used to login to the web
console: ::

# rabbitmqctl add_user "admin" <ADMIN_PASSWORD>
# rabbitmqctl set_permissions -p /cvmfs "admin" ".*" ".*" ".*"
# rabbitmqctl set_user_tags "admin" administrator

``<ADMIN_PASSWORD>`` should be substituted for a suitable strong password.

Add and configure the worker user: ::

# rabbitmqctl add_user "worker" <WORKER_PASSWORD>
# rabbitmqctl set_permissions -p /cvmfs "worker" "^(amq\.gen.*|repository\.activity)$" "^(amq\.gen.*|repository\.activity)$" ".*"

As before, ``<WORKER_PASSWORD>`` should be substituted for a suitable strong
password.

With RabbitMQ installed and configured, the final steps are to install the
``cvmfs-notify`` package and open firewall port 4930/TCP.

``cvmfs-notify`` is configured in ``/etc/cvmfs/notify/config.json``: ::

{
"port": 4930,
"log_level": "info",
"amqp": {
"url": "localhost",
"exchange": "repository.activity",
"vhost": "/cvmfs",
"port": 5672,
"user": "<USERNAME>",
"pass": "<PASSWORD>"
}
}

Most of the fields can be kept at their default value, but the "user" and
"pass" fields should be changed to the values of the worker username and
password defined at the previous step.

4. Start and enable the ``cvmfs-notify`` service: ::

# systemctl start cvmfs-notify
# systemctl enable cvmfs-notify
The main components of the notification system are a message broker, part of
the CernVM-FS repository gateway application, and a command-line tool to
publish new messages and subscribe to notifications. CernVM-FS clients can also
be configured to receive and react to notifications. Communication between the
notification system clients and the broker is done with standard HTTP. The
message broker does not require any specific configuration. Please consult the
relevant documentation (:ref:`cpt_repository_gateway`) for setting up a
gateway.

Command-line tool for the notification system
=============================================
---------------------------------------------

There is a new ``notify`` subcommand in the ``cvmfs_swissknife`` command, which
There is a new ``notify`` sub-command in the ``cvmfs_swissknife`` command, which
is used to publish and subscribe to activity messages for a specific
repository.

Example:
--------
========

* The CernVM-FS repository is located at ``http://stratum-zero.cern.ch/cvmfs/test.repo.ch``
* The notification server is located at ``http://notify.cern.ch:4930/api/v1``
* The repository gateway is located at ``http://gateway.cern.ch:4929/api/v1``

To publish the current manifest of the repository to the notification system, simply run: ::

# cvmfs_swissknife notify -p \
-u http://notify.cern.ch:4930/api/v1/publish \
-u http://gateway.cern.ch:4929/api/v1 \
-r http://stratum-zero.cern.ch/cvmfs/test.cern.ch

To subscribe to the stream of messages concerning the repository, run: ::

# cvmfs_swissknife notify -s \
-u http://notify.cern.ch:4930/api/v1/subscribe \
-u http://gateway.cern.ch:4929/api/v1 \
-t test.cern.ch

By default, once a message is received, the command will exit.
Expand All @@ -141,12 +61,12 @@ The subscription command has two optional flags:
is printed and the command will not exit (when the ``-c`` flag is not given).

CernVM-FS client configuration
==============================
------------------------------

A CernVM-FS client can also be connected to a notification server, allowing the
client to react to activity messages by triggering a remount of the repository.

This functionality is enabled with the following client configuration option:
::

CVMFS_NOTIFICATION_SERVER=http://notify.cern.ch:4930/api/v1/subscribe
CVMFS_NOTIFICATION_SERVER=http://gateway.cern.ch:4929/api/v1
2 changes: 1 addition & 1 deletion cpt-replica.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CernVM-FS repository served by a Stratum 0 server. To this end, the
``cvmfs_server`` utility provides the ``add-replica`` command. This
command will register the Stratum 0 URL and prepare the local web
server. Periodical synchronization has to be scheduled, for instance
with ``cron``, using the ``cvmfs_server snapshot`` command. The
with ``cron``, using the ``cvmfs_server snapshot -a`` command. The
advantage over general purpose mirroring tools such as rSync is that all
CernVM-FS file integrity verifications mechanisms from the Fuse client
are reused. Additionally, by the aid of the CernVM-FS file catalogs, the
Expand Down

0 comments on commit 0bf82b1

Please sign in to comment.