{"id":22367701,"url":"https://github.com/hugojosefson/incus-app-container","last_synced_at":"2025-07-30T17:33:04.171Z","repository":{"id":225234910,"uuid":"765343204","full_name":"hugojosefson/incus-app-container","owner":"hugojosefson","description":"Opinionated script for creating Incus containers for apps.","archived":false,"fork":false,"pushed_at":"2024-07-09T18:26:52.000Z","size":258,"stargazers_count":3,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-09-17T01:21:30.823Z","etag":null,"topics":["container","containers","debian","docker","docker-compose","incus","lxc","lxd","truenas","truenas-scale"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hugojosefson.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}},"created_at":"2024-02-29T18:30:32.000Z","updated_at":"2024-08-29T15:40:21.000Z","dependencies_parsed_at":"2024-03-05T18:26:52.023Z","dependency_job_id":"fa5e7f55-358a-44d6-a183-55605e3eaec1","html_url":"https://github.com/hugojosefson/incus-app-container","commit_stats":null,"previous_names":["hugojosefson/incus-app-container"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugojosefson%2Fincus-app-container","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugojosefson%2Fincus-app-container/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugojosefson%2Fincus-app-container/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugojosefson%2Fincus-app-container/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hugojosefson","download_url":"https://codeload.github.com/hugojosefson/incus-app-container/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228165312,"owners_count":17879243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","containers","debian","docker","docker-compose","incus","lxc","lxd","truenas","truenas-scale"],"created_at":"2024-12-04T18:20:23.184Z","updated_at":"2024-12-04T18:20:23.684Z","avatar_url":"https://github.com/hugojosefson.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# incus-app-container\n\nOpinionated script for creating Incus containers for apps.\n\n| 🚧️👷 Under construction 👷🚧️ |\n| ---------------------------- |\n\nI see this as a successor to my\n[proxmox-create-docker-ct](https://github.com/hugojosefson/proxmox-create-docker-ct),\nthat did a similar thing for Proxmox VE.\n\n## My use case / Features included\n\n- [x] You have an `apps` directory on the TrueNAS SCALE server.\n- [x] Each container/app:\n  - [x] Has a subdirectory in `apps`, with the app's name.\n    - [x] It has a subdirectory `appdata` inside it, for the app's data.\n      - [x] It contains the app's `docker-compose.yml` file.\n      - [x] It is bind mounted inside the container as `/appdata`.\n  - [x] Has `docker-compose` installed, and runs the app via its\n        `/appdata/docker-compose.yml`.\n  - [x] Watches the `docker-compose.yml` file for changes, and restarts the app\n        when it changes.\n  - [x] Is exposed on the network with a static IP, or DHCP.\n- [x] CLI script(s) to easily create a new container/app.\n  - [x] Sets up a new subdirectory in `apps`.\n  - [x] Puts an example `docker-compose.yml` into the new subdirectory's\n        `appdata` directory.\n  - [x] Creates a new container with:\n    - [x] a static IP, or DHCP;\n    - [x] the new subdirectory as the bind mount;\n    - [x] automatic updates of os packages;\n    - [x] automatic updates of docker images;\n  - [x] Starts the container (optionally).\n- [x] The containers I create are compatible with Incus' normal tools, and with\n      `incus-ui-canonical`.\n\n\u003cdetails\u003e\n\u003csummary\u003e...or maybe...? (click to expand)\u003c/summary\u003e\n\n- [ ] Put each app's configuration (ip(s), extra bind-mounts, image, etc) in a\n      `\u003cappName\u003e/incus-app-container.yml` file in the app's subdirectory.\n- [x] The app container has a subdirectory `\u003cappName\u003e/appdata/` mounted as\n      `/appdata` inside the container, so it can't reach its own configuration.\n- [ ] No scripts to run, just an always running container (or service?) that\n      watches the `apps/` directory and `incus-app-container.yml` files for\n      changes, and:\n  - [ ] creates+starts new incus app containers for each new subdirectory it\n        finds with an `incus-app-container.yml` file,\n  - [ ] relies on an `apps/incus-app-container.tf` file to be written such that\n        it dynamically creates/updates/deletes incus app container resources for\n        only each subdirectory it finds with an `incus-app-container.yml` file,\n  - [ ] watches incus for changes with\n        `incus monitor --type=lifecycle --type=operation --format=json`\n  - [ ] when `incus monitor` reports anything:\n    - [ ] `tofu apply -auto-approve -compact-warnings -concise`\n- [ ] The service keeps track of its own containers via OpenTofu's state, stored\n      in `apps/incus-app-container.tfstate`.\n- [ ] The service brands its containers with an empty\n      [profile](https://linuxcontainers.org/incus/docs/main/profiles/) on them,\n      so the user can see clearly which containers are owned by\n      `incus-app-container`.\n- [x] ~~Each `docker-compose.yml` is by default prepared with a service that\n      keeps its docker images up to date. It's a third-party tool, called\n      [Watchtower](https://containrrr.dev/watchtower/).~~\n- [x] Updates the images automatically, using Podman's built-in image updater.\n- [x] Inside each incus app container, there's a service that watches the\n      `docker-compose.yml` file for changes, and reloads the app when it\n      changes.\n\n\u003c/details\u003e\n\n## Prerequisites\n\n- A working server with one of\n  - TrueNAS SCALE 23.10.2 or later, or\n  - Debian 12.5 or later.\n- `root` access on the server.\n- One empty block device for the storage pool.\n- An existing bridge network interface, for the containers to use, or a network\n  interface in `/etc/network/interfaces` with `dhcp`, that we can convert.\n- A subnet or several, to expose the containers on.\n\n## Install incus-app-container\n\n```sh\ncurl -sSfL https://github.com/hugojosefson/incus-app-container/tarball/main \\\n  | tar -xzv --wildcards \"*/src/\" --strip-components=2\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eUtils for testing inside an incus container (click to expand)\u003c/summary\u003e\n\n```sh\n# watch running docker containers\nwatch -n0.2 docker ps\n```\n\n```sh\n# watch the processes inside the container\nwatch -n0.2 'ps -ef | grep -v \"ps -ef\"'\n```\n\n```sh\n# run the watchdog manually\nservice docker-compose-watchdog stop\ndocker-compose-watchdog\n```\n\n```sh\n# ask the watchdog to stop\nkillall -HUP docker-compose-watchdog\n```\n\n\u003c/details\u003e\n\n## Install incus\n\n```sh\n./incus-app-container setup-incus --help\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugojosefson%2Fincus-app-container","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhugojosefson%2Fincus-app-container","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugojosefson%2Fincus-app-container/lists"}