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..

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/;
    }
    
    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

Cinnamon mead recipe

07 Nov 2020 / OscFr
Cinnamon mead in bottle and glas and three cinnamon sticks.

This is a cinnamon mead recipe I'm brewing at experimental size at the moment.

Inspired by a recipe by George Timmermans but scaled down to experimental size.

Required equipment:

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

Good to have equipment:

  • Funnel
  • Spoons
  • Siphon

I used yeast M05 from mangrovejacks.com 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 6 weeks of fermentation my result: (77 - 0) / 7.5 = 10.2667 ABV


Or this formula:

(OG - FG) x 131 = ABV

OG : Original Gravity

FG : Final Gravity

After a total of 6 weeks of fermentation my result: (1.077 - 1.000) x 131 = 10.087 ABV


Ingredients:

  • 1.5 litre Water
  • 450g Honey
  • 5 g Mead yeast
  • 2-3 sticks Cinnamon

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 +77 °Öchsle ( = 1.077 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 a week.

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

Add 2-3 sticks of cinnamon.

Let it ferment for at least three more weeks.

Measure the gravity with a hydrometer.

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

FJORD by Northern Exposure Brewing Co

30 Okt 2020 / OscFr
A glas and can with FJORD by North Exposure Brewing Co

Type: IPA - Imperial / Double New England

ABV: 8%

Flavor: Tropical, Fruity, Grapefruity, Citrusy, Piney

My rating: 3.75 / 5

Untappd