Add logging to basic_example and update PostgreSQL database name
This commit is contained in:
12
.vscode/settings.json
vendored
Normal file
12
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"cSpell.words": [
|
||||||
|
"docstrings",
|
||||||
|
"healthcheck",
|
||||||
|
"isort",
|
||||||
|
"pycodestyle",
|
||||||
|
"pydantic",
|
||||||
|
"pydocstyle",
|
||||||
|
"pytest",
|
||||||
|
"pyyaml"
|
||||||
|
]
|
||||||
|
}
|
@ -1,7 +1,14 @@
|
|||||||
"""Example usage of DockerComposeManager to generate a docker-compose.yaml file."""
|
"""Example usage of DockerComposeManager to generate a docker-compose.yaml file."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from compose import DockerComposeManager
|
from compose import DockerComposeManager
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
logger: logging.Logger = logging.getLogger("docker-compose-example")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# Path to the compose file to generate
|
# Path to the compose file to generate
|
||||||
compose_path = "docker-compose.yaml"
|
compose_path = "docker-compose.yaml"
|
||||||
@ -24,7 +31,7 @@ if __name__ == "__main__":
|
|||||||
environment={
|
environment={
|
||||||
"POSTGRES_USER": "user",
|
"POSTGRES_USER": "user",
|
||||||
"POSTGRES_PASSWORD": "password",
|
"POSTGRES_PASSWORD": "password",
|
||||||
"POSTGRES_DB": "exampledb",
|
"POSTGRES_DB": "example_db",
|
||||||
},
|
},
|
||||||
ports=["5432:5432"],
|
ports=["5432:5432"],
|
||||||
volumes=["db_data:/var/lib/postgresql/data"],
|
volumes=["db_data:/var/lib/postgresql/data"],
|
||||||
@ -33,4 +40,4 @@ if __name__ == "__main__":
|
|||||||
# Save the compose file
|
# Save the compose file
|
||||||
manager.save()
|
manager.save()
|
||||||
|
|
||||||
print(f"docker-compose.yaml generated at {compose_path}")
|
logger.info("docker-compose.yaml generated at %s", compose_path)
|
||||||
|
Reference in New Issue
Block a user