elestio/kbin

Verified Publisher

By Elestio

Updated about 1 year ago

Kbin, verified and packaged by Elestio

Image
Databases & Storage
Machine Learning & AI
Security
1

10K+

elest.io

DiscordElestio examplesBlog

KBIN, verified and packaged by Elestio

kbin is an open source reddit-like content aggregator and microblogging platform for the fediverse.

Create and moderate communities, meet people with similar interests, and develop your passions.

kbin

Deploy a fully managed KBIN on elest.io if you want automated backups, reverse proxy with SSL termination, firewall, automated OS & Software updates, and a team of Linux experts and open source enthusiasts to ensure your services are always safe, and functional.

deploy

Why use Elestio images?

  • Elestio stays in sync with updates from the original source and quickly releases new versions of this image through our automated processes.
  • Elestio images provide timely access to the most recent bug fixes and features.
  • Our team performs quality control checks to ensure the products we release meet our high standards.

Usage

Git clone

You can deploy it easily with the following command:

git clone https://github.com/elestio-examples/kbin.git

Copy the .env file from tests folder to the project directory

cp ./tests/.env ./.env

Edit the .env file with your own values.

Create data folders with correct permissions

mkdir -p storage/media storage/caddy_config storage/caddy_data storage/postgres storage/redis storage/rabbitmq
chmod 777 -R storage/media storage/caddy_config storage/caddy_data storage/postgres storage/redis storage/rabbitmq

Run the project with the following command

docker-compose up -d

You can access the Web UI at: http://your-domain:3080

Docker-compose

Here are some example snippets to help you get started creating a container.

version: "3.3"

services:
    www:
        user: 0:0
        image: elestio/kbin:latest
        restart: always
        command: caddy run --config /etc/caddy/Caddyfile --adapter caddyfile
        healthcheck:
            test: ["CMD-SHELL", "curl -f http://localhost:2019/metrics || exit 1"]
        ports:
            - 172.17.0.1:3080:80
        volumes:
            - ./storage/caddy_config:/config
            - ./storage/caddy_data:/data
            - ./storage/media:/var/www/kbin/public/media
        environment:
            - SERVER_NAME=:80 # the addresss that the web server binds
            - PHP_FASTCGI_HOST=php:9000 # caddy forward traffic to this host via fastcgi
            - MERCURE_PUBLISHER_JWT_KEY=${MERCURE_JWT_SECRET}
            - MERCURE_SUBSCRIBER_JWT_KEY=${MERCURE_JWT_SECRET}
            - MERCURE_JWT_SECRET=${MERCURE_JWT_SECRET}
        depends_on:
            - php

    php:
        image: elestio/kbin:latest
        restart: always
        command: php-fpm
        healthcheck:
            test:
                [
                "CMD-SHELL",
                "REQUEST_METHOD=GET SCRIPT_NAME=/ping SCRIPT_FILENAME=/ping cgi-fcgi -bind -connect localhost:9000 || exit 1",
                ]
        volumes:
            - ./storage/media:/var/www/kbin/public/media
        env_file:
            - .env
        depends_on:
            - redis
            - db
            - rabbitmq

    messenger:
        image: elestio/kbin:latest
        restart: always
        command: bin/console messenger:consume async --time-limit=3600
        healthcheck:
            test: ["CMD-SHELL", "ps aux | grep 'messenger[:]consume' || exit 1"]
        env_file:
            - .env
        depends_on:
            - redis
            - db
            - rabbitmq

    messenger_ap:
        image: elestio/kbin:latest
        restart: always
        command: bin/console messenger:consume async_ap --time-limit=3600
        healthcheck:
            test: ["CMD-SHELL", "ps aux | grep 'messenger[:]consume' || exit 1"]
        env_file:
            - .env
        depends_on:
            - redis
            - db
            - rabbitmq

    redis:
        image: redis:alpine
        restart: always
        command: /bin/sh -c "redis-server --requirepass $${REDIS_PASSWORD}"
        environment:
            - REDIS_PASSWORD=${REDIS_PASSWORD}
        volumes:
            - ./storage/redis:/data
        healthcheck:
            test: ["CMD", "redis-cli", "ping"]

    db:
        image: postgres:13-alpine
        restart: always
        volumes:
            - ./storage/postgres:/var/lib/postgresql/data
        environment:
            - POSTGRES_DB=kbin
            - POSTGRES_USER=kbin
            - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}

    rabbitmq:
        image: rabbitmq:3-management-alpine
        restart: always
        environment:
            - RABBITMQ_DEFAULT_USER=kbin
            - RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD}
            - RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}
        volumes:
            - ./storage/rabbitmq:/var/lib/rabbitmq
        ports:
            - 172.17.0.1:15672:15672

    # Add your favorite reverse proxy (e.g nginx) which accept incoming HTTPS
    # traffic and forward to http://www:80
    # nginx:
    #  image: nginx
    #  ports:
    #    - 443:443
    #  volumes:
    #    - ./nginx.conf:/etc/nginx/nginx.conf
Environment variables
VariableValue (example)
ADMIN_PASSWORDnXOmEK1J-Qrzb-I6jD6mbC
ADMIN_EMAILadmin@gmail.com
BASE_URLhttps://your.domain
DOMAINyour.domain
SMTP_HOST172.17.0.1
SMTP_PORT25
SMTP_AUTH_STRATEGYNONE
SMTP_FROM_EMAILsender@mail.com
SERVER_NAMEyour.domain
KBIN_DOMAINyour.domain
KBIN_TITLEkbin
KBIN_DEFAULT_LANGen
KBIN_FEDERATION_ENABLEDtrue
KBIN_CONTACT_EMAILadmin@gmail.com
KBIN_SENDER_EMAILsender@mail.com
KBIN_JS_ENABLEDtrue
KBIN_REGISTRATIONS_ENABLEDtrue
KBIN_API_ITEMS_PER_PAGE25
KBIN_STORAGE_URLhttps://your.domain
KBIN_META_TITLEKbin_Lab
KBIN_META_DESCRIPTIONcontent_aggregator_and_micro-blogging_platform_for_the_fediverse
KBIN_META_KEYWORDSkbin_content_agregator_open_source_fediverse
KBIN_HEADER_LOGOfalse
KBIN_CAPTCHA_ENABLEDfalse
REDIS_PASSWORDnXOmEK1J-Qrzb-I6jD6mbC
REDIS_DNSredis://nXOmEK1J-Qrzb-I6jD6mbC@redis
S3_BUCKETmedia.karab.in
S3_REGIONeu-central-1
S3_VERSIONlatest
APP_ENVprod
APP_SECRET427f5e2940e5b2472c1b44b2d06e0525
POSTGRES_DBkbin
POSTGRES_USERkbin
POSTGRES_PASSWORDnXOmEK1J-Qrzb-I6jD6mbC
POSTGRES_VERSION13
DATABASE_URLpostgresql://kbin:nXOmEK1J-Qrzb-I6jD6mbC@db:5432/kbin?serverVersion=13&charset=utf8
RABBITMQ_PASSWORDnXOmEK1J-Qrzb-I6jD6mbC
MESSENGER_TRANSPORT_DSNamqp://kbin:nXOmEK1J-Qrzb-I6jD6mbC@rabbitmq:5672/%2f/messages
MAILER_DSNsmtp://172.17.0.1:25?encryption=null&auth_mode=null&username=null&password=null&host=172.17.0.1&port=25
MERCURE_URLhttp://www:80/.well-known/mercure
MERCURE_PUBLIC_URLhttps://your.domain/.well-known/mercure
MERCURE_JWT_SECRETnXOmEK1J-Qrzb-I6jD6mbC
CADDY_MERCURE_URLhttps://example.com/.well-known/mercure
CADDY_MERCURE_JWT_SECRETnXOmEK1J-Qrzb-I6jD6mbC
CORS_ALLOW_ORIGIN'^https?://(kbin.localhost|127.0.0.1)(:[0-9]+)?$'
LOCK_DSNflock
JWT_SECRET_KEY%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY%kernel.project_dir%/config/jwt/public.pem
HTTPStrue

Maintenance

Logging

The Elestio KBIN Docker image sends the container logs to stdout. To view the logs, you can use the following command:

docker-compose logs -f

To stop the stack you can use the following command:

docker-compose down

Backup and Restore with Docker Compose

To make backup and restore operations easier, we are using folder volume mounts. You can simply stop your stack with docker-compose down, then backup all the files and subfolders in the folder near the docker-compose.yml file.

Creating a ZIP Archive For example, if you want to create a ZIP archive, navigate to the folder where you have your docker-compose.yml file and use this command:

zip -r myarchive.zip .

Restoring from ZIP Archive To restore from a ZIP archive, unzip the archive into the original folder using the following command:

unzip myarchive.zip -d /path/to/original/folder

Starting Your Stack Once your backup is complete, you can start your stack again with the following command:

docker-compose up -d

That's it! With these simple steps, you can easily backup and restore your data volumes using Docker Compose.

Links

Docker Pull Command

docker pull elestio/kbin