Skip to content

Commit

Permalink
docs: Add new page to explain how to deploy Teleirc
Browse files Browse the repository at this point in the history
This commit is part of issue #118.

A new page is added specifically to explain how to deploy Teleirc. It
consolidates the **Usage** section from `installation.rst` and all of
the `using-docker.rst` page. This commit intends to make deployment
options more clear and easy to understand.

Some methods were removed, like the ArchLinux package. It is many
updates behind on the bot, so I think it's better to recommend people to
use directly from source where possible.
  • Loading branch information
jwflory committed Feb 16, 2019
1 parent c51d9a1 commit 4424d07
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 74 deletions.
95 changes: 95 additions & 0 deletions docs/deploy-teleirc.rst
@@ -0,0 +1,95 @@
#####################
How to deploy Teleirc
#####################

There are several ways to deploy Teleirc persistently.
This page offers suggestions on possible deployment options.


*******
systemd
*******

The **recommended deployment method** is with `systemd <https://en.wikipedia.org/wiki/Systemd>`_.
This method requires a basic understanding of systemd unit files.
Create a unique systemd service for each Teleirc instance.

A `provided systemd service <https://github.com/RITlug/teleirc/blob/master/misc/teleirc.service>`_ file is available.
Add the systemd unit file to ``/usr/lib/systemd/system/`` to activate it.
Now, ``systemctl`` can be used to control your Teleirc instance.

Note the provided file makes two assumptions:

- Using a dedicated system user (e.g. ``teleirc``)
- Teleirc config files located at ``/usr/lib64/teleirc/`` (i.e. files inside Teleirc repository)


***
pm2
***

`pm2 <http://pm2.keymetrics.io/>`_ keeps NodeJS running in the background.
If you run an application and it crashes, pm2 restarts the process.
pm2 also restarts processes if the server reboots.
Read the `pm2 documentation <http://pm2.keymetrics.io/docs/usage/quick-start/>`_ for more information.

After pm2 is installed, run these commands to start Teleirc::

cd teleirc/
pm2 start -n my-teleirc-bot teleirc.js


******
Docker
******

Docker is another way to deploy Teleirc.
Dockerfiles and images are available in ``images/``.

Which image do I choose?
========================

Node Alpine Linux and Fedora images are provided.

+------------------------------------------------------------------------------+-----------------------+---------+
| Image | File | Size |
+==============================================================================+=======================+=========+
| `Node Alpine Linux <https://hub.docker.com/r/_/node/>`_ (``node:10-alpine``) | ``Dockerfile.alpine`` | 374 MB |
+------------------------------------------------------------------------------+-----------------------+---------+
| `Fedora latest <https://hub.docker.com/r/_/fedora/>`_ | ``Dockerfile.fedora`` | 569 MB |
+------------------------------------------------------------------------------+-----------------------+---------+

This guide uses ``alpine``.
If you wish to use ``fedora``, replace ``alpine`` with ``fedora``.

Building Docker image
=====================

You may see errors running ``yarn``.
You can safely ignore them.
They are not fatal.

.. code-block:: bash
docker build . -f images/Dockerfile.alpine -t teleirc
docker run -d -u teleirc --name teleirc --restart always \
-e TELEIRC_TOKEN="000000000:AAAAAAaAAa2AaAAaoAAAA-a_aaAAaAaaaAA" \
-e IRC_CHANNEL="#channel" \
-e IRC_BOT_NAME="teleirc" \
-e IRC_BLACKLIST="CowSayBot,AnotherNickToIgnore" \
-e TELEGRAM_CHAT_ID="-0000000000000" \
teleirc
Docker Compose
==============

Optionally, you may use `docker-compose <https://docs.docker.com/compose>`_.
An `example compose file <https://github.com/RITlug/teleirc/blob/master/images/docker-compose.yml.example>`_ is provided.

Run these commands to use Docker Compose:

.. code-block:: bash
cp images/docker-compose.yml.example docker-compose.yml
cp env.example .env
docker-compose up -d teleirc
2 changes: 1 addition & 1 deletion docs/index.rst
Expand Up @@ -14,7 +14,7 @@ Today, it is used by various communities.
:caption: Contents

installation
using-docker
deploy-teleirc
config-file-glossary
who-uses-teleirc

Expand Down
73 changes: 0 additions & 73 deletions docs/using-docker.rst

This file was deleted.

0 comments on commit 4424d07

Please sign in to comment.