Page MenuHomePhabricator

Request creation of <enwnbot> labs project (to bridge IRC channels and Telegram groups)
Closed, DeclinedPublic

Description

Project Name: enwnbot
Purpose: To run a teleIRC bot which bridges IRC channels and Telegram groups
Wikitech Username of requestor: acagastya

Brief description:
The bot runs on node, and works bidirectionally to send and receive messages from IRC to telegram.

How soon you are hoping this can be fulfilled:
As soon as possible, really.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 10 2017, 8:01 AM
Aklapper renamed this task from Request creation of <enwnbot> labs project to Request creation of <enwnbot> labs project (to bridge IRC channels and Telegram groups).May 12 2017, 11:00 AM

Just wondering, why can't this live on tool labs?

@zhuyifei1999, I need a project. I was told to create a project by another user who runs the bot for Chinese Wikiprojects. That user asked me to use Labs for login purpose only. I don't know what is the best practice. The code is ready, I need to host it.

Dargasea added a comment.EditedMay 13 2017, 4:17 PM

@Acagastya I understand that you have already gained access Tool Labs, and I would recommend you to check out Tool Labs' Help page for further information. You would need to create a Tool account and run your program there, since you cannot run tasks in the login server.

This sounds like the sort of bot that is generally a good fit for Tool Labs hosting. Today the best node.js support is offered by the Tool Labs Kubernetes cluster. It may take a small amount of custom Kubernetes configuration to run a bot that does not have a web component in that environment. Stashbot has such custom configuration, and I have been hoping to get that process documented for user who would like to do something similar.

@bd808 I am already running the teleirc bot based on node.js locally on my machine.

@bd808 I am already running the teleirc bot based on node.js locally on my machine.

That's a great start. The question here is if you need a full OpenStack project to run the production version of the bot or if you can run it using out Tool Labs project. There are several differences, but the biggest one is that in your own project you will be responsible for maintaining an entire virtual machine including all software and operating system updates and maintenance. In Tool Labs on the other hand you would only need to worry about maintaining your bot software and the Tool Labs admins would take care of the VMs and their needs.

In Tool Labs we have two different environments for executing long running programs. One is Grid Engine which provides Ubuntu Trusty execution hosts and nodejs v0.10.25. The other is Kubernetes which provides Debian Jessie Docker containers and nodejs v6.9.1.

We currently do not have good documentation on the steps needed to run a typical bot process on the Kubernetes cluster. The webservice --backend=kubernetes nodejs start|stop|restart|shell command handles the common use case of running a nodejs based web service. I think it would also work to run a nodejs bot assuming that the bot followed the required conventions for code placement and startup. It would be nicer however for us to document the basic steps needed to manage a custom Kubernetes "deployment". I just opened T165403: Document basics of using a custom Kubernetes "Deployment" to operate a tool to track the need for this documentation.

@bd808 So, what should I do if I want to choose kubernetes. (By the way, if phabricator the correct place to discuss about project request?)

@bd808 So, what should I do if I want to choose kubernetes.

It looks like you are already a member of the Tool Labs project, so you could try to follow the not very good yet instructions I have put up on wikitech for running a continuous job on Kubernetes: https://wikitech.wikimedia.org/wiki/Help:Tool_Labs/Kubernetes#Kubernetes_continuous_jobs

If you don't have a tool account created yet to run the bot under, make one using the form on wikitech. That form confusingly uses the term "service group" instead of "tool". The string you enter there will be the name of your new tool account. "enwnbot" is probably a good name to use based on your previous request.

  • You would need a deployment.yaml file that describes how to run your bot. You can start from the Stashbot config I posted in the help page. You would change all the "stashbot" strings in that file to <name of your tool> (probably "enwnbot").
  • You will also need to change the "image" config setting to "docker-registry.tools.wmflabs.org/toollabs-nodejs-base:latest" so that your container has the node.js runtime installed.
  • You will want to create your node_modules files while running the version of node that will be running in the Kubernetes container. You can do that by running webservice --backend=kubernetes nodejs shell. This is a bit confusing, but that command will not start a webservice process. Instead it will start a Kubernetes container ("pod") using the nodejs image and give you an interactive shell inside of it. That container will have your tool's home directory mounted and changes you make there like running npm will be saved on the NFS server so that other containers run as your tool can mount and use them.
  • Once you have your deployment.yaml and the node code and libraries all setup, you can tell Kubernetes to start the deployment with a command like kubectl create -f deployment.yaml (that may need to be the full path to the deployment.yaml file).
  • When you want to stop the bot, run kubectl delete <name you set in the meta section of deployment.yaml> (probably "enwnbot.bot")

This is all a bit experimental in that we don't have good tutorials written and not many people are using kubectl directly like this as far as I know. Stashbot has been running this way for several months however, so the basic system is known to be stable.

(By the way, if phabricator the correct place to discuss about project request?)

Yes, this is a great place for these kinds of discussions. Once we figure out how to make this work for you we can also add a tutorial of some kind to wikitech so that others can find the answers too.

@Shizhao Because I do not agree to the terms and conditions. Besides, we do not know if that bot shares the logs publicly -- apparently WMF related channels do not allow public logging on public channels even though this is not their server.

chasemp triaged this task as Normal priority.Jul 7 2017, 3:38 PM
bd808 closed this task as Declined.Jul 14 2017, 4:27 PM

This project can be run as a Toolforge project.