Skip to content

Commit

Permalink
Fix everything
Browse files Browse the repository at this point in the history
  • Loading branch information
mbologna committed Nov 28, 2024
1 parent 18d922c commit f5c7eab
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 137 deletions.
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ LABEL org.opencontainers.image.title="BitlBee container" \
org.opencontainers.image.url="https://github.com/mbologna/docker-bitlbee" \
org.opencontainers.image.licenses="MIT"

ENV BITLBEE_VERSION "3.6"
ENV SKYPE4PIDGIN_VERSION "1.7"
ENV FACEBOOK_VERSION "1.2.2"
ENV BITLBEE_VERSION="3.6" SKYPE4PIDGIN_VERSION="1.7" FACEBOOK_VERSION="1.2.2"

WORKDIR "/"
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \

Check failure on line 11 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
Expand Down Expand Up @@ -68,7 +66,8 @@ RUN ./build_and_install.sh
WORKDIR /
RUN libtool --finish /usr/local/lib/bitlbee

RUN rm -fr ./purple* && \
RUN rm -fr ./bitlbee-"$BITLBEE_VERSION" && \
rm -fr ./purple* && \
rm -fr ./slack-libpurple && \
rm -fr ./skype4pidgin* && \
rm -fr ./bitlbee-facebook* && \
Expand Down
184 changes: 51 additions & 133 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,182 +1,100 @@
# Docker BitlBee
# BitlBee with additional plugins in a container

![Docker](https://img.shields.io/docker/pulls/mbologna/docker-bitlbee)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/mbologna/docker-bitlbee/build-scan-push.yml?branch=master)

This repository provides a containerized version of [BitlBee](https://www.bitlbee.org/), an IRC gateway for instant messaging services, along with additional plugins for extended functionality (e.g., Skype, Facebook, Discord, Mastodon, and more).
The image is built for both amd64 and arm64 platforms.
This repository provides a Docker-based setup for running [Bitlbee](https://www.bitlbee.org/) with additional plugins for extended functionality and an optional [Stunnel](https://www.stunnel.org/) service to enable secure IRC communications over TLS.

## Features

- **BitlBee Version**: `3.6`
- Pre-installed plugins:
- Skype via [skype4pidgin](https://github.com/EionRobb/skype4pidgin)
- Telegram via [tdlib-purple](https://github.com/BenWiederhake/tdlib-purple)
- Facebook (MQTT) via [bitlbee-facebook](https://github.com/bitlbee/bitlbee-facebook)
- **[Bitlbee](https://www.bitlbee.org)**: A popular gateway that connects instant messaging services with IRC. Pre-installed plugins:
- Google Hangouts via [purple-hangouts](https://github.com/EionRobb/purple-hangouts)
- Mastodon via [bitlbee-mastodon](https://alexschroeder.ch/software/Bitlbee_Mastodon)
- Discord via [purple-discord](https://github.com/EionRobb/purple-discord)
- Slack via [slack-libpurple](https://github.com/dylex/slack-libpurple)
- Matrix via [purple-matrix](https://github.com/matrix-org/purple-matrix)
- Microsoft Teams via [teams](https://github.com/EionRobb/purple-teams)
- Secured IRC communication with optional TLS using **stunnel**.
- Customizable and persistent storage.
- Lightweight and production-ready container.

---

## Getting Started (Docker and docker compose)

Follow these instructions to set up and run the BitlBee container.

### Prerequisites

- [Docker](https://www.docker.com/get-started) installed on your system.
- [Docker Compose](https://docs.docker.com/compose/) (optional for multi-container setup).

---

### Installation

#### Clone the Repository

```bash
git clone https://github.com/mbologna/docker-bitlbee.git
cd docker-bitlbee
```

#### Build and Run with Docker Compose

Build the image:

```
docker compose build
```

Run the containers:

```
docker compose up -d
```

Check the container logs:

```
docker logs -f bitlbee
```

### Configuration
#### Volumes

The container uses /var/lib/bitlbee to store persistent data, including user configuration files. Mount a local directory to this volume to retain data:

```
volumes:
- ./data:/var/lib/bitlbee
```

#### Ports
- Slack via [slack-libpurple](https://github.com/dylex/slack-libpurple)
- Skype via [skype4pidgin](https://github.com/EionRobb/skype4pidgin)
- Facebook (MQTT) via [bitlbee-facebook](https://github.com/bitlbee/bitlbee-facebook)
- Mastodon via [bitlbee-mastodon](https://alexschroeder.ch/software/Bitlbee_Mastodon)
- Telegram via [tdlib-purple](https://github.com/BenWiederhake/
- **[Stunnel](https://www.stunnel.org/)**: Adds TLS encryption for secure IRC connections.
- Multi-architecture support: builds for `linux/amd64` and `linux/arm64`.
- Kubernetes resources included for deployment in containerized environments.
- Linting and security scans integrated into CI/CD workflows.

* 6667: Standard IRC port for BitlBee.
* 6697: Secure IRC port (`stunnel`).
## Quick Start

You can change these ports in `docker-compose.yml` if needed.
### Running Locally with Podman or Docker Compose

### Usage
1. Clone this repository:
```bash
git clone https://github.com/mbologna/docker-bitlbee.git
cd docker-bitlbee

* Connect to the BitlBee server using any IRC client (e.g., HexChat, mIRC):
Server: localhost
Port: 6667 or 6697 (TLS)
* Add IM accounts by typing commands in the IRC client. Example for adding a Google account:
2. Build and run the containers:

```
account add jabber [email protected]
podman-compose up --build
```

Refer to the BitlBee User Guide for detailed instructions.

## Getting Started (Kubernetes version)
This repository provides Kubernetes manifests to deploy **BitlBee** with **Stunnel**. The setup ensures a secure communication channel by using Stunnel as a TLS wrapper for BitlBee.

### Architecture

The system consists of two components:
If you're using Docker:
```
docker-compose up --build
```
1. **BitlBee**:
- IRC gateway for IM services.
- Exposes port `6667` for internal communication.
- Uses a PersistentVolumeClaim for data persistence.
3. Access the Bitlbee service on port 6667 and the Stunnel service on port 16697.
2. **Stunnel**:
- Provides TLS encryption for BitlBee communication.
- Listens on port `6697` and forwards traffic to BitlBee's port `6667`.
#### Environment Variables
---
`UID` and `GID`: Set these to match your local user for proper volume permissions.
### Prerequisites
#### Persistent Data
1. A Kubernetes cluster (minikube, kind, or a cloud provider).
2. `kubectl` CLI tool installed and configured.
3. A storage class available for the PersistentVolumeClaim (PVC).
The `data/` directory is mounted as a volume to store Bitlbee configurations and data. Ensure it is backed up for persistent setups.
### Configuration
### Kubernetes Deployment
#### Environment Variables for Stunnel
Kubernetes manifests for deploying Bitlbee and Stunnel are located in the `k8s/` directory.
The Stunnel pod uses a ConfigMap to define key environment variables:
1. Apply the manifests:
```
STUNNEL_SERVICE: Name of the Stunnel service.
STUNNEL_ACCEPT: Port Stunnel listens on (6697).
STUNNEL_CONNECT: Target BitlBee service and port (bitlbee:6667).
kubectl apply -f k8s/
```
#### Storage
Verify deployment:
```
kubectl get pods -n bitlbee
```
Expose the service as needed (e.g., via `NodePort` or `Ingress`).
BitlBee data is persisted using a PVC:
## CI/CD Workflow
Default size: 1Gi
Modify the PersistentVolumeClaim if more storage is required.
This repository uses GitHub Actions for automated builds and deployments:
### Deployment
* Build and Push: Docker images are built for amd64 and arm64 platforms and pushed to:
- Docker Hub: `mbologna/docker-bitlbee:latest`
- GitHub Container Registry: `ghcr.io/mbologna/docker-bitlbee:latest`
#### Step 1: Apply the Namespace
* Linting: Integrated linters for Dockerfile, shell scripts, and Kubernetes resources.
* Security Scans: Uses Trivy to scan Docker images for vulnerabilities.
```bash
kubectl apply -f k8s/bitlbee-namespace.yml
```
## Local Development
#### Step 2: Deploy the ConfigMap

```
kubectl apply -f k8s/bitlbee-stunnel-configmap.yml
```
### Building Multi-Arch Images Locally
#### Step 3: Deploy BitlBee and Stunnel
For multi-architecture builds with Podman:
```
kubectl apply -f k8s/bitlbee-deployment.yml
kubectl apply -f k8s/bitlbee-stunnel-deployment.yml
podman build --platform linux/amd64,linux/arm64 -t mbologna/docker-bitlbee:latest .
```
#### Step 3: Create the PersistentVolumeClaim
Or with Docker:
```
kubectl apply -f k8s/bitlbee-pvc.yml
docker buildx build --platform linux/amd64,linux/arm64 -t mbologna/docker-bitlbee:latest --push .
```
#### Step 4: Apply Services

```
kubectl apply -f k8s/bitlbee-service.yml
kubectl apply -f k8s/bitlbee-stunnel-service.yml
```

#### Accessing the Services (ClusterIP)

* BitlBee: Internally available on port 6667 within the cluster.
* Stunnel: Internally available on port 6697 within the cluster.

## Resources
[BitlBee Documentation](https://wiki.bitlbee.org/)

0 comments on commit f5c7eab

Please sign in to comment.