Demijohn with mead, glass with mead and a Raspberry Pi i in a case.

This is my web log

Technology: Raspberry Pi, Git and web development.

Mead: Recipes and reviews.

Beer: Short reviews of both bad and good beer.

And more..

Belgian Abbey mead

01 Maj 2021 / OscFr
Belgian Abbey Mead fermenting in a demijohn.

Required equipment:

  • 4.5-5 l Demijohn
  • 4.5-5 l stockpot
  • Hydrometer
  • Thermometer
  • Bung
  • Airlock

Good to have equipment:

  • Siphon
  • Funnel
  • Spoons

I used yeast Belgian Abbey M47 from mangrovejacks.com and vwp sterilizer.


To calculate the ABV you can use the formula:

(OÖ - FÖ) / 7.5 = ABV

OÖ: Original °Öchsle

FÖ: Final °Öchsle

My result: (70 - 0) / 7,5 = ABV


Or this formula:

(OG - FG) x 131 = ABV

OG : Original Gravity

FG : Final Gravity

My result: (1.070 - 1.000) x 131 = ABV


Ingredients:

  • 1,3 kg Honey
  • 3,5 l Water
  • 10 g Yeast

Instructions:

Wash the demijohn.

Fill the demijohn with water and sterilizer.

Wait 30 minutes.

Wash the stockpot.

Pour the sterilized water from the demijohn in the stockpot.

Wash two spoons, a funnel, a hydrometer, a thermometer, a bung and an airlock.

Put the equipment in the stockpot with the sterilized water.

Wait 30 minutes and rinse the equipment thoroughly and put them in a dish rack.

Dissolve the honey with 3,5 l new fresh spring water in the stockpot. If nessesary heat the water to a max ~32°C to dissolve the honey completely.

Wait for the honey water mix to cool down below 20°C and measure the gravity with a hydrometer. I got +70 °Öchsle ( = 1.070 Specific Gravity)

Pour the honey water mix in to the demijohn.

Pour the yeast in the demijohn and put on the bung with airlock.

Let it ferment for around 4 weeks.

Measure the gravity with a hydrometer. I got +5 °Öchsle ( = 1.005 Specific Gravity)

Transfer into bottles. Drink, enjoy and scold in the company of good friends!

Add Wagtail to Django

24 Apr 2021 / OscFr
Web logo

If you have a website with Django you can easily add a Wagtail app to it.
Just follow this simple steps.

Installation

Download and go to app

git clone https://github.com/oscfr657/Birdapp657.git
cd Birdapp657

Pip requirements

pip install -r requirements.txt

Django settings

To your settings file,
add to the INSTALLED_APPS

'django.contrib.sites',  # custom
    'django.contrib.sitemaps',  # custom

    # wagtail
    'wagtail.contrib.forms',
    'wagtail.contrib.redirects',
    'wagtail.contrib.settings',  # custom
    'wagtail.contrib.search_promotions',  # custom
    'wagtail.embeds',
    'wagtail.sites',
    'wagtail.users',
    'wagtail.snippets',
    'wagtail.documents',
    'wagtail.images',
    'wagtail.search',
    'wagtail.admin',
    'wagtail.core',
    'modelcluster',
    'taggit',

    # custom
    'birdapp657',
    # birdapp657 media file block
    'wagtailmedia',
    # birdapp657 default search backend
    'wagtail.contrib.postgres_search',

add to the MIDDLEWARE settings

'django.contrib.sites.middleware.CurrentSiteMiddleware',
    'wagtail.contrib.redirects.middleware.RedirectMiddleware',

add to the TEMPLATES settings

TEMPLATES = [
        {
            'OPTIONS': {
                'context_processors': [
                    'wagtail.contrib.settings.context_processors.settings',  # Extra
            },
        },
    ]

I recommend

set the

WAGTAILIMAGES_FORMAT_

CONVERSIONS

setting:

WAGTAILIMAGES_FORMAT_CONVERSIONS = {
    'bmp': 'webp',
    'jpeg': 'webp',
    'jpg': 'webp',
    'JPG': 'webp',
    'webp': 'webp',
    'png': 'webp',
}

Database configuration

python manage.py migrate

Search Index setup

python manage.py update_index

Django url

To the django projects' url.py add

from django.urls import path, re_path
from django.conf.urls import include

# Wagtail
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.documents import urls as wagtaildocs_urls
from wagtail.core import urls as wagtail_urls

from wagtail.contrib.sitemaps.views import sitemap

and

urlpatterns = [
    re_path('sitemap.xml', sitemap),
    #  Wagtail
    re_path(r'^birdapp/', include(wagtailadmin_urls)),
    re_path(r'^documents/', include(wagtaildocs_urls)),
    re_path(r'', include(wagtail_urls)),
  ]

optionally

handler403 = 'birdapp657.views.bird_page_403'
handler404 = 'birdapp657.views.bird_page_404'
handler500 = 'birdapp657.views.bird_page_500'

Collectstatic

python manage.py collectstatic

Mead and Chill

10 Apr 2021 / OscFr
Mead with chilli

This is a chili mead recipe at experimental size.

Inspired by https://www.georgetimmermans.com/sweet-chili-mead.html

Required equipment:

  • 1.5 l PET bottle
  • 2 l stockpot
  • Hydrometer
  • Thermometer
  • Bung with airlock

Good to have equipment:

  • Funnel
  • Spoons

I used yeast Lalvin D-47 from Lallemand and vwp sterilizer.


To calculate the ABV you can use the formula:

(OG - FG) / 7.5 = ABV

OG : Original °Öchsle

FG : Final °Öchsle

After a total of 8 weeks of fermentation my result: (85 - ) / 7.5 = ABV


Or this formula:

(OG - FG) x 131 = ABV

OG : Original Gravity

FG : Final Gravity

After a total of 8 weeks of fermentation my result: (1.085 - ) x 131 = ABV


Ingredients:

  • 1.5 litre Water
  • 500g Honey
  • 5 g Mead yeast
  • 3 Chillies

Instructions:

Clean and wash a 1.5 liter PET-bottle

Fill the bottle with water and sterilizer

Wait 10 minutes.

Wash the stockpot.

Pour the sterilized water from the PET bottle in the stockpot.

Wash two spoons, a funnel, a hydrometer, a thermometer, a bung and an airlock.

Put the equipment in the stockpot with the sterilized water.

Wait 10 minutes and rinse the equipment thoroughly and put them in a dish rack.

Dissolve the honey with 1.5 l new fresh spring water in the stockpot, heat the water to a max ~32°C to dissolve the honey completely.

Wait for the honey water mix to cool down below 20°C and measure the gravity with a hydrometer. I got +85 °Öchsle ( = 1.085 Specific Gravity)

Pour the honey water mix in to the PET bottle.

Pour the yeast in the PET bottle and put on the bung with airlock.

Let it ferment for at least 6 weeks.

Add 3 chilies.

Let it settle for at least three more weeks.

Measure the gravity with a clean, sterilized hydrometer.

Transfer into smaller glas bottles. Drink, enjoy and scold in the company of good friends!

Commands to setup a secure django website on ubuntu

20 Mar 2021 / OscFr
Secure web stack setup

TLDR: How to setup a secure django website on ubuntu.

sudo apt update
sudo apt upgrade

sudo add-apt-repository universe
sudo add-apt-repository restricted
sudo add-apt-repository multiverse

sudo apt install python3-pip python3-dev libpq-dev python3-venv

sudo apt install postgresql postgresql-contrib

sudo apt install nginx
sudo su - postgres

createdb devdb

createuser -P devuser

psql

ALTER ROLE devuser SET client_encoding TO 'utf8';

ALTER ROLE devuser SET default_transaction_isolation TO 'read committed';

ALTER ROLE devuser SET timezone TO 'UTC';

GRANT ALL PRIVILEGES ON DATABASE devdb TO devuser;

\q

exit

Security check.

For maximum security, ... this is an important security consideration.

[2]: How to secure postgresql on an ubuntu vps

sudo nano /etc/postgresql/9.6/main/pg_hba.conf

local all postgres peer

local all all peer

host all all 127.0.0.1/32 md5

host all all ::1/128 md5

To access PostgreSQL from a remote location, consider using SSH to connect to the database machine and then using a local connection to the database from there.

[2]: How to secure postgresql on an ubuntu vps

pip3 install --upgrade pip

pip3 install virtualenv

mkdir ~/dev_webb
cd ~/dev_webb

python3 -V

# python3.8 -m venv env

virtualenv env
cd ~/dev_webb

source env/bin/activate

pip install django gunicorn psycopg2-binary

django-admin.py startproject dev_webb .

deactivate
nano ~/dev_webb/dev_webb/settings.py
SECRET_KEY = ''

with open('/etc/secret_key.txt') as f:
    SECRET_KEY = f.read().strip()

with open('/etc/database_name.txt') as f:
    db_name = f.read().strip()

with open('/etc/database_user.txt') as f:
    db_user = f.read().strip()

with open('/etc/database_password.txt') as f:
    db_password = f.read().strip()

DEBUG = False

LANGUAGE_CODE = 'sv'

TIME_ZONE = 'Europe/Stockholm'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': db_name,
        'USER': db_user,
        'PASSWORD': db_password,
        'HOST': 'localhost',
        'PORT': '',                      # Set to empty string for default.
        }
    }
sudo nano /etc/secret_key.txt
sudo nano /etc/database_name.txt
sudo nano /etc/database_user.txt
sudo nano /etc/database_password.txt
nano ~/dev_webb/dev_webb/settings.py
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'static'

MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'
source env/bin/activate

manage.py check --deploy

python manage.py migrate

python manage.py collectstatic

manage.py check --deploy

deactivate

Creating systemd Socket and Service Files for Gunicorn

[6]: How to set up django with postgres, nginx and gunicorn on ubuntu 20.04

sudo nano /etc/systemd/system/gunicorn.socket
[Unit]
Description=gunicorn socket

[Socket]
ListenStream=/run/gunicorn.sock

[Install]
WantedBy=sockets.target
sudo nano /etc/systemd/system/gunicorn.service
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target

[Service]
User=devuser
Group=www-data
WorkingDirectory=/home/devuser/dev_webb
ExecStart=/home/devuser/dev_webb/env/bin/gunicorn \
          --access-logfile - \
          --workers 3 \
          --bind unix:/run/gunicorn.sock \
          devsite.wsgi:application

[Install]
WantedBy=multi-user.target
sudo systemctl start gunicorn.socket

sudo systemctl enable gunicorn.socket

sudo systemctl status gunicorn.socket
sudo nano /etc/nginx/sites-available/dev_webb
server {
    listen 80;
    server_name domain_or_ip;

    location = /favicon.ico { access_log off; log_not_found off; }

    location /static/ {
        alias /home/devuser/dev_webb/static/;
        add_header Cache-Control "no-cache";
    }
    location /media/ {
        alias /home/devuser/dev_webb/media/;
        add_header Cache-Control "no-cache";
    }
    localtion /robots.txt {
        alias /home/devuser/dev_webb/robots.txt
    }

    location / {
        #include proxy_params;
        proxy_pass_header Server;
        proxy_redirect off;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header Host $http_host;

        proxy_pass http://unix:/run/gunicorn.sock;
    }
}
sudo ln -s /etc/nginx/sites-available/dev_webb /etc/nginx/sites-enabled/

sudo nginx -t

sudo systemctl restart nginx

sudo systemctl restart gunicorn.socket gunicorn.service

sudo systemctl daemon-reload
sudo apt-get update

sudo apt-get remove certbot

sudo apt-get update

sudo snap install --classic certbot

sudo certbot --nginx -d dev_webb.se -d www.dev_webb.se

sudo certbot renew --dry-run
nano ~/dev_webb/dev_webb/settings.py
debug = False

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# SECURE_SSL_REDIRECT = True ?

CSRF_COOKIE_SECURE = True
SESSION_COOKIE_SECURE = True

# SECURE_HSTS_SECONDS = 60 ?
SECURE_BROWSER_XSS_FILTER = True
source env/bin/activate

manage.py check --deploy

python manage.py migrate

python manage.py collectstatic

manage.py check --deploy

deactivate

sudo systemctl restart gunicorn.socket gunicorn.service

sudo nginx -t

sudo systemctl restart nginx

Raspberry Milk Stout by Left hand Brewing Co

28 Nov 2020 / OscFr
Raspberry milk stout

Type: Stout - milk / sweet

ABV: 5.7%

Flavor: Raspberry, chocolate, coffee

My rating: 3.75 / 5


Before you smell it you think Raspberry.

You taste it, you're fooled, it's chocolate with hints of roasted coffee.

In the end the thought that remain is raspberry.


Untappd