Skip to main content

A small package targeting to help on python project packaging process

Project description

py_volumn_test

This simple volumn testing framework for linux platform.

Requirements

The application requires

  1. python 3.12+
  2. requires df command
  3. hashicorp vault

Setup

Hashicorp Vault

Assume

  1. we create secret on mount point (mp)
  2. we create secret on path (abc)
  3. we create a policy of policy-mp-abc
  4. we create a approle of ar-mp-abc

Create policy

by creating a hashicorp policy xxx.hcl

# assume `{mount_point}` is `mp`
# assume `{path}` is `abc`
# access the secret in cli `vault kv get mp/abc`
# The actual path of the secret is `mp/data/abc`
path "{mount_point}/data/{path}/*" {
        capabilities = ["read"]
}

Insert or update the policy by

vault policy write {policy_name} {policy_file}
# vault policy write policy-mp-abc xxx.hcl

Create app role

# ------ create app role
vault write auth/approle/role/{app role name} token_policies="{policy name}" token_ttl="15m" token_max_ttl="2h"
# vault write auth/approle/role/ar-mp-abc token_policies="policy-mp-abc" token_ttl="15m" token_max_ttl="2h"
vault write auth/approle/role/{app role name} token_policies="{policy name}" token_ttl="15m" token_max_ttl="2h"

# ------ get role id
# The command return the role id
vault read auth/approle/role/{app role name}/role-id
# vault read auth/approle/role/ar-mp-abc/role-id

# ------ get secret id
# The command return the secret id (the secret is force to be generated, without re-view the secret id)
vault write -f auth/approle/role/{app role name}/secret-id
# vault write -f auth/approle/role/ar-mp-abc/secret-id

# ------ login the vault in env
# assume the role_id is `vault_role_id`
# assume the secret_id is `vault_secret_id`
export VAULT_TOKEN="$(vault write -format=json auth/approle/login role_id=$vault_role_id secret_id=$vault_secret_id | jq -r '.auth.client_token')"

Create secret

vault kv put mp/abc \
    api_key=$api_key \                     # api key is the api key for restdb.io
    host=$host \                           # host is url
    collection_name=$collection_name \     # collection name is the collection name
    filter_name=$filter_name \             # filter name is the configuration name to filter
    bootstrap_id=$bootstrap_id             # the entry point to access

Run application

df | \
    docker run \
        -e VAULT_ADDR="$VAULT_ADDR" \
        -e vault_role_id="$vault_role_id" \
        -e vault_secret_id=$vault_secret_id \
        -e vault_mount_point=$vault_mount_point \
        -e vault_secret_path=$vault_secret_path \
        -i py-volumn-test  

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_volumn_test-0.0.2.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_volumn_test-0.0.2-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file py_volumn_test-0.0.2.tar.gz.

File metadata

  • Download URL: py_volumn_test-0.0.2.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for py_volumn_test-0.0.2.tar.gz
Algorithm Hash digest
SHA256 aee22ff780f84624b6f8a2d4220e5e045bc74e24de899ef70c81b71c1bccaf7d
MD5 bdc95b890d717353a1ad3e8f928bdfd6
BLAKE2b-256 bea4920a7466a1027d851537cf255452bb8777fe99a375d6f3b40523e6c46e4f

See more details on using hashes here.

File details

Details for the file py_volumn_test-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: py_volumn_test-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for py_volumn_test-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e276ae338e2c2dc60d6a0a9a62a22f519a3f7e8d6f2d6300ac66857216e7bbd1
MD5 b973ee6d541f0b838ea1f7346c14f421
BLAKE2b-256 cc5ea41e41e2b87f87ccc7e324465ec55051d73a80bdc6e759c9efb0cebb3065

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page