Image for running a network of servers sending Fibonacci numbers to each other in numerous ways.
1.0K
Image Repository: https://hub.docker.com/r/laoluade/run-fibonacci
Latest Image Version: docker.io/laoluade/run-fibonacci:2.3.0
Note: Still haven’t added full TLS for 3rd-party datastores yet, that’s a thing for later. It’s not that I can’t, I want a way to test it from pure python without having to change file permissions on my Windows laptop.
Version 2.3.0 (Available tags are |
|
Version 2.2.0 (Available tags are |
|
Version 2.1.0 (Available tags are |
|
Version 2.0.0 (Available tags are |
|
Version 1.2.0 (Available tags are |
|
Version 1.1.0 (Available tags are |
|
Version 1.0.1 (Available tags are |
|
Version 1.0.0 (Available tags are |
|
Docker or Podman
OpenSSL
PowerShell or POSIX-compliant Shell
Curl
Python (version 3.12 or higher is recommended, code is written in 3.13)
This container image is a generic image for running a small fibonacci number passing server. This image is made to work in a number of different contexts, such as running as a standalone container or as part of a larger kubernetes deployment.
The following diagram displays the components of the server at a high level.

In this diagram, we can see what components comprise the server image. The majority of the server is contained within the Flask API, which in turn is managed by the Gunicorn Server. TLS materials are given to the Gunicorn Server to enable encrypted communication. Two daemons (which are actually shells scripts) are connected to the Flask API through different functions and endpoints. Lastly, the STDOUT Logger is there to record any activity that takes place.
The container image exposes three REST API points. The first is the Default route (/) that is used to pass along fibonacci numbers. The second is the healthcheck route (/healthcheck) that is used to perform health checks on the server. The third is the start route (/start) that is used to start the fibonacci number passing chain.
All important information about the server is printed to STDOUT using the Python print command’s flush argument.
The four files used in this image are gunicorn.conf.py, rest.py, send_healthcheck.sh, and send_next_fib.sh. These files are located in the components folder.
gunicorn.conf.py is the configuration file used by Gunicorn to tailor the server. This file specifies the Flask server to use, the network socket that the server listens on, and the TLS files necessary for encrypted communication among other things.
rest.py is a Flask definition file that is served by Gunicorn. This file specifies REST logic for the API endpoints and instantiates the constants that are used during the server’s runtime.
send_healthcheck.sh is the shell script that is called by an external management process to check the server’s health. It utilizes Curl to send an HTTPS message to the running server. It is represented by the Health Check Daemon box in the diagram above.
send_next_fib.sh is the shell script that is called by the healthcheck API to send a pair of fibonacci numbers to another server stage. It utilizes Curl to send an HTTPS message to the destination endpoint. It is represented by the Send Number Daemon box in the diagram above.
Here is a list of hardcoded details in the Dockerfile for the image. Feel free to change any of these values on your own system.
The image defines two platforms as options to run the server.
Alpine Linux is the default platform used to run the server due to its lightweight nature. The image defines docker.io/library/alpine:3.22 as the base layer image.
Alma Linux is an additional platform used for cases where a RHEL variant is preferred. The image defines docker.io/library/almalinux:10-minimal as the base layer image.
The image defines the non-root user app to run the server.
The image defines server contents to be kept in the /usr/src/app directory. The user app is given ownership of this directory.
The image defines a healthcheck to monitor the state of the server.
The healthcheck is given a grace period of 10 seconds in the beginning.
The healthcheck is set to run every 10 seconds.
The healthcheck times out after 5 seconds if not complete.
The healthcheck has a maximum of 3 attempts to succeed before the server is deemed unhealthy.
The healthcheck runs the /usr/src/app/send_healthcheck.sh script to check server health.
The image defines the gunicorn command to be the entrypoint of the container built by the image.
README.adoc is the file you are reading right now that explains everything about the image.
changelog.adoc is the secondary AsciiDoc file used to hold changelog information about the image.
latest_image.adoc is an AsciiDoc file used to hold the fully qualified name of the latest image.
alpine.Dockerfile is the file that defines the Alpine image.
alma.Dockerfile is the file that defines the Alma image.
CreateImages.py is the Python file used to create and push images and tags in one go.
testing/TestGenTLS.py is a Python script used to create the TLS materials for the testing images.
testing/TestVersion.py is a Python script used to test settings and platforms of the fibonacci server.
Note: For the test scripts, you will be on your own for scaling down the test. All that’s created is a container and some TLS credential stuff though, so it should be easy.
Docker Official Images
Python
Python Flask
Python Gunicorn
Curl
This section discusses the current server environmental settings available.
Firstly, the configuration file is JSON, and the settings are formatted in a way where a dot would correspond to them being nested inside the key before the dot. For example, network.datastore.address is equal to the following:
{
"network": {
"datastore": {
"address": "sampleAddress"
}
}
}
Secondly, it is possible to use environmental variables to pass in settings. The format for environmental variable uppercases all letters and replaces . with _. For example, to alter the network.datastore.address setting, pass in the environmental variable NETWORK_DATASTORE_ADDRESS.
Lastly, to set what JSON file the server uses to configure itself to check, set the SERVER_CONFIG_FILEPATH environmental variable. By default, it is set to /usr/src/app/server_config.json at build time. If you submit a custom JSON that does not have all settings defined or only configure a few settings by environmental variables, then the default JSON configuration (through the DEFAULT_SERVER_CONFIG_FILEPATH backup environmental variable) will be used to configure the rest of the settings. Please do not replace that file, and the server WILL throw a fit and crash itself through assertions if it can’t find a setting.
The following precedent is set for configured settings:
Highest Priority: Environmental variable counterparts
Medium Priority: SERVER_CONFIG_FILEPATH configuration file
Lowest Priority: DEFAULT_SERVER_CONFIG_FILEPATH configuration file
api
Definition → The type of Server Web API to use.
Schema → Must be one of a set of constants defined for the server.api key in the project README.
Default → "rest"
datastore.auth.username
Definition → The username of the account for accessing the datastore.
Schema → Must be a string with alphanumerical characters with no spaces. Optional.
Default → ""
datastore.auth.password
Definition → The password of the account for accessing the datastore.
Schema → Must be a complex, decently long string. Optional.
Default → ""
datastore.logs.defaultPath
Definition → The default filesystem location where the datastore should save server logs.
Schema → Must be a UNIX absolute filepath.
Default → "/tmp/default.csv"
datastore.logs.operationPath
Definition → The filesystem location where the datastore operations that can’t be sent should be saved.
Schema → Must be a UNIX filepath.
Default → "/tmp/operations.csv"
datastore.logs.serverPath
Definition → The primary filesystem location where the datastore should save server logs.
Schema → Must be a UNIX filepath.
Default → "/tmp/datastore.csv"
datastore.type
Definition → The type of Datastore to use.
Schema → Must be one of a set of constants defined for the server.datastore key in the project README.
Default → "none"
network.datastore.address
Definition → The network address of the datastore that the server should contact in the test network.
Schema → Must be either a IPv4 address or a FQDN.
Default → "127.0.0.1"
network.datastore.port
Definition → The network port of the datastore that the server should contact in the test network.
Schema → Must be non-privileged port number.
Default → 8080
network.dest.address
Definition → The network address of the server stage that the server should contact in the test network.
Schema → Must be either a IPv4 address or a FQDN.
Default → "127.0.0.1"
network.dest.port
Definition → The network port of the server stage that the server should contact in the test network.
Schema → Must be non-privileged port number.
Default → 8080
network.self.address.healthcheck
Definition → The network address the server uses to call itself for a healthcheck in the test network.
Schema → Must be either a IPv4 address or a FQDN.
Default → "127.0.0.1"
network.self.address.listening
Definition → The network address the server binds to in the test network.
Schema → Must be either a IPv4 address or a FQDN.
Default → "0.0.0.0"
network.self.port
Definition → The network port of the server in the test network.
Schema → Must be non-privileged port number.
Default → 8080
stage.count
Definition → The number of server stages in the test network.
Schema → Must be a number that can be turned into a Python integer.
Default → 1
stage.index
Definition → The server stage designator of the server in the test network.
Schema → Must be a number that can be turned into a Python integer. Must be between 0 and SERVER_STAGE_COUNT or equal to SERVER_STAGE_COUNT.
Default → 1
throttleSecs
Definition → The interval that the server should wait in seconds between receiving fibonacci numbers and sending fibonacci numbers.
Schema → Must be a number that can be turned into a Python integer.
Default → 5
tls.ca.keyPath
Definition → The location of the certificate authority TLS key of the server in the test network.
Schema → Must be a UNIX filepath.
Default → "./ca.key"
tls.ca.certPath
Definition → The location of the certificate authority TLS certificate of the server in the test network.
Schema → Must be a UNIX filepath.
Default → "./ca.crt"
tls.gen.caSuffix
Definition → The suffix to append to generated PEM files containing both the server’s and CA’s certificate.
Schema → Must be a string with letters, dashes, and/or hyphens.
Default → "ca"
tls.gen.certDays
Definition → The length that the server’s created certificate should be active.
Schema → Must be a number that can be turned into a Python integer.
Default → 1
tls.gen.ext.cert
Definition → The file extension to use for TLS certificates.
Schema → Must be a valid extension.
Default → "crt"
tls.gen.ext.key
Definition → The file extension to use for TLS keys.
Schema → Must be a valid extension.
Default → "key"
tls.gen.ext.pem
Definition → The file extension to use for TLS certificate-key combinations.
Schema → Must be a valid extension.
Default → "pem"
tls.gen.keyLength
Definition → The bit length of the RSA key.
Schema → Must be a number that can be turned into a Python integer.
Default → 4096
tls.gen.pubExponent
Definition → The public exponent of the RSA key.
Schema → Must be a number that can be turned into a Python integer.
Default → 65537
tls.gen.secretTarget
Definition → The filepath (minus the file extension) that should be used to name created server TLS materials.
Schema → Must be a UNIX filepath.
Default → "./self"
tls.san.ips
Definition → The list of IP addresses to use as SANs.
Schema → Must be an IP address or a string formatted as IP addresses separated with a comma.
Default → "127.0.0.1"
tls.san.names
Definition → The list of FDQNs to use as SANs.
Schema → Must be an FQDN or a string formatted as FQDNs separated with a comma.
Default → "localhost"
upperBound
Definition → The number that the server must stop sending new fibonacci numbers if the last number the server received is larger than.
Schema → Must be a number that can be turned into a Python integer.
Default → 4000000000
workers
Definition → The number of server workers to create.
Schema → Must be a number that can be turned into a Python integer.
Default → 3
Content type
Image
Digest
sha256:979b2ac89…
Size
47.6 MB
Last updated
11 months ago
docker pull laoluade/run-fibonacci