-
Notifications
You must be signed in to change notification settings - Fork 0
Build and Run
Bill Howe edited this page Mar 4, 2022
·
2 revisions
Before building the JAR or running the docker container:
- Create a Telegram bot using the botfather.
- Configure the bot to give it access to group chat messages. (group privacy disabled)
Proceed with either the Docker or Jar instructions.
- Setup the volume for saving the search state
# Docker volume name (docker volume ls)
DOCKER_VOL=lemme-know-bot
docker volume create ${DOCKER_VOL}
# Container path for the search state (matches the Dockerfile)
CONTAINER_SAVE_DIR=/usr/src/app/state- Run the container
docker run \
--detach \
--name lemme-know-bot \
--env BOT_TOKEN="MY-TOKEN-HERE" \
--env LKB_SEARCHES=${CONTAINER_SAVE_DIR}/lemme-know-bot-searches.edn \
--volume ${DOCKER_VOL}:${CONTAINER_SAVE_DIR} \
wdhowe/lemme-know-botSystemd service file example (/etc/systemd/system/lemme-know-bot.service)
[Unit]
Description=Lemme Know Bot
Requires=docker.service
After=docker.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/root/scripts/lemme-know-bot-start.sh
ExecStop=/root/scripts/lemme-know-bot-stop.sh
[Install]
WantedBy=multi-user.targetStart script
#!/bin/bash
docker start $(docker ps -a | grep lemme-know-bot | cut -d" " -f 1)Stop script
#!/bin/bash
docker stop $(docker ps | grep lemme-know-bot | cut -d" " -f 1)Follow the logs
docker logs --follow $(docker ps | grep lemme | cut -d" " -f 1)Pre-reqs for building the Java Jar.
- Install leiningen.
- Clone this project.
- Build the jar
lein uberjar- Make your bot token available in the environment
- Other env vars should be exported at this step if you would like to change any default settings.
- See Configuration for details.
export BOT_TOKEN="MY-TOKEN-HERE"- Start the service
java -jar lemme-know-bot-VERSION-standalone.jarOnce the service is running from one of the above methods:
- Add your bot to a Telegram group chat.
- Start chatting with your bot in the Telegram group chat.
- Send '/help' to get started.