New kegbot-server beta available for testing

Hi everyone!

I’ve been inspired by all the ways y’all have kept this community going. Finding myself with a bit of extra time on my hands thanks to quarantine, I’ve been working on a new kegbot-server release — the first release in over 5 years!

What’s new

Before you get too excited, this is mostly an “under the hood” release: I’ve pulled in some bugfixes and small features, but the biggest new feature is the codebase: Its major dependencies have been updated to the latest versions, so it should be both easier to build and moreover easier for others to extend from here.

The other big change is that configuration and setup have been simplified to make it easier to run the server on a platform like heroku or in any docker environment. In fact, docker builds are now built automatically. Pre-built docker images for Rapsberry Pi are included too.

You can see a partial changelog here.

How to test

Important: Be sure to manually back up all of your data first. I recommend you try this with a separate/fresh setup rather than anything important.

These instructions assume you have some familiarity with Docker and docker-compose.

Instructions

First, copy and save this file as docker-compose.yml:

version: '3'

services:
  kegbot:
    image: kegbot/server:latest-arm
    ports:
      - "8000:8000"
    volumes:
      - kegbot-data:/kegbot-data
    environment:
      KEGBOT_REDIS_URL: "redis://redis:6379/0"
      KEGBOT_DATABASE_URL: "mysql://kegbot_dev:changeme@mysql/kegbot_dev"
      KEGBOT_SETUP_ENABLED: "true"
      KEGBOT_DEBUG: "true"

  workers:
    image: kegbot/server:latest-arm
    command: bin/kegbot run_workers
    volumes:
      - kegbot-data:/kegbot-data
    environment:
      KEGBOT_REDIS_URL: "redis://redis:6379/0"
      KEGBOT_DATABASE_URL: "mysql://kegbot_dev:changeme@mysql/kegbot_dev"
      KEGBOT_SETUP_ENABLED: "true"
      KEGBOT_DEBUG: "true"

Now, start the services:

$ docker-compose up

Visit http://localhost:8000 . It may take a minute for the page to become available. If you see an error, wait a little and try again.

You should be greeted by the Kegbot setup wizard. Walk through to create a new server.

What to test

Generally, explore and look for bugs, there are probably quite a few. If you find something broken, you can reply here or file it on github if you’re confident it’s a bug.

I’ll keep this post updated with the latest instructions and known issues. Thanks!

2 Likes

Awesome Mike, thanks for kegbot and thanks for keeping the hosting etc alive for us enthusiasts!

This is fantastic and I can’t wait to try it out and I’ll move a lot of my features over into the “main” channel via PRs over the next few weeks as I get some free time.

I’m going to test and test and test but maybe an easy answer from @mike, does this work with the pyutils/pycore stuff? My current setup is 100% via the Pi with the Arduino plugged in and full management, user authentication, live pour tracking, etc is done through the web interface. I assume this should all work fine with the Arduino stuff running as legacy, but the new server itself running in the container? Or is there some awesome magic you’ve already put into the container build that handles Arduino communication via RPi USB?

I assume this should all work fine with the Arduino stuff running as legacy, but the new server itself running in the container?

Yep, that’s right! It should work just like the server part, but you can run pycore anywhere else.

Or is there some awesome magic you’ve already put into the container build that handles Arduino communication via RPi USB?

Nope, though that would be cool. Maybe some day…!

1 Like

There is also an experimental “one click deploy” to Heroku. Check it out here: https://github.com/Kegbot/kegbot-heroku

So I’ve done some initial testing on a Raspberry Pi 4 and ran into a couple issues, mainly around the availability of mysql for the 32-bit ARM architecture of the Raspbian image. Good news is that these are resolve with just a couple steps so those wishing to run this new Beta version on RPi should be able to run it without issue.

I have not yet tried to install one of the available 64-bit OS for Raspberry Pi, but I may get around to trying that to see what effect that has.

Slightly Modified Docker-Compose File

services:
  kegbot:
    image: kegbot/server:latest-arm
    ports:
      - "8000:8000"
    volumes:
      - kegbot-data:/kegbot-data
    environment:
      KEGBOT_REDIS_URL: redis://redis:6379/0
      KEGBOT_DATABASE_URL: mysql://kegbot_dev:changeme@mysql/kegbot_dev
      KEGBOT_SETUP_ENABLED: "true"
      KEGBOT_DEBUG: "true"

  workers:
    image: kegbot/server:latest-arm
    command: bin/kegbot run_workers
    volumes:
      - kegbot-data:/kegbot-data
    environment:
      KEGBOT_REDIS_URL: redis://redis:6379/0
      KEGBOT_DATABASE_URL: mysql://kegbot_dev:changeme@mysql/kegbot_dev
      KEGBOT_SETUP_ENABLED: "true"
      KEGBOT_DEBUG: "true"

  mysql:
    image: linuxserver/mariadb:latest
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: 'changeme'
      MYSQL_USER: 'kegbot_dev'
      MYSQL_PASSWORD: 'changeme'
      MYSQL_DATABASE: 'kegbot_dev'
    volumes:
      - mysql-data:/var/lib/mysql

  redis:
    image: redis:latest
    restart: always

volumes:
  mysql-data:
  kegbot-data:

I’ve updated with a specific image tag for arm that @mike already pre-compiled for RPi (awesome!!)

The next change was to use the linuxserver/mariadb image instead of mysql since mysql does not have a docker image that supports Raspbian. If you try to run the original docker-compose file you get an error trying to acquire that image.

Finally, once you’ve started everything with docker-compose up -d (I like running the services in the background with the -d switch), run the command docker ps to find the container ID for the MariaDB container. Then, execute the following command, replacing [container id] with your MariaDB Container ID.

docker exec [container id] mysql -uroot -p[your_sql_root_password] -e "set global innodb_file_format=Barracuda; set global innodb_default_row_format=DYNAMIC; set global innodb_large_prefix=ON;"

For example if you leave the default sql password in the docker-compose file, you would run something like this:

docker exec 513d1282322c mysql -uroot -pchangeme -e "set global innodb_file_format=Barracuda; set global innodb_default_row_format=DYNAMIC; set global innodb_large_prefix=ON;"

Now you’re ready to run the server at [Address Of Your Pi]:8000. This should kick you to the Setup screen where you can successfully install the Database.

FYI, if you were to run the setup without that mysql command, you get a screen like below:

1 Like

Great fixes, thanks @johnnyruz! I’ve updated the post at the top, will work with you on automating this through the kegberry script.

Update: I’ve got those mysql changes incorporated into the new installer script.

This ought to do the trick for an easy first-time install:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/kegbot/kegberry/master/install.sh)"

Flawless install! Now to test some of the Pycore stuff this weekend!

1 Like

@mike - thanks for posting this script. I was struggling with some of the other methods and this one did the trick with no issues. Loving my new kegbot setup!

The only issue I’ve run into is a complete inability to disable DEBUG mode. I’ve changed from true to false in the config line (KEGBOT_DEBUG: ‘false’) below in the docker-compose.yml file, but it has no effect. The good news is I can’t really see any ill effects from this, so I don’t think it’s a big deal, but I wanted to let you know in case you can track down why it’s doing it.

Thanks for the script!

Hi,

I’m super happy with the new docker deployment but can’t figure out how to setup email notifications, preferably via gmail. I tried to add some environment variables to the kegbot: service in docker-compose.yml but this doesn’t look to be working (code below). I still have old instance with all the settings in local_settings.py but now I would like to move for good to the docker instance. Has anyone managed to set this up?

EMAIL_BACKEND: 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST: 'smtp.gmail.com'
EMAIL_PORT: '587'
EMAIL_USE_SSL: 'False'
EMAIL_USE_TLS: 'True'
EMAIL_HOST_USER: '*****@gmail.com'
EMAIL_HOST_PASSWORD: '**********'
EMAIL_FROM_ADDRESS: '[email protected]'

Thanks
Raf

I’ve gone down the rabbit hole of docker and have gotten to the point of giving up. I am using a RPi 3 A+ (buster lite)

edit: I think the RPi I am using just lacks the grunt to run containers. I may move to a VM and repurpose the RPi if I can’t get it running with the scripts.

Well after banging my head against the wall for hours last night, I just spun up a digital ocean droplet and am up and running in 10 minutes. what a relief

I have email working in docker. Unfortunately the feature is not yet released to the production docker image on docker-hub, but you could build your own docker image from the master code base.

git clone github.com/kegbot/kegbot-server.git
cd kegbot-server

Then add the KEGBOT_EMAIL_FROM_ADDRESS and KEGBOT_EMAIL_URL environment variables to your docker-compose.yml as described on kegbot-server/settings.rst at master · Kegbot/kegbot-server · GitHub

For example my docker-compose.yml has these two extra environment variables defined in it:

KEGBOT_EMAIL_URL: "submission://kegbot%40e2r4.com:<password>@smtp.gmail.com"
KEGBOT_EMAIL_FROM_ADDRESS: "[email protected]"

A couple notes about the user and password:

  • I had to use an application specific password from google’s myaccount security settings so that gmail would accept it.
  • Make sure to URI encode the @ symbol in your username as %40.

I had to also change the docker-compose file to build directly from the local directory instead of pulling the official released version from docker-hub by commenting out the image and adding build:

#image: kegbot/server:latest
build: .

Then it’s just two steps to build and up it:

docker-compose build
docker-compose up
1 Like

Is there a way to do an in place upgrade from 1.2.3? I’m running that on Linux with a few tweaks from Johnny FWIW… I tried to do the usual upgrade process, after a backup of course, but it told me I was already on the most current version. Figured I’d ask… :slight_smile:

Thanks,
Jeff

Good to see Kegbot is being redone.

I have been an avid fan of this kegbot for many years… installed first 2014 … and come up against many issues. Great that this hasnt died and that Mike and Johnny have given it new life again as well as many other contributors. Would love to help in its resurrection in whatever way I can by the way I am giving the new install a hard time in testing… works very well… a couple of bugs issues but doesnt crash. Thanks to all involved

1 Like

Not sure if anyone else has attempted this, but I get an error during the build phase. FYI

Hello,

so Docker is always needed before installing Kegbot. Is there a release without needing docker so i can install Kegbot server on my Nexus 7 tablet?

Regards,
Patrick

@johnnyruz Hi John. I am stuck at this step with a read only error when attempting to run the docker exec command. When I attempt to run kegbot setup, i get the error logs you have noted here. thoughts?

image

Couple of questions:

Where is the email config stored, might be easier to update config files directly in the container rather than pass the variables in the docker config file?

I can’t work out where backups are supposed to go, if I create an export through the GUI nothing happens. If it is in the kegbot data directory there is no backup folder created, do we need to update perms on the data directory?

Cheers,

Nick

At long last, we’ve just cut a new release that should resolve some of the issues above. As the install instructions have changed a bit, closing this thread - let’s continue over there: