Refactor: add/remove services, general refactoring

This commit is contained in:
Michele Bologna
2024-11-23 13:43:15 +01:00
parent 8eecc2bb3f
commit afac4af31f
19 changed files with 510 additions and 498 deletions

126
README.md
View File

@@ -1,62 +1,100 @@
# 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 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
* In addition to the [Bitlbee's out of the box supported protocols](https://wiki.bitlbee.org/), this container also supports the following protocols:
- Skype via [skype4pidgin](https://github.com/EionRobb/skype4pidgin)
- Telegram via [tdlib-purple](https://github.com/ars3niy/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. In addition to the [Bitlbee's out of the box supported protocols](https://wiki.bitlbee.org/), these are the pre-installed plugins:
- Google Hangouts via [purple-hangouts](https://github.com/EionRobb/purple-hangouts)
- Mastodon via [bitlbee-mastodon](https://alexschroeder.ch/software/Bitlbee_Mastodon)
- Rocket.Chat via [purple-rocketchat](https://github.com/EionRobb/purple-rocketchat)
- Discord via [bitlbee-discord](https://github.com/sm00th/bitlbee-discord/)
- Slack via [slack-libpurple](https://github.com/dylex/slack-libpurple)
- Steam via [bitlbee-steam](https://github.com/bitlbee/bitlbee-steam)
- Discord via [purple-discord](https://github.com/EionRobb/purple-discord)
- Matrix via [purple-matrix](https://github.com/matrix-org/purple-matrix)
- Mattermost via [puple-mattermost](https://github.com/EionRobb/purple-mattermost)
- Instagram via [purple-instagram](https://github.com/EionRobb/purple-instagram)
- Microsoft Teams via [teams](https://github.com/EionRobb/purple-teams)
- 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.
* The `docker-compose.yml` provided in this repository enables bitlbee to be TLS terminated via [stunnel](https://www.stunnel.org/).
## Quick Start
## Usage
### Running Locally with Podman or Docker Compose
1. Clone the project:
1. Clone this repository:
```bash
git clone https://github.com/mbologna/docker-bitlbee.git
cd docker-bitlbee
% git clone https://www.github.com/mbologna/docker-bitlbee
2. Build and run the containers:
2. (Optional) Customize bitlbee configuration file in `etc/bitlbee/bitlbee.conf`
```
podman-compose up --build
```
3. Start `bitlbee` either via:
If you're using Docker:
```
docker-compose up --build
```
* [Docker Compose](https://docs.docker.com/compose/install/) (recommended):
3. Access the Bitlbee service on port 6667 and the Stunnel service on port 16697.
```
% docker-compose up
```
#### Environment Variables
* Docker:
`UID` and `GID`: Set these to match your local user for proper volume permissions.
```
% docker volume create bitlbee_data
% docker run -d --name bitlbee \
--restart=always \
-p 16667:6667 \
-v $PWD/etc/bitlbee:/usr/local/etc/bitlbee \
mbologna/docker-bitlbee
% docker run -d --name bitlbee-stunnel \
--restart=always \
--link bitlbee:bitlbee
-e STUNNEL_SERVICE=bitlbee-stunnel \
-e STUNNEL_ACCEPT=6697 \
-e STUNNEL_CONNECT=bitlbee:6667 \
-p 16697:6697 \
dweomer/stunnel
```
#### Persistent Data
4. Connect your IRC client either to:
The `data/` directory is mounted as a volume to store Bitlbee configurations and data. Ensure it is backed up for persistent setups.
* localhost:16697 (TLS terminated) (recommended)
* localhost:16667 (non-TLS, plain connection)
### Kubernetes Deployment
## Building
Kubernetes manifests for deploying Bitlbee and Stunnel are located in the `k8s/` directory.
You can build a `bitlbee` image from Dockerfile: `docker build -t="mbologna/docker-bitlbee" github.com/mbologna/docker-bitlbee`
1. Apply the manifests:
```
kubectl apply -f k8s/
```
Verify deployment:
```
kubectl get pods -n bitlbee
```
Expose the service as needed (e.g., via `NodePort` or `Ingress`).
## CI/CD Workflow
This repository uses GitHub Actions for automated builds and deployments:
* 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`
* Linting: Integrated linters for Dockerfile, shell scripts, and Kubernetes resources.
* Security Scans: Uses Trivy to scan Docker images for vulnerabilities.
## Local Development
### Building Multi-Arch Images Locally
For multi-architecture builds with Podman:
```
podman build --platform linux/amd64,linux/arm64 -t mbologna/docker-bitlbee:latest .
```
Or with Docker:
```
docker buildx build --platform linux/amd64,linux/arm64 -t mbologna/docker-bitlbee:latest --push .
```
## Resources
[BitlBee Documentation](https://wiki.bitlbee.org/)