Migrate your application into a Docker container

Containers are the future (and some of us are already there). Container technology, spearheaded by Docker, is revolutionary by allowing developers to write applications once, and run them (almost) anywhere.

Containers help developers to fully test a complete application including frontend, middle tier, and databases on their workstations, and expect the same result in the production environment.

Most applications can be migrated to containers if the runtime environment, and all application features are supported by the container architecture. Because containers are really nothing else than namespaces on the host operating system, Linux containers can natively run only on Linux host operating systems, Windows containers can natively run only on Windows hosts. Using virtual machines, it is possible to run containers on a different host operating system, but it requires an additional layer of complexity.

Twelve-Factor methodology offers guidance on multiple aspects of the application design, development, and deployment. During our migration process we will extensively use the third, “Configuration” factor. This recommends to get configuration values from environment variables, so the same code can be deployed to any environment without changes. This guarantees code parity between test and production environments to reduce the risk of failures during the promotion to a higher environment.

Using environment variables our application can read them the same way regardless where it runs.

Store configuration values in environment variables

On our workstation we can set environment variables

  • manually in the terminal (not recommended),
  • in the ~/.bashrc file ( on Linux )
  • in the “Environment Variables” section of the computer properties ( on Windows )
  • in a file called from the ~/.bashrc file ( on Linux )
  • in an automatically executed batch file ( on Windows, see How to run a batch file each time the computer loads Windows )
  • with an auto executed script reading values from Vault or any other secure secret storage ,and saving them in environment variables.

Automate everything

Automation allows us to build, test and deploy our application quickly and frequently without manual intervention. This avoids human errors during the CI/CD process and produces the same result every time we run the CI/CD pipeline.

These are language agnostic recommendations, on the language specific pages listed below we will revisit them in more detail.

Create the init.sh file

Create the init.sh file in the source directory and enable the execution with the command:

chmod +x init.sh

This file will contain the terminal initialization steps for the application. This example

  • sets the AWS_PROFILE environment variable value.
AWS_PROFILE=aws1

Create the env.list file

The env.list text file contains the list of environment variables (without values) used by the application. When we run the Docker container, the –env-file option will copy those into the environment of the container.

MY_VAR1
MY_VAR2

Create a Makefile

In the source directory create the Makefile to automate frequently executed steps. This Makefile provides the following functionality:

  • make init ( the first and default option, so it is enough to type “make”)
    • provides instructions on how to execute the init.sh file the first time you open the terminal in this directory. (“Make” recipes execute the instructions in subprocesses, so those lines cannot update the parent environment you are calling them from. The extra dot instructs the terminal to run the init.sh script in the same process. It is same as “source” but more portable.)
  • make docker-build
    • using the Dockerfile builds the application into a Docker container
  • make docker-run
    • runs the Docker container using the list of environment variables from the env.list file
init:
	# TO INITIALIZE THE ENVIRONMENT EXECUTE
	# . ./init.sh

docker-build:
	docker build -t MY_APP .

docker-run:
	docker run -it --env-file env.list MY_APP

For language specific examples see

Elektronikus könyv küldése az Amazon Kindle-re email-ben

Ez a módszer akkor működik, ha a könyv file “.mobi” formátumú file-ban van.

  • Indítsd el az email programodat
  • Kezdj írni egy új email-t
  • Ird be a Kindle email címét a cimzett helyére és a könyv címét a tárgy helyére
  • Add hozzá a “.mobi” formátumú könyvet az email-hez csatolmányként

    és jelöld ki a könyv file-t
  • Küldd el az email-t
  • Néhány perc múlva a könyv megérkezik a Kindle-re, ellenőrizd le.

Elektronikus könyv küldése az Amazon Kindle-re a Calibre programmal

  • Indítsuk el a Calibre programot,
  • A könyvtárban jelöljük ki a könyvet, kattintsunk a Kapcsolat/megosztás gombra és válasszuk ki az Email küldése ide: …@kindle.com menü pontot.
  • Ellenőrizzük le, hogy a program a korrekt formátumra konvertálja a könyvet. Ha a formátum megfelel katintsunk az Igen gombra. Ha “Nem”-el válaszoulnk, Calibre akkor is elküldi az email-t, csak nem konvertálja a könyvet.

Ha nem érkezik a könyv a Kindle-re

Várni kell…

Ha néhány perc után sem érkezik meg a könyv a Kindle-re,

  • A képernyő jobb alsó sarkába kattintva mengézhetjük a küldési folyamatot.
  • Duplán kattintsunk a könyv címére.
  • A program 5 percet vár két könyv küldése között, hogy a Hotmail és Kindle email rendszerek ne gondolják, hogy körleveleket küldünk

Template variables are not supported in alert queries – Grafana error

When you try to create the first alert on a Grafana dashboard, you may get the error message:

Template variables are not supported in alert queries

Cause

All queries of the panel use at least one template variable with the format ${VARIABLE_NAME} or $VARIABLE_NAME

Template variables usually represent the value of selected items in dropdown lists, like the data source, region, queue name.

Alerts run queries outside of the dashboard, do not have information on the value of selected items. Alert queries have to be able to collect data without user interaction.

In the AWS SQS Queue dashboard template # 584 there are three template variables we need to replace with selected items:

Solution

Click each variable and select the appropriate values from the lists.

To create a new query without template variables

  • Click the + Query button at the bottom of the Query tab

Tejfölös, mustáros sült hús krumplival

Hozzávalók

  • Néhány szelet hús
  • Hagyma
  • Krumpli
  • Alma ( zöld alma a legjobb )
  • 2 dl Tejföl
  • Fehér bor
  • Mustár
  • Bors

Előkészítés

  1. Besózzzuk, megborsozzuk a hús szeletek mindkét oldalát
  2. Pici olajjal kiolajozzuk a hőálló tálat
  3. Kevés fehér bort teszünk bele
  4. Alulra tesszük a húsokat
  5. Rátesszük a karikára vágott hagymát
  6. Rátesszük a vastagabb karikára vágott almát
  7. Rátesszük a vastagabb karikára vágott krumplit
  8. Tejfölt mustárral összekeverjük, kicsi sót teszünk bele
  9. Az öntetet rákenjük a tetejére

Sütés

  • Alufóliával lefedve 30-35 percig 180 celsius fokon alsó felső sütéssel a húsokat puhára sütjük.
  • Levesszük a fóliát, felülre tesszük a húsokat és 180 fokon a húsok mindkét oldalát kicsit pirosra sütjük. Ha sok a lé, légkeveréssel pirítjuk, hogy kissé elpárologjon.
  • Amikor megfordítjuk a húsokat, megkenjük a lével.

Encountered exception: The request identified this synchronization job…

During Azure AD user on-demand provisioning you may encounter the error message:

Encountered exception: The request identified this synchronization job: …. The request also identified this synchronization rule: . However, the job does not include the rule.

To fix this issue click the Retry button at the bottom of the page.

This object does not have required entitlement for provisioning

Microsoft Azure Active Directory services provides authentication to your application.

User provisioning may fails with this message:

Result Skipped

Description The User ‘…’ will be skipped due to the following reasons: 1) This object does not have required entitlement for provisioning. If you did not expect the object to be skipped, update provisioning scope to ‘Sync all users and groups’ or assign the object to the application with entitlement of provisioning category

SkipReason NotEffectivelyEntitled

This message is displayed, because there is a problem with the user assignment record stored in Azure AD. To fix this issue, un-assign the user (or group) from the app, and re-assign it again.

How to add your COVID-19 vaccination record to Apple Wallet

California maintains a state-wide database of COVID-19 vaccinations. Apple Wallet supports the digital vaccination records since iOS version 15.1

To add your COVID-19 digital vaccination record to your Apple Wallet

  1. On your phone or computer navigate to https://myvaccinerecord.cdph.ca.gov/
  2. Enter your first and last name, date of birth, and the phone number or email address associated with your vaccination record
  3. Create and write down a temporary four-digit PIN to access your record.

  4. A link will arrive as a text message or email depending on the associated information you have entered. The link is only valid for 24 hours.
  5. If the link arrived to your phone, send it to another device, or to a family member, friend or coworker you are with, and and ask them to open the link.
  6. When you open the link enter the four digit PIN you have created above.
  7. Point the camera of your iPhone to the QR code on the vaccination record.
  8. Select the Health QR Code Open in Health popup

  9. Select the Add to Wallet & Health button

  10. The vaccination record is available in the Apple Wallet and in the Health app under Immunizations.

To save the COVID-19 digital vaccination record in Notes

  1. On the web page of the digital record select the DOWNLOAD IMAGE button

  2. Select the Download link
    1. If you opened the link in Safari
      1. Select the blue dot with the white arrow

      2. Select Downloads

      3. Select the downloaded file

    2. If you opened the link in another browser
      1. Open the Files app

      2. Select the Browse image and select Downloads

      3. Select the downloaded file

  3. At the bottom select the Share icon

  4. Select Copy

  5. Open the note and paste the image into it.

Integrate Anaconda into Pyenv

If you use Pyenv to install multiple Python versions side-by-side and installed Anaconda to create virtual environments for each of your projects, install pyenv-virtualenv to integrate them.

Anaconda without the pyenv-virtualenv integration overwrites the PATH, and places itself to the front before pyenv would be able to handle the Python command calls. pyenv-virtualenv seamlessly combines the functionality of pyenv and Anaconda to handle the multiple Python versions and virtual environments.

The source code is at https://github.com/pyenv/pyenv-virtualenv

Install pyenv-virtualenv

Use Home Brew for the recommended installation

brew install pyenv-virtualenv

Add the initialization code to the ~/.bashrc, ~/.zshrc file:

if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi

Install multiple Python versions with Pyenv

Pyenv is a Python version manager. It is recommended, because it does not depend on Python, (written in Bash) and using it we can install and utilize multiple Python versions without affecting the Python version used by MacOS.

The Pyenv source code is at https://github.com/pyenv/pyenv

Install Pyenv

We will use Homebrew to install Pyenv

brew install pyenv

Install the latest stable version of Python with Pyenv

Check https://www.python.org/downloads/macos/ for the latest stable release.

pyenv install 3.11.1

Set the new Python version the default

pyenv global 3.11.1
# check if the change took effect
pyenv version

Configure your shell to use Pyenv for Python version management

Add these lines to your .bashrc, .zshrc or .bash_profile file

PATH=$(pyenv root)/shims:$PATH

if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init -)"
fi