The init.py
script is designed to automate the process of registering credentials and loading common specifications and images for a Tumblebug server. It can be executed directly or via the init.sh
script which sets up a Python virtual environment. This script ensures the Tumblebug server is healthy before proceeding and performs several network operations in a secure and managed way.
- Health Check: Verifies that the Tumblebug server is ready to handle requests before proceeding with operations.
- Credential Registration: Dynamically registers all valid credentials stored in a YAML file to the Tumblebug server.
- Resource Loading: Initiates the loading of common specs and images into Tumblebug.
- Python 3.7.5 or higher is installed
- Python packages listed in
requirements.txt
- The
python3-venv
package should be installed for running the script usinginit.sh
.
Before running init.py
, you must encrypt your credentials.yaml
file to ensure the security of your sensitive information.
- Use the
encCredential.sh
script to encrypt yourcredentials.yaml
file:
init/encCredential.sh
The init.py
script will decrypt the credentials.yaml.enc
file as needed to read the credentials. You may need to provide a password if the decryption key is not stored.
pip3 install -r requirements.txt
python3 init.py
- Options:
-y, --yes
(Automatically answer yes to prompts and proceed without manual confirmation)
The init.sh
script is provided to automate the setup of a Python virtual environment and running the init.py
script. This is the recommended way to run the script.
Requires Python3.8 and above.
init.sh
- Options:
-y, --yes
(Automatically answer yes to prompts and proceed without manual confirmation)
Before running the script, ensure the following environment variables are set according to your Tumblebug server configuration:
TUMBLEBUG_SERVER
: The address of the Tumblebug server.TB_API_USERNAME
: Username for API authentication.TB_API_PASSWORD
: Password for API authentication.
To protect sensitive information, credentials.yaml
is not used directly. Instead, it must be encrypted using encCredential.sh
. The encrypted file credentials.yaml.enc
is then used by init.py
. This approach ensures that sensitive credentials are not stored in plain text.
If you need to update your credentials, decrypt the encrypted file using decCredential.sh
, make the necessary changes to credentials.yaml
, and then re-encrypt it.
init/encCredential.sh
init/decCredential.sh
init.py
: Main Python script.requirements.txt
: Contains all Python dependencies.init.sh
: Bash script for setting up a Python virtual environment and runninginit.py
.credentials.yaml
: Contains the credentials data to be registered with the Tumblebug server.encCredential.sh
: Script to encryptcredentials.yaml
.decCredential.sh
: Script to decryptcredentials.yaml.enc
.