##// END OF EJS Templates
feat(hide recaptcha secrets): masked sensitive information related to reCaptcha configuration.
feat(hide recaptcha secrets): masked sensitive information related to reCaptcha configuration.

File last commit:

r5354:68e33808 default
r5641:ad0048eb tip default
Show More
admin-tricks.rst
300 lines | 9.2 KiB | text/x-rst | RstLexer
docs: updated documentation structure
r3693 .. _admin-tricks:
One-time Admin Tasks
--------------------
* :ref:`web-analytics`
* :ref:`admin-tricks-license`
* :ref:`announcements`
* :ref:`md-rst`
* :ref:`repo-stats`
* :ref:`server-side-merge`
* :ref:`remap-rescan`
* :ref:`custom-hooks`
* :ref:`clear-repo-cache`
* :ref:`set-repo-pub`
* :ref:`ping`
.. _web-analytics:
Adding Web Analytics
^^^^^^^^^^^^^^^^^^^^
If you wish to add a Google Analytics, or any other kind of tracker to your
|RCE| instance you can add the necessary codes to the header or footer
section of each instance using the following steps:
1. From the |RCE| interface, select
:menuselection:`Admin --> Settings --> Global`
2. To add a tracking code to you instance, enter it in the header or footer
section and select **Save**
Use the example templates in the drop-down menu to set up your configuration.
.. _admin-tricks-license:
Licence Key Management
^^^^^^^^^^^^^^^^^^^^^^
To manage your license key, go to
:menuselection:`Admin --> Settings --> License`.
On this page you can see the license key details. If you need a new license,
or have questions about your current one, contact support@rhodecode.com
.. _announcements:
Server-wide Announcements
^^^^^^^^^^^^^^^^^^^^^^^^^
If you need to make a server-wide announcement to all users,
you can add a message to be displayed using the following steps:
1. From the |RCE| interface, select
:menuselection:`Admin --> Settings --> Global`
2. To add a message that will be displayed to all users,
select :guilabel:`Server Announcement` from the drop-down menu and
change the ``var message = "TYPE YOUR MESSAGE HERE";`` example line.
3. Select :guilabel:`Save`, and you will see the message once your page
refreshes.
.. image:: ../../images/server-wide-announcement.png
:alt: Server Wide Announcement
.. _md-rst:
Suppress license warnings or errors
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In case you're running on maximum allowed users, RhodeCode will display a
warning message on pages that you're close to the license limits.
It's often not desired to show that all the time. Here's how you can suppress
the license messages.
1. From the |RCE| interface, select
:menuselection:`Admin --> Settings --> Global`
2. Select :guilabel:`Flash message filtering` from the drop-down menu.
3. Select :guilabel:`Save`, and you will no longer see the license message
once your page refreshes.
.. _admin-tricks-suppress-license-messages:
Markdown or RST Rendering
^^^^^^^^^^^^^^^^^^^^^^^^^
|RCE| can use `Markdown`_ or `reStructured Text`_ in commit message,
code review messages, and inline comments. To set the default to either,
select your preference from the drop-down menu on the
:menuselection:`Admin --> Settings --> Visual` page and select
:guilabel:`Save settings`.
.. _repo-stats:
Enabling Repository Statistics
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To enable |repo| statistics, use the following steps:
1. From the |RCE| interface, open
:menuselection:`Admin --> Repositories` and select
:guilabel:`Edit` beside the |repo| for which you wish to enable statistics.
2. Check the :guilabel:`Enable statistics` box, and select :guilabel:`Save`
.. _server-side-merge:
Enabling Server-side Merging
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To enable server-side merging, use the following steps:
1. From the |RCE| interface, open :menuselection:`Admin --> Settings --> VCS`
2. Check the :guilabel:`Server-side merge` box, and select
:guilabel:`Save Settings`
If you encounter slow performance with server-side merging enabled, check the
speed at which your server is performing actions. When server-side merging is
enabled, the following actions occurs on the server.
* A |pr| is created in the database.
* A shadow |repo| is created as a working environment for the |pr|.
* On display, |RCE| checks if the |pr| can be merged.
To check how fast the shadow |repo| creation is occurring on your server, use
the following steps:
1. Log into your server and create a directory in your |repos| folder.
2. Clone a |repo| that is showing slow performance and time the action.
.. code-block:: bash
# One option is to use the time command
$ time hg clone SOURCE_REPO TARGET
.. _remap-rescan:
Remap and Rescan Repositories
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You may want to Remap and rescan the |repos| that |RCE| is managing to ensure
the system is always up-to-date. This is useful after importing, deleting,
or carrying out general cleaning up operations. To do this use the
following steps:
1. From the |RCE|, open
:menuselection:`Admin --> Settings --> Remap and rescan`
2. Click :guilabel:`Rescan Repositories`
Check the additional options if needed:
* :guilabel:`Destroy old data`: Useful for purging deleted repository
information from the database.
* :guilabel:`Invalidate cache for all repositories`: Use this to completely
remap all |repos|. Useful when importing or migrating |repos| to ensure all
new information is picked up.
.. _custom-hooks:
Adding Custom Hooks
^^^^^^^^^^^^^^^^^^^
To add custom hooks to your instance, use the following steps:
1. Open :menuselection:`Admin --> Settings --> Hooks`
2. Add your custom hook details, you can use a file path to specify custom
hook scripts, for example:
``pretxnchangegroup.example`` with value ``python:/path/to/custom_hook.py:my_func_name``
3. Select :guilabel:`Save`
Also, see the RhodeCode Extensions section of the :ref:`rc-tools` guide. RhodeCode
Extensions can be used to add additional hooks to your instance and comes
with a number of pre-built plugins if you chose to install them.
.. _clear-repo-cache:
Clearing |repo| cache
^^^^^^^^^^^^^^^^^^^^^
If you need to clear the cache for a particular |repo|, use the following steps:
1. Open :menuselection:`Admin --> Repositories` and select :guilabel:`Edit`
beside the |repo| whose cache you wish to clear.
2. On the |repo| settings page, go to the :guilabel:`Caches` tab and select
:guilabel:`Invalidate repository cache`.
.. _set-lang:
Changing Default Language
^^^^^^^^^^^^^^^^^^^^^^^^^
To change the default language of a |RCE| instance, change the language code
docs: fixed config files path for editing settings...
r5354 in the :file:`config/_shared/rhodecode.ini` file. To
docs: updated documentation structure
r3693 do this, use the following steps.
1. Open the :file:`rhodecode.ini` file and set the required language code.
.. code-block:: ini
## Optional Languages
## en(default), de, fr, it, ja, pl, pt, ru, zh
lang = de
2. Restart the |RCE| instance and check that the language has been updated.
.. code-block:: bash
$ rccontrol restart enterprise-2
Instance "enterprise-2" successfully stopped.
Instance "enterprise-2" successfully started.
.. image:: ../../images/language.png
.. _set-repo-pub:
Setting Repositories to Publish
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To automatically promote your local |repos| to public after pushing to |RCE|,
enable the :guilabel:`Set repositories as publishing` option on the
:menuselection:`Admin --> Settings --> VCS` page.
.. note::
This option is enabled by default on most |RCE| versions, but if upgrading
from a 1.7.x version it could be disabled on upgrade due to inheriting
older default settings.
.. _ping:
Pinging the |RCE| Server
^^^^^^^^^^^^^^^^^^^^^^^^
You can check the IP Address of your |RCE| instance using the
following URL: ``{instance-URL}/_admin/ping``.
.. code-block:: bash
$ curl https://your.rhodecode.url/_admin/ping
pong[rce-7880] => 203.0.113.23
.. _Markdown: http://daringfireball.net/projects/markdown/
tests: fixed links to rst manual.
r4437 .. _reStructured Text: http://docutils.sourceforge.io/docs/index.html
docs: updated documentation structure
r3693
Unarchiving a repository
^^^^^^^^^^^^^^^^^^^^^^^^^
Archive operation for the repository is similar as delete. Archive keeps the data for future references
but makes the repository read-only. After archiving the repository it shouldn't be modified in any way.
This is why repository settings are disabled for an archived repository.
If there's a need for unarchiving a repository for some reasons, the interactive
ishell interface should be used.
.. code-block:: bash
# Open iShell from the terminal
$ rccontrol ishell enterprise-1/community-1
.. code-block:: python
# Set repository as un-archived
In [1]: repo = Repository.get_by_repo_name('SOME_REPO_NAME')
In [2]: repo.archived = False
In [3]: Session().add(repo);Session().commit()
docs: added new admin trick to bulk change owner of repository
r4776
Bulk change repository owner
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Here's how one can change an owner of repository for an user who has been de activated.
Settings a new owner can be done via ishell for all repositories that past owner had.
do run this script the interactive ishell interface should be used.
.. code-block:: bash
# Open iShell from the terminal
$ rccontrol ishell enterprise-1/community-1
.. code-block:: python
from rhodecode.model.db import User, Repository, Session
from rhodecode.model.permission import PermissionModel
# replace old-owner and new-owner with your exact users
old_owner = User.get_by_username('old-owner')
new_owner = User.get_by_username('new-owner')
# list of users we need to "flush" permissions
affected_user_ids = [new_owner.user_id, old_owner.user_id]
for repo in Repository.get_all_repos(user_id=old_owner.user_id):
repo.user = new_owner
Session().add(repo)
Session().commit()
PermissionModel().trigger_permission_flush(affected_user_ids)