Skip to content

Deployment

Jared Dantis edited this page Sep 12, 2023 · 4 revisions

If you're deploying Blanco on a reasonably capable x86_64 or ARM64 host, you may want to do so using the Docker image. Otherwise, you can deploy Blanco straight from the source code.

With Docker

Blanco comes in a Docker image, so you do not have to install anything aside from Docker. All of the dependencies are included in the Docker image, which has been tested on Linux hosts using Docker CE, and on Windows and macOS hosts using Docker Desktop.

Aside from linux/amd64, the bot image is also built with linux/arm64/v8 support, so you can run the bot on a Raspberry Pi 3B+ or a Mac with Apple silicon with reasonable performance. linux/armv7 images are no longer available starting with Release 0.4.0, but you are welcome to deploy Blanco without Docker if you need to run him on a Raspberry Pi 2 or older.

Make sure you followed Prerequisites, then create a docker-compose.yml file in the same folder with the following contents:

version: '3.8'
services:
  blanco:
    container_name: blanco-bot
    restart: unless-stopped
    image: jareddantis/blanco-bot
    # OR image: ghcr.io/jareddantis-bots/blanco-bot

    environment:
      - BLANCO_DB_FILE=/opt/app/blanco.db
      - BLANCO_TOKEN=<your Discord bot token>
      - BLANCO_SPOTIFY_ID=<your Spotify client ID>
      - BLANCO_SPOTIFY_SECRET=<your Spotify client secret>
      # - BLANCO_DEBUG=true
      # - BLANCO_DEBUG_GUILDS=<your guild ID>
      - BLANCO_NODE_1=main:youshallnotpass@localhost:2333
      - BLANCO_NODE_1_REGIONS=us-central,us-east
      - BLANCO_NODE_1_SECURE=false
      - BLANCO_NODE_1_DEEZER=false
      # - BLANCO_NODE_2=...
    
    volumes:
      - /YOUR/PATH/HERE/blanco.db:/opt/app/blanco.db

      # You can omit this if you're using env variables
      - /YOUR/PATH/HERE/config.yml:/opt/app/config.yml
    
    # You can omit this if you're not using the webserver
    ports:
      - 8080:8080

Edit /YOUR/PATH/HERE/config.yml and /YOUR/PATH/HERE/blanco.db to match the paths to your config.yml and blanco.db.

If you're using Portainer, you can create a Stack with the above specifications instead of using a docker-compose.yml file. If not, open up a terminal in the same folder as docker-compose.yml and run

docker compose up -d

This will cause the bot to run in the background after the container is built. Omit the -d if you want it to run in the foreground, printing logs to the terminal as they come. If you get an error regarding the compose command or the docker-compose.yml file, you might be running an old version of Docker - please update before trying again.

In case there is an update to the bot, just stop the container using

docker compose stop

then pull the latest bot image using

docker compose rm -f
docker compose pull blanco-bot

and start the container again using

docker compose up -d

or use Watchtower to keep Blanco updated automatically.

Without Docker

If you want to deploy Blanco without Docker, make sure you have Python 3.11+ installed. Then:

  1. Download the source code ZIP from the latest release.
  2. Unpack it into an empty directory.
  3. Open a terminal inside that directory and create a virtual environment:
    # Change python3 to whatever your Python 3 binary is called
    python3 -m venv .venv
  4. Activate the virtual environment:
    # Windows cmd
    .\.venv\Scripts\Activate.bat
    
    # Linux, macOS, etc.
    source .venv/bin/activate
    
  5. Install Blanco's requirements using python3 -m pip install -r requirements.txt.
  6. Configure Blanco according to the instructions in Prerequisites.
  7. If using the webserver, generate server/static/css/main.css by installing Tailwind CLI and running
    tailwindcss -i ./server/static/css/base.css -o ./server/static/css/main.css --minify
    
  8. Run Blanco using python3 main.py.
Clone this wiki locally