To get a Yetibot running you need:
- Some config
- A Postgres database
- A way to run it (i.e.
docker
orlein
)
Docker Compose satisfies these requirements very quickly. Run from the root of this repo:
docker-compose up
This starts up a Postgres container and a Yetibot container, configured to
connect to IRC as user name yetibot_demo
. Once it's up check out
http://localhost:3456 to view the dashboard.
See the docker-compose.yml file to look at exactly how these containers are configured. This demonstrates a very minimal default config that you can modify. For example, you could use Slack instead by switching to a config like:
environment:
- YB_ADAPTERS_SLACK_TYPE=slack
- YB_ADAPTERS_SLACK_TOKEN=xoxb-my-token
- YB_DB_URL=postgresql://yetibot:yetibot@postgres:5432/yetibot
A very minimal config would be:
{:yetibot
{:adapters {:freenode {:type "irc",
:username "my-yetibot",
:host "chat.freenode.net",
:port "7070",
:ssl "true"}}}}
This instructs Yetibot to join freenode with the username my-yetibot
(change
it to whatever you like).
If you don't configure a Postgres database, it defaults to:
postgresql://localhost:5432/yetibot
It expects the database to already exist, but any tables will be created idempotently on startup. To override the default connection string along with the above config, it'd look like:
{:yetibot
{:adapters {:freenode {:type "irc",
:username "my-yetibot",
:host "chat.freenode.net",
:port "7070",
:ssl "true"}}
:db {:url "postgresql://user:pass@mydb:5432/yetibot"}}}
For full config see the CONFIGURATION docs.
There are many ways to install Postgres. Here we demonstrate two common approaches:
As usual, Docker makes things easier when it comes to infra:
docker run -d -p 5432:5432 --name postgres \
--restart="always" \
-v /pgdata:/var/lib/postgresql/data \
-e POSTGRES_USER="yetibot" \
-e POSTGRES_PASSWORD="yetibot" \
-e POSTGRES_DB="yetibot" \
postgres:latest
docker logs -f postgres
# to remove postgres docker container
docker rm -f postgres
Assuming you use a Docker link from another container to this container, the connection string is then:
postgresql://yetibot:yetibot@postgres:5432/yetibot
As an example of Docker linking, you could use psql
from another container
like:
docker run --rm -it --link postgres postgres bash
psql -h postgres -U yetibot
\l
\q
exit
Much of this is borrowed from DigitalOcean's docs:
sudo apt-get update
sudo apt-get install -y postgresql postgresql-contrib
sudo -u postgres psql
createdb yetibot
There are a few ways to quickly run a Yetibot:
- Docker - read the Yetibot on Docker docs
- Grab an archive of the source from the Yetibot
releases, unzip, put the config
in place and
lein run
- Clone the source of this repo, put the config in place and
lein run
As an example, here's how you could get the latest code from master
, extract,
put config in place, and run it (assumes you already have
Leiningen installed):
cd /tmp
curl https://codeload.github.com/yetibot/yetibot/tar.gz/master | tar xvz
cd yetibot-master
cat << EOF > config.edn
{:yetibot
{:adapters
{:freenode
{:type "irc"
:username "my-yetibot"
:host "chat.freenode.net"
:port "7070"
:ssl "true"}}}}
EOF
YB_LOG_LEVEL=debug CONFIG_PATH=config.edn lein run
Once it starts up you'll see a log like:
17-05-28 23:27:56 deep.local INFO [yetibot.core.loader:41] - ☑ Loaded 84 namespaces matching [#"^yetibot\.(core\.)?commands.*" #"^.*plugins\.commands.*"]
At this point it should be connected to Freenode. Trying running a command against it:
/msg my-yetibot !echo Hello, Yetibot!
And you should get a reply:
my-yetibot: Hello, Yetibot!
NB: Soon there will be a way to run a Yetibot with zero config in local REPL mode ⚡ #628 ⚡
If these docs don't work for you please open an issue!
You can also try setting an env var YB_LOG_LEVEL=debug
when running.