Skip to content

Commit ce76f97

Browse files
authored
Revert "Remove UID hack (#519)"
This reverts commit 76819b5.
1 parent 76819b5 commit ce76f97

File tree

8 files changed

+36
-2
lines changed

8 files changed

+36
-2
lines changed

base/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ARG \
4040
MARIADB_CLIENT_VERSION=11.4.8-r0 \
4141
# renovate: datasource=repology depName=alpine_3_22/mysql-client
4242
MYSQL_CLIENT_VERSION=11.4.8-r0 \
43-
# renovate: datasource=repology depName=alpine_3_22/netcat-openbsd
43+
# renovate: datasource=repology depName=alpine_3_22/netcat-openbsd
4444
NETCAT_OPENBSD_VERSION=1.229.1-r0 \
4545
# renovate: datasource=repology depName=alpine_3_22/openssl
4646
OPENSSL_VERSION=3.5.4-r0 \
@@ -161,7 +161,9 @@ ENV \
161161
DB_ROOT_PASSWORD=password \
162162
DB_ROOT_USER=root \
163163
DB_USER=default \
164-
JWT_ADMIN_TOKEN=islandora
164+
DEVELOPMENT_ENVIRONMENT=false \
165+
JWT_ADMIN_TOKEN=islandora \
166+
UID=
165167

166168
COPY --link rootfs /
167169

base/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,16 @@ and `DB_MYSQL_PORT` variables will be used when connecting to the backend.
122122
> `FCREPO_DB_NAME`. This is to allow for different settings on a per-service
123123
> basis when sharing the same confd backend.
124124
125+
### Development Settings
126+
127+
When doing development with the containers it is sometimes useful to remap the
128+
`uid` of users in the container to match that of the host user to prevent
129+
permission denied errors when bind mounting files.
130+
131+
| Environment Variable | Default | Description |
132+
| :---------------------- | :------ | :-------------------------------------------------------------------------------------------------------------------------------- |
133+
| DEVELOPMENT_ENVIRONMENT | false | Set to `true` if using the containers for development, runs start up scripts to remap `uid` of users inside of the container etc. |
134+
| UID | | The `uid` of the host user |
125135

126136
[Alpine Linux]: https://alpinelinux.org
127137
[bearer authentication]: https://tools.ietf.org/html/rfc6750

drupal/rootfs/etc/s6-overlay/s6-rc.d/confd-oneshot/dependencies.d/development-environment

Whitespace-only changes.

drupal/rootfs/etc/s6-overlay/s6-rc.d/development-environment/dependencies.d/container-environment

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oneshot
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Change uid of nginx user to match host.
2+
/etc/s6-overlay/scripts/development-environment.sh

drupal/rootfs/etc/s6-overlay/s6-rc.d/ready/dependencies.d/development-environment

Whitespace-only changes.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/command/with-contenv bash
2+
# shellcheck shell=bash
3+
set -e
4+
5+
# UID should only be set in the development environments.
6+
if [[ "${DEVELOPMENT_ENVIRONMENT}" == "true" ]]; then
7+
if [[ -n "${UID}" ]]; then
8+
if ! getent passwd ${UID}; then
9+
usermod -u ${UID} nginx
10+
fi
11+
if [[ "$(stat -c %u /var/www/drupal)" != "${UID}" ]]; then
12+
chown -R nginx:nginx /var/www
13+
fi
14+
fi
15+
fi
16+
17+
# always ensure nginx has access to the socket
18+
chown -R nginx:nginx /run/php-fpm83
19+

0 commit comments

Comments
 (0)