-
Notifications
You must be signed in to change notification settings - Fork 0
compose: increase zram at runtime #276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -284,6 +284,48 @@ services: | |||||||||||||||||||||||||
| CLOUDFLARE_DNS_ZONE: product-os.io | ||||||||||||||||||||||||||
| ROBOT_API: https://robot-ws.your-server.de | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| zram: | ||||||||||||||||||||||||||
| image: docker:27.3.1-cli-alpine3.20 | ||||||||||||||||||||||||||
| restart: no | ||||||||||||||||||||||||||
| labels: | ||||||||||||||||||||||||||
| io.balena.features.balena-socket: '1' | ||||||||||||||||||||||||||
| entrypoint: | ||||||||||||||||||||||||||
| - /bin/sh | ||||||||||||||||||||||||||
| - -c | ||||||||||||||||||||||||||
| environment: | ||||||||||||||||||||||||||
| ENABLED: true | ||||||||||||||||||||||||||
| ZRAM_PCT: 50 | ||||||||||||||||||||||||||
| ZRAM_ALGO: lz4 | ||||||||||||||||||||||||||
| command: | ||||||||||||||||||||||||||
| - | | ||||||||||||||||||||||||||
| set -e | ||||||||||||||||||||||||||
| [[ $ENABLED == 'true' ]] || exit | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| HOST_CONTAINER_NAME=host-chroot | ||||||||||||||||||||||||||
| stop_container() { docker stop "$(docker ps -qf "NAME=$HOST_CONTAINER_NAME")"; } | ||||||||||||||||||||||||||
| trap stop_container EXIT | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| host_cmd() { | ||||||||||||||||||||||||||
| if [ -z "$(docker ps -qf "NAME=$HOST_CONTAINER_NAME")" ]; then | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| if [ -z "$(docker ps -qf "NAME=$HOST_CONTAINER_NAME")" ]; then | |
| stop_container() { docker stop "$(docker ps -qf "name=$HOST_CONTAINER_NAME")"; } | |
| trap stop_container EXIT | |
| host_cmd() { | |
| if [ -z "$(docker ps -qf "name=$HOST_CONTAINER_NAME")" ]; then |
Copilot
AI
Aug 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docker filter syntax is incorrect. The NAME filter should use name instead of NAME: docker ps -qf "name=$HOST_CONTAINER_NAME"
| if [ -z "$(docker ps -qf "NAME=$HOST_CONTAINER_NAME")" ]; then | |
| stop_container() { docker stop "$(docker ps -qf "name=$HOST_CONTAINER_NAME")"; } | |
| trap stop_container EXIT | |
| host_cmd() { | |
| if [ -z "$(docker ps -qf "name=$HOST_CONTAINER_NAME")" ]; then |
Copilot
AI
Aug 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The --tty=true flag is unnecessary for a detached container that will only receive exec commands. Remove this flag to simplify the configuration.
| --tty=true \ |
Copilot
AI
Aug 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docker filter syntax is incorrect. The NAME filter should use name instead of NAME: docker ps -qf "name=$HOST_CONTAINER_NAME"
| HOST_CONTAINER_ID="$(docker ps -qf "NAME=$HOST_CONTAINER_NAME")" | |
| HOST_CONTAINER_ID="$(docker ps -qf "name=$HOST_CONTAINER_NAME")" |
Copilot
AI
Aug 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variables $ZRAM_PCT and $ZRAM_ALGO are not validated before use in shell commands, which could lead to command injection. Add validation to ensure they contain only expected values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using bash-specific syntax
[[ ]]in a shell script that starts with/bin/sh. Use POSIX-compliant[ ]instead:[ "$ENABLED" = 'true' ] || exit