Skip to content

Commit 9808173

Browse files
olemartinorgOle Martin Handeland
andauthored
Podman: Mounting volumes with z to work around permission issues (#80)
* Mounting volumes in readOnly shared mode to work around permission issues * Adding hack back * Changing volume format --------- Co-authored-by: Ole Martin Handeland <git@olemartin.org>
1 parent 1d23de2 commit 9808173

File tree

3 files changed

+5
-34
lines changed

3 files changed

+5
-34
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ podman-compose-start-localtest:
2121
.PHONY: podman-compose-stop-localtest
2222
podman-compose-stop-localtest:
2323
podman-compose --file podman-compose.yml down
24-
2524

2625
.PHONY: podman-selinux-bind-hack
2726
podman-selinux-bind-hack:

README.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -218,22 +218,6 @@ This would be required if your app requires a role which none of the test users
218218

219219
### Known issues
220220

221-
#### Bind mounts folders gives permission denied. Nginx returns default page
222-
223-
On some nix systems you might experience problems with the bind mounts used by the containers. If you get the default nginx page when trying to access local.altinn.cloud this might be the case.
224-
225-
To verify this you can run the following command:
226-
227-
```shell
228-
podman container exec -it localtest-loadbalancer cat /etc/nginx/templates/nginx.conf.conf
229-
```
230-
231-
if you get a permission denied message this verifies that the bind mount is not working. A best effort fix for this is to run the following command:
232-
233-
```shell
234-
make podman-selinux-bind-hack
235-
```
236-
237221
#### Localtest reports that the app is not running even though it is
238222

239223
If localtest and you app is running, but localtest reports that the app is not running, it might be that the port is not open in the firewall.

podman-compose.yml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,8 @@ services:
2525
- NGINX_ENVSUBST_OUTPUT_DIR=/etc/nginx/
2626
- NGINX_ENVSUBST_TEMPLATE_SUFFIX=.conf
2727
volumes:
28-
- type: bind
29-
source: ./loadbalancer/templates/
30-
target: /etc/nginx/templates/
31-
read_only: true
32-
- type: bind
33-
source: ./loadbalancer/www/
34-
target: /www/
35-
read_only: true
36-
28+
- ./loadbalancer/templates/:/etc/nginx/templates/:ro,z
29+
- ./loadbalancer/www/:/www/:ro,z
3730

3831
altinn_platform_pdf:
3932
container_name: altinn-pdf
@@ -44,6 +37,7 @@ services:
4437
- altinntestlocal_network
4538
ports:
4639
- "5070:5070"
40+
4741
altinn_pdf_service:
4842
container_name: altinn-pdf-service
4943
image: browserless/chrome:1-puppeteer-19.2.2
@@ -69,14 +63,8 @@ services:
6963
- GeneralSettings__BaseUrl=http://${TEST_DOMAIN:-local.altinn.cloud}:${ALTINN3LOCAL_PORT:-8000}
7064
- GeneralSettings__HostName=${TEST_DOMAIN:-local.altinn.cloud}
7165
volumes:
72-
- type: volume
73-
source: AltinnPlatformLocal
74-
target: /AltinnPlatformLocal/
75-
read_only: false
76-
- type: bind
77-
source: ./testdata/
78-
target: /testdata/
79-
read_only: true
66+
- ./testdata/:/testdata/:ro,z
67+
- AltinnPlatformLocal:/AltinnPlatformLocal/:rw
8068

8169
volumes:
8270
AltinnPlatformLocal:

0 commit comments

Comments
 (0)