Skip to content

Commit 3fa64f7

Browse files
committed
remove assumption user ID is 1000
On menu.sh start, store current UID and GID to .env, if they are missing. Use these to run services that use a customized user.
1 parent 8a930eb commit 3fa64f7

File tree

27 files changed

+118
-77
lines changed

27 files changed

+118
-77
lines changed

.bash_aliases

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
alias iotstack_up="docker-compose -f ~/IOTstack/docker-compose.yml up -d"
2-
alias iotstack_down="docker-compose -f ~/IOTstack/docker-compose.yml down"
3-
alias iotstack_start="docker-compose -f ~/IOTstack/docker-compose.yml start"
4-
alias iotstack_stop="docker-compose -f ~/IOTstack/docker-compose.yml stop"
5-
alias iotstack_update="docker-compose -f ~/IOTstack/docker-compose.yml pull"
6-
alias iotstack_build="docker-compose -f ~/IOTstack/docker-compose.yml build"
7-
1+
COMPOSE_FILE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/docker-compose.yml"
2+
alias iotstack_up="docker-compose -f "$COMPOSE_FILE" up -d --build --remove-orphans"
3+
alias iotstack_down="docker-compose -f "$COMPOSE_FILE" down"
4+
alias iotstack_start="docker-compose -f "$COMPOSE_FILE" start"
5+
alias iotstack_stop="docker-compose -f "$COMPOSE_FILE" stop"
6+
alias iotstack_pull="docker-compose -f "$COMPOSE_FILE" pull"
7+
alias iotstack_build="docker-compose -f "$COMPOSE_FILE" build --pull --no-cache"
8+
alias iotstack_update="iotstack_pull && iotstack_build && iotstack up"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
/.tmp/*
66
__pycache__
77
docker-compose.yml
8+
docker-compose.override.yml
89
compose-override.yml
10+
.env
911
postbuild.sh
1012
pre_backup.sh
1113
post_backup.sh

.templates/blynk_server/service.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ blynk_server:
77
restart: unless-stopped
88
environment:
99
- TZ=Etc/UTC
10-
- IOTSTACK_UID=1000
11-
- IOTSTACK_GID=1000
10+
- IOTSTACK_UID=${IOTSTACK_UID:?IOTSTACK_UID must be defined in ~/IOTstack/.env}
11+
- IOTSTACK_GID=${IOTSTACK_GID:?IOTSTACK_GID must be defined in ~/IOTstack/.env}
1212
ports:
1313
- "8180:8080"
1414
- "8440:8440"

.templates/domoticz/service.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ domoticz:
1010
restart: unless-stopped
1111
network_mode: bridge
1212
environment:
13-
- PUID=1000
14-
- PGID=1000
13+
- PUID=${IOTSTACK_UID:?IOTSTACK_UID must be defined in ~/IOTstack/.env}
14+
- PGID=${IOTSTACK_GID:?IOTSTACK_GID must be defined in ~/IOTstack/.env}
1515
# - TZ=
1616
# - WEBROOT=domoticz
1717

.templates/gitea/service.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ gitea:
66
- "7920:3000/tcp"
77
- "2222:22/tcp"
88
environment:
9-
- USER_UID=1000
10-
- USER_GID=1000
9+
- USER_UID=${IOTSTACK_UID:?IOTSTACK_UID must be defined in ~/IOTstack/.env}
10+
- USER_GID=${IOTSTACK_GID:?IOTSTACK_GID must be defined in ~/IOTstack/.env}
1111
volumes:
1212
- ./volumes/gitea/data:/data
1313
- /etc/timezone:/etc/timezone:ro

.templates/heimdall/service.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ heimdall:
22
image: ghcr.io/linuxserver/heimdall
33
container_name: heimdall
44
environment:
5-
- PUID=1000
6-
- PGID=1000
5+
- PUID=${IOTSTACK_UID:?IOTSTACK_UID must be defined in ~/IOTstack/.env}
6+
- PGID=${IOTSTACK_GID:?IOTSTACK_GID must be defined in ~/IOTstack/.env}
77
- TZ=Europe/Paris
88
volumes:
99
- ./volumes/heimdall/config:/config

.templates/homebridge/service.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ homebridge:
44
restart: unless-stopped
55
environment:
66
- TZ=Etc/UTC
7-
- PGID=1000
8-
- PUID=1000
7+
- PGID=${IOTSTACK_GID:?IOTSTACK_GID must be defined in ~/IOTstack/.env}
8+
- PUID=${IOTSTACK_UID:?IOTSTACK_UID must be defined in ~/IOTstack/.env}
99
- HOMEBRIDGE_CONFIG_UI=1
1010
- HOMEBRIDGE_CONFIG_UI_PORT=8581
1111
volumes:

.templates/homer/service.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ homer:
22
image: b4bz/homer:latest
33
container_name: homer
44
environment:
5-
- UID=1000
6-
- GID=1000
5+
- UID=${IOTSTACK_UID:?IOTSTACK_UID must be defined in ~/IOTstack/.env}
6+
- GID=${IOTSTACK_GID:?IOTSTACK_GID must be defined in ~/IOTstack/.env}
77
volumes:
88
- ./volumes/homer/assets:/www/assets
99
ports:

.templates/mariadb/service.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ mariadb:
33
container_name: mariadb
44
environment:
55
- TZ=Etc/UTC
6-
- PUID=1000
7-
- PGID=1000
6+
- PUID=${IOTSTACK_UID:?IOTSTACK_UID must be defined in ~/IOTstack/.env}
7+
- PGID=${IOTSTACK_GID:?IOTSTACK_GID must be defined in ~/IOTstack/.env}
88
- MYSQL_ROOT_PASSWORD=%randomAdminPassword%
99
- MYSQL_DATABASE=default
1010
- MYSQL_USER=mariadbuser

.templates/n8n/service.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ n8n:
2121
# - N8N_BASIC_AUTH_ACTIVE=true
2222
# - N8N_BASIC_AUTH_USER=<USER>
2323
# - N8N_BASIC_AUTH_PASSWORD=<PASSWORD>
24-
25-
# - PGID=1000
26-
# - PUID=1000
27-
# - USBDEVICES=/dev/ttyAMA0
28-
# - PACKAGES=mc
24+
#
25+
# - PGID=${IOTSTACK_GID:?IOTSTACK_GID must be defined in ~/IOTstack/.env}
26+
# - PUID=${IOTSTACK_UID:?IOTSTACK_UID must be defined in ~/IOTstack/.env}
27+
# - USBDEVICES=/dev/ttyAMA0
28+
# - PACKAGES=mc
2929

0 commit comments

Comments
 (0)