{"id":15483207,"url":"https://github.com/zpascal/container-manager","last_synced_at":"2026-01-22T20:10:10.347Z","repository":{"id":43754877,"uuid":"354923324","full_name":"ZPascal/container-manager","owner":"ZPascal","description":"The project includes a python based container process overlay","archived":false,"fork":false,"pushed_at":"2025-06-20T11:07:37.000Z","size":168,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-20T12:21:26.271Z","etag":null,"topics":["container","containerd","docker","kubernetes","overlay"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZPascal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-05T17:56:43.000Z","updated_at":"2025-06-20T11:07:40.000Z","dependencies_parsed_at":"2025-06-20T12:20:19.658Z","dependency_job_id":"1600bb2e-510e-42bf-a1ac-91001c09c6f3","html_url":"https://github.com/ZPascal/container-manager","commit_stats":{"total_commits":28,"total_committers":2,"mean_commits":14.0,"dds":0.0357142857142857,"last_synced_commit":"a5d47c69f626bc9f84e234bf66be36fdcbd5dc96"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/ZPascal/container-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZPascal%2Fcontainer-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZPascal%2Fcontainer-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZPascal%2Fcontainer-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZPascal%2Fcontainer-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZPascal","download_url":"https://codeload.github.com/ZPascal/container-manager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZPascal%2Fcontainer-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28670366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T19:36:09.361Z","status":"ssl_error","status_checked_at":"2026-01-22T19:36:05.567Z","response_time":144,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["container","containerd","docker","kubernetes","overlay"],"created_at":"2024-10-02T05:11:00.452Z","updated_at":"2026-01-22T20:10:10.327Z","avatar_url":"https://github.com/ZPascal.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Container Manager\n\n[![Integrationtest](https://github.com/ZPascal/container-manager/actions/workflows/integrationtest.yml/badge.svg)](https://github.com/ZPascal/container-manager/actions/workflows/integrationtest.yml)\n\n## Idea\n\nThe finished solution should enable the complete lifecycle of an application to be covered and the application to be managed by means of a supervisor and corresponding preparatory steps to be carried out. Furthermore, one-time and regular operations are to be performed on the persistent storage. Another functionality is the backup and restore of the whole system. The system should be rounded off with the possibility of forwarding logs.\n\n## Description\n\nThe Container Manager manages the lifecycle like the s6-overlay of your application and provides a framework for your container. This folder structure allows you to configure your application within a pre-built framework and equip it with all the services you need. The architecture of the framework gives you maximum flexibility. The framework presented here allows you to manage your app and reduce the maintenance effort to a minimum. It allows you to manage your app with a supervisor and automate all necessary steps like backup functionality. Furthermore, a restore mechanism is available in a fallback scenario. Other basic components are the two setup scripts (run.always and run.once), the central logging, Crontab and the integration of various health scripts that monitor the state of your application.\n\n## Installation \u0026 Requirements\n\n### Container\n\nIf you want to use the container manager, feel free to build it and use it accordingly. Furthermore, it is already planned to publish the corresponding container inside the Docker Hub.\n\n### Manual installation\n\n#### Programs \u0026 tools to install\n\n- python3\n- supervisor\n- filebeat \n- tzdata \n- logrotate \n- rsync \n- curl\n- py3-pip\n\n#### Folder structure\n\nPlease copy the whole folder structure from the ```files``` directory to your system. You could use the following Dockerfile command for this task: ```ADD files /``` \n\n## Functionality \u0026 Folders\n\n### Docker container\n\nInside the Docker container, you can find the already copied directory structure and additionally, various configurations such as a dedicated user for the corresponding applications have already been created and all scripts have been made executable. Furthermore, the image can be used as a mother and an inheritance with the corresponding children based on it. Thus, a later change of the user can be accomplished in the inheriting images (Add ```USER 500``` to the corresponding Dockerfile). Another special feature is the already included integration of the corresponding Alpine repositories (Main, Testing, Community) and recursively revoking write permissions inside the complete newly embedded directory structure.\n\n#### Deployment of the container\n\nThe variables, e.g. for Filebeat/ Logstash, can be set centrally within the deployment and thus enable central control and processing of the logs and other configuration parameters.\n\n| Environment variable | Value |\n|:--------------------:|:-----:|\n| IMAGE_NAME | Name of the image (this value can be used for later assignment and extension of the logrotate configuration) |\n| IMAGE_VERSION | Version of the image (this value can be used for later assignment and extension of the logrotate configuration) |\n| APP_NAME | Name of the app (this value can be used for later assignment and extension of the logrotate configuration) |\n| APP_VERSION | Version of the app (this value can be used for later assignment and extension of the logrotate configuration) |\n| TZ | The value of your corresponding timezone e.g. Europe/Berlin |\n\n### App\n\nInside the app folder, the corresponding applications, their dependencies and other required files should be stored. This structure enables an orderly storage of the artifacts and the later backup of the applications.\n\n### Backup\n\nThe backup folder contains the logic of the backup process in the form of a start script and any number of other scripts that describe the artifacts and files to be backed up.\n\n### Config\n\nThe configuration files and corresponding initialization scripts of the corresponding applications can be stored centrally in the config folder.\n\n### Cron\n\nInside the cron directory, the corresponding Python crontab implementation and a cron wrapper can be found. Furthermore, corresponding crontab entries such as the automatic execution of the backup job can be placed within the file ```kubernetes```. Please note the corresponding order of creation and have a look at the corresponding example [here](files/image/setup/run.always/01-configure-backup.py).\n\n### Health scripts\n\n#### Liveness\n\nThe centrally implemented health liveness scripts and their extensions within the subfolder regularly check the current status of the corresponding process application and whether it is still active accordingly. The intensity of the check can be configured via the ```IMAGE_HEALTH_CRON``` environment variable and define the execution interval of the health checks. Normally the corresponding supervisor application manages the app, but it's also possible to enable the on-top readiness checks via the ```IMAGE_HEALTH_LIVENESS_CHECK_ENABLED=\"true\"``` env variable. The default value of that option is ```false```. If you enabled that opportunity on top of supervisor, it's possible to define a custom log file of the execution process of the cron job. You can define the ```IMAGE_HEALTH_LIVENESS_LOG``` env variable to set your favorite log file. To use that complete functionality it's necessary to enable and set up the cron application (default setting).\n\n#### Readiness\n\nFurthermore, in this context, the already implemented health readiness scripts are located in the same directory structure. These scripts can directly query the current status of the corresponding application using the extensions to be created within the subfolder and, for example, trigger an API call to a connected health interface. The intensity of the check can be also configured via the ```IMAGE_HEALTH_CRON``` environment variable and define the execution interval of booth health checks. It's only possible to define one value for both checks (if both are enabled). Another configuration parameter is the env variable ```IMAGE_HEALTH_READINESS_FORCE_REBOOT=\"true\"``` and it defines the reboot of the application if the health point not available. It's necessary to set the value to ```true``` or ```false```, the corresponding default value is ```true```. It's possible to define a custom log file of the execution process of the corresponding cron job. You can define the ```IMAGE_HEALTH_READINESS_LOG``` env variable to set your favorite log file. To use that complete functionality it's necessary to enable and set up the cron application (default setting).\n\n### Logging\n\nWithin this folder, the global settings of Filebeat and Logrotate can be adjusted. Furthermore, it is possible to override the global settings by configuration files (within the configuration files in the subfolder) and to integrate corresponding applications into the circuit of the two applications. A special feature in this context is the default configuration of Filebeat. Here the appropriate settings were selected in such a way that all logs within the Supervisor folder are passed on according to the configuration set before by the two mostly in the Deployment defined parameters(`LOGGING_REDIS_HOST` and `LOGGING_REDIS_PASSWORD`) centrally (The Redis scenario acts for this as cache).\n\n### Restore\n\nThe restore folder structure contains the counterpart to the backup structure and can be equipped with its own scripts inside the subfolder. These scripts can be used to customize the restore process and to rebuild the saved files.\n\n### Secrets\n\nThe secret folder has the purpose of storing required secrets centrally.\n\n### Setup scripts\n\n#### Run always\n\nWithin this folder scripts can be created, which are executed at a container start and which should carry out corresponding initializations or configurations within the container. Furthermore, the configuration of the backup cron job and logrotate is carried out by default. A further point is the backup, examination, and embedding of the environment within the configuration folder. The integration of this created file within the backup and lograte cron entry is also done within this directory structure.\n\n#### Run once (normally on the first container start)\n\nIn this folder, scripts can be created which are to be executed once during a container start and which are to carry out corresponding initializations or configurations within the container. After the scripts have been executed, a corresponding shadow file is created and checked accordingly when the container is started again and as a result, the execution of the scripts is skipped.\n\n### Supervisor\n\nThe supervisor daemon enables the central control and monitoring of the appropriately configured applications. A special aspect is the control and renewal of the application after an internal error or shutdown of the functions. This functionality is supported and controlled by various functions, e.g. the regular execution of health scripts. Furthermore, the supervisord process writes the corresponding process ID and the state of all configured applications inside the ```/tmp``` directory.\n\n## Architecture overview \u0026 process flow\n\nThe starting point of the overlay system is the file [run.py](files/run.py). Within this file, all appropriate files are controlled and executed within subprocesses (apart from the supervisord process). In this context, the file [utils.py](files/image/utils.py) represents a collection of centrally needed auxiliary methods, which can be used within all scripts after the appropriate integration. The process flow can be seen in the graphic below.\n\n![process-container-manager](doc/images/process-container-manager.png)\n\n## Examples\n\nInside the [example](examples) folder you will find different configuration ideas and files from my productive containers. The configuration files should give you some ideas of what is possible with this construction and can be completed by your suggestions. The structure inside this folder is the same as you can find inside the container.\n\n## Contribution\n\nIf you would like to contribute a sample script [here](examples), have an improvement request, or want to make a change inside the code, please open a pull request.\n\n## Support\n\nIf you need support, or you encounter a bug, please don't hesitate to open an issue.\n\n## Donations\n\nIf you want to support my work, I ask you to take an unusual action inside the open source community. Donate the money to a non-profit organization like Doctors Without Borders or the Children's Cancer Aid. I will continue to build tools because I like them, and I am passionate about developing and sharing applications.\n\n## License\n\nThis product is available under the Apache 2.0 [license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzpascal%2Fcontainer-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzpascal%2Fcontainer-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzpascal%2Fcontainer-manager/lists"}