Use sphinx-prompt extension (#4908)

* Use sphinx-prompt extension

* Update PM2 guide

* Use an actual proper way to run Red with PM2

* Fix pm2 docs

Co-authored-by: Kowlin <Kowlin@users.noreply.github.com>
This commit is contained in:
jack1142
2021-04-03 18:52:11 +02:00
committed by GitHub
parent 0144cbf88b
commit 0becf70b05
8 changed files with 116 additions and 80 deletions

View File

@@ -12,39 +12,37 @@ Installing PM2
Start by installing Node.JS and NPM via your favorite package distributor. From there run the following command:
:code:`npm install pm2 -g`
.. prompt:: bash
npm install pm2 -g
After PM2 is installed, run the following command to enable your Red instance to be managed by PM2. Replace the brackets with the required information.
You can add additional Red based arguments after the instance, such as :code:`--dev`.
You can add additional Red based arguments after the instance name, such as :code:`--dev`.
.. code-block:: none
.. prompt:: bash
pm2 start redbot --name "<Insert a name here>" --interpreter "<Location to your Python Interpreter>" --interpreter-args "-O" -- <Red Instance> --no-prompt
pm2 start "<path>" --name "<app_name>" -- -O -m redbot <instance_name> --no-prompt
.. code-block:: none
**Arguments to replace**
Arguments to replace.
- ``<app_name>`` - A name to identify the bot within pm2, this is not your Red instance.
<Insert a name here>
A name to identify the bot within pm2, this is not your Red instance.
- | ``<path>`` - The location of your Python interpreter.
| To find out where that is, use the proper set of commands:
<Location to your Python Interpreter>
The location of your Python interpreter, to find out where that is use the following command inside activated venv:
which python
.. prompt:: bash
:prompts: $,(redenv) $
:modifiers: auto
<Red Instance>
The name of your Red instance.
# If redbot is installed in a venv
$ source ~/redenv/bin/activate
(redenv) $ which python
If you used :code:`pyenv virtualenv` to create your virtual environment, please make the following changes to the above generated command
# If redbot is installed in a pyenv virtualenv
$ pyenv shell <virtualenv_name>
(redenv) $ pyenv which python
.. code-block:: none
<Location to your Python Interpreter>
Run the following instead to get your Python interpreter
pyenv which python
Replace the `redbot` part of `pm2 start redbot` with the output of the following (when ran inside your activated venv)
pyenv which redbot
- ``<instance_name>`` - The name of your Red instance.
------------------------------
Ensuring that PM2 stays online
@@ -52,4 +50,7 @@ Ensuring that PM2 stays online
To make sure that PM2 stays online and persistence between machine restarts, run the following commands:
:code:`pm2 save` & :code:`pm2 startup`
.. prompt:: bash
pm2 save
pm2 startup