Clone
1
Installation via Docker Engine
Stefano Pigozzi edited this page 2022-06-06 07:52:53 +02:00

This installation procedure assumes you are on a system with docker installed, with a supported CPU architecture.

Requirements

Steps

  1. Run a container using the project's Docker image:

    # docker run --volume "$(pwd)/config:/etc/greed" --volume "$(pwd)/strings:/usr/src/greed/strings" --volume "$(pwd)/data:/var/lib/greed" ghcr.io/steffo99/greed
    
  2. Edit the configuration file config.toml that was created in the strings directory, adding your bot and payment tokens to it:

    # nano config/config.toml
    

    (Press Ctrl+X and then two times Enter to save and quit nano.)

  3. Optional: customize the files in the strings folder for custom messages.

  4. Start the bot:

    python -OO core.py
    
  5. Open Telegram, and send a /start command to your bot to be automatically promoted to 💼 Manager.

  6. Stop the bot by pressing Ctrl+C.

Running the bot

After the installation, to run the bot, you'll need to:

  1. Run its Docker container from the same directory you installed it from:
    # docker run --volume "$(pwd)/config:/etc/greed" --volume "$(pwd)/strings:/usr/src/greed/strings" --volume "$(pwd)/data:/var/lib/greed" ghcr.io/steffo99/greed
    

Keep the bot running

If you want to keep the bot open even after you closed your terminal window, you'll need to pass the appropriate arguments to the docker command:

  1. Set the Docker container to always restart and to detach on successful start:
    # docker run --detach --restart always --volume "$(pwd)/config:/etc/greed" --volume "$(pwd)/strings:/usr/src/greed/strings" --volume "$(pwd)/data:/var/lib/greed" ghcr.io/steffo99/greed
    

Updating

To update the bot, run the following commands:

  1. Find the ID of the Docker container of the bot:

    # docker container ls
    CONTAINER ID   IMAGE                    COMMAND                CREATED         STATUS                  PORTS     NAMES
    abcdefabcdef   ghcr.io/steffo99/greed   "python -OO core.py"   6 seconds ago   Up Less than a second             relaxed_hypatia
    
  2. Stop the Docker container of the bot:

    # docker container stop abcdefabcdef
    
  3. Remove the Docker container of the bot:

    # docker container rm abcdefabcdef
    
  4. Pull the latest Docker image of the bot:

    # docker pull ghcr.io/steffo99/greed:latest
    
  5. Restart the bot with the newly downloaded image:

    # docker run --detach --restart always --volume "$(pwd)/config:/etc/greed" --volume "$(pwd)/strings:/usr/src/greed/strings" --volume "$(pwd)/data:/var/lib/greed" ghcr.io/steffo99/greed