Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Vertx: Permission denied creating /.m2 on Openshift #853

Open
matthewpwilson opened this issue Sep 3, 2020 · 0 comments
Open

Vertx: Permission denied creating /.m2 on Openshift #853

matthewpwilson opened this issue Sep 3, 2020 · 0 comments

Comments

@matthewpwilson
Copy link
Contributor

matthewpwilson commented Sep 3, 2020

Describe the bug
When running Appsody on OpenShift and setting APPSODY_K8S_EXPERIMENTAL, an error occurs during appsody init while creating /.m2.

To Reproduce
Steps to reproduce the behavior:

  1. Create an image containing Buildah and Appsody.
  2. Deploy it on OpenShift.
  3. Set APPSODY_K8S_EXPERIMENTAL=TRUE
  4. Run appsody init experimental/vertx.

Expected behavior
Init succeeds without warnings.

Actual behaviour
The following warning occurs:

[Debug] Logging to file /home/java_user/.appsody/logs/appsody2020-08-21T14-17-53.947967996.log
[Debug] Writing config file /home/java_user/.appsody/.appsody.yaml
[Debug] Running with command line args: appsody init hub0/vertx  --project-name vertxstack --application-name vertxstack -v
[Debug] Downloading appsody repository index from https://github.com/appsody/stacks/releases/latest/download/incubator-index.yaml
[Debug] Proxy function for HTTP transport set to: 0xc0001ba730
[Debug] Downloading appsody repository index from https://github.com/appsody/stacks/releases/latest/download/experimental-index.yaml
[Debug] Proxy function for HTTP transport set to: 0xc0000bc2b0
[Debug] Downloading appsody repository index from https://github.com/appsody/stacks/releases/download/nodejs-v0.4.0/experimental-index.yaml
[Debug] Proxy function for HTTP transport set to: 0xc0000bc4f0
[Debug] Downloading appsody repository index from https://github.com/kabanero-io/kabanero-stack-hub/releases/latest/download/kabanero-stack-hub-index.yaml
[Debug] Proxy function for HTTP transport set to: 0xc0001ba4f0
[Debug] Fully qualified stack... determining repo...
[Debug] Attempting to locate stack vertx in repo hub0
[Debug] Stack vertx found in repo hub0
[Debug] It is safe to extract the project template
[Debug] Project config file set to: /opt/code-engine/generated-code/cpa-microservice20200821021753853968/.appsody-config.yaml
[Info] No stack requirements set. Skipping...
[Info] Running appsody init...
[Info] Downloading vertx template project from https://github.com/appsody/stacks/releases/download/vertx-v0.1.4/experimental.vertx.v0.1.4.templates.default.tar.gz
[Debug] Proxy function for HTTP transport set to: 0xc0001badf0
[Info] Download complete. Extracting files from /opt/code-engine/generated-code/cpa-microservice20200821021753853968/vertx.tar.gz
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/pom.xml
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/src
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/src/main
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/src/main/java
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/src/main/java/org
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/src/main/java/org/acme
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/src/main/java/org/acme/quickstart
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/src/main/java/org/acme/quickstart/HttpApplication.java
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/src/main/resources
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/src/main/resources/webroot
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/src/main/resources/webroot/index.html
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/src/test
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/src/test/java
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/src/test/java/org
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/src/test/java/org/acme
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/src/test/java/org/acme/quickstart
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/src/test/java/org/acme/quickstart/HttpApplicationTest.java
[Debug] Untar creating /opt/code-engine/generated-code/cpa-microservice20200821021753853968/.appsody-config.yaml
[Info] Setting up the development environment
[Debug] Project stack before override: appsody/vertx:0.1
[Debug] Image repository in the appsody config file: docker.io
[Debug] Project stack after override:  is: docker.io/appsody/vertx:0.1
[Info] Your Appsody project name has been set to vertxstack
[Info] Your Appsody application name has been set to vertxstack
[Debug] Setting up the development environment for projectDir: /opt/code-engine/generated-code/cpa-microservice20200821021753853968 and platform: docker.io/appsody/vertx:0.1
[Debug] docker.io/appsody/vertx:0.1 image pulled status: false
[Debug] Pull policy Always
[Info] Pulling docker image docker.io/appsody/vertx:0.1
[Info] Running command: buildah pull docker.io/appsody/vertx:0.1
[Info] fd114a0db6518994b64f337ffe8f376af2f07d773a51a021b61ad996a0cc096a
[Debug] Number of environment variables in stack image: 20
[Debug] All environment variables in stack image: [PATH=/opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 JAVA_VERSION=jdk8u222-b10_openj9-0.15.1 JAVA_HOME=/opt/java/openjdk JAVA_TOOL_OPTIONS=-XX:+IgnoreUnrecognizedVMOptions -XX:+UseContainerSupport -XX:+IdleTuningCompactOnIdle -XX:+IdleTuningGcOnIdle APPSODY_USER_RUN_AS_LOCAL=true APPSODY_MOUNTS=.:/project/user-app/;~/.m2/repository:/.m2/repository APPSODY_DEPS= APPSODY_RUN=mvn -B compile vertx:run APPSODY_RUN_ON_CHANGE= APPSODY_RUN_KILL=false APPSODY_DEBUG=mvn -B compile vertx:debug APPSODY_DEBUG_ON_CHANGE= APPSODY_DEBUG_KILL=false APPSODY_TEST=mvn -B test APPSODY_TEST_ON_CHANGE=mvn -B test APPSODY_TEST_KILL=true PORT=8080]
[Debug] Could not find env var: APPSODY_PROJECT_DIR
[Warning] The stack image does not contain APPSODY_PROJECT_DIR. Using /project
[Info] Extracting project from development environment
[Debug] Checking if target-dir exists: /opt/code-engine/generated-code/cpa-microservice20200821021753853968/.appsody_init
[Debug] docker.io/appsody/vertx:0.1 image pulled status: true
[Debug] Image has been pulled already: docker.io/appsody/vertx:0.1
[Debug] docker.io/appsody/vertx:0.1 image pulled status: true
[Debug] Image has been pulled already: docker.io/appsody/vertx:0.1
[Debug] Number of environment variables in stack image: 20
[Debug] All environment variables in stack image: [PATH=/opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 JAVA_VERSION=jdk8u222-b10_openj9-0.15.1 JAVA_HOME=/opt/java/openjdk JAVA_TOOL_OPTIONS=-XX:+IgnoreUnrecognizedVMOptions -XX:+UseContainerSupport -XX:+IdleTuningCompactOnIdle -XX:+IdleTuningGcOnIdle APPSODY_USER_RUN_AS_LOCAL=true APPSODY_MOUNTS=.:/project/user-app/;~/.m2/repository:/.m2/repository APPSODY_DEPS= APPSODY_RUN=mvn -B compile vertx:run APPSODY_RUN_ON_CHANGE= APPSODY_RUN_KILL=false APPSODY_DEBUG=mvn -B compile vertx:debug APPSODY_DEBUG_ON_CHANGE= APPSODY_DEBUG_KILL=false APPSODY_TEST=mvn -B test APPSODY_TEST_ON_CHANGE=mvn -B test APPSODY_TEST_KILL=true PORT=8080]
[Debug] Could not find env var: APPSODY_PROJECT_DIR
[Warning] The stack image does not contain APPSODY_PROJECT_DIR. Using /project
[Debug] Container project dir: /project
[Debug] Environment variable found cached: APPSODY_MOUNTS Value: .:/project/user-app/;~/.m2/repository:/.m2/repository
[Debug] Checking for existence of local file or directory to mount: /opt/code-engine/generated-code/cpa-microservice20200821021753853968/
[Debug] Path /opt/code-engine/generated-code/cpa-microservice20200821021753853968/ for mount is a directory
[Debug] Checking for existence of local file or directory to mount: /home/java_user/.m2/repository
[Debug] Path /home/java_user/.m2/repository for mount is a directory
[Debug] Mapped mount args: [-v /opt/code-engine/generated-code/cpa-microservice20200821021753853968/:/project/user-app -v /home/java_user/.m2/repository:/.m2/repository]
[Info] Running command: buildah from --name vertxstack-extract -v /opt/code-engine/generated-code/cpa-microservice20200821021753853968/:/project/user-app -v /home/java_user/.m2/repository:/.m2/repository docker.io/appsody/vertx:0.1
[Debug] vertxstack-extract
[Debug] About to run buildah with args [mount vertxstack-extract] 
[Debug] Output of buildah mount command: /home/java_user/.local/share/containers/storage/overlay/a80eb77719bc248bdbda85ac696a447b93680ffd46e4e693efac28b47bfb21c1/merged
[Debug] About to run: cp[-rf /home/java_user/.local/share/containers/storage/overlay/a80eb77719bc248bdbda85ac696a447b93680ffd46e4e693efac28b47bfb21c1/merged/project /home/java_user/.appsody/extract/vertxstack]
[Debug] Directory copy of /home/java_user/.local/share/containers/storage/overlay/a80eb77719bc248bdbda85ac696a447b93680ffd46e4e693efac28b47bfb21c1/merged/project to /home/java_user/.appsody/extract/vertxstack was successful 

[Debug] Appsody mount: /opt/code-engine/generated-code/cpa-microservice20200821021753853968/:/project/user-app
[Debug] Local-adjusted mount destination: /home/java_user/.appsody/extract/vertxstack/user-app
[Debug] Deleting dest: /home/java_user/.appsody/extract/vertxstack/user-app
[Debug] Running mkdir /home/java_user/.appsody/extract/vertxstack
[Debug] Copy source: /opt/code-engine/generated-code/cpa-microservice20200821021753853968/
[Debug] Copy destination: /home/java_user/.appsody/extract/vertxstack/user-app
[Debug] About to run: cp[-rf /opt/code-engine/generated-code/cpa-microservice20200821021753853968/ /home/java_user/.appsody/extract/vertxstack/user-app]
[Debug] Directory copy of /opt/code-engine/generated-code/cpa-microservice20200821021753853968/ to /home/java_user/.appsody/extract/vertxstack/user-app was successful 

[Debug] Copied /opt/code-engine/generated-code/cpa-microservice20200821021753853968/ to /home/java_user/.appsody/extract/vertxstack/user-app
[Debug] Appsody mount: /home/java_user/.m2/repository:/.m2/repository
[Debug] Local-adjusted mount destination: /.m2/repository
[Debug] Running mkdir /.m2
[Info] Running command: buildah rm vertxstack-extract
[Debug] 8b929e7a06205a631edbd13b685cede814efe6ce20c047a26995d2a647505ab4
[Warning] The stack init script failed: Error creating directories /home/java_user/.appsody/extract/vertxstack: mkdir /.m2: permission denied

Error creating directories /home/java_user/.appsody/extract/vertxstack: mkdir /.m2: permission denied
github.com/appsody/appsody/cmd.extract
    /home/travis/gopath/src/github.com/appsody/appsody/cmd/extract.go:273
github.com/appsody/appsody/cmd.extractAndInitialize
    /home/travis/gopath/src/github.com/appsody/appsody/cmd/init.go:611
github.com/appsody/appsody/cmd.install
    /home/travis/gopath/src/github.com/appsody/appsody/cmd/init.go:384
github.com/appsody/appsody/cmd.initAppsody
    /home/travis/gopath/src/github.com/appsody/appsody/cmd/init.go:293
github.com/appsody/appsody/cmd.newInitCmd.func1
    /home/travis/gopath/src/github.com/appsody/appsody/cmd/init.go:85
github.com/appsody/appsody/vendor/github.com/spf13/cobra.(*Command).execute
    /home/travis/gopath/src/github.com/appsody/appsody/vendor/github.com/spf13/cobra/command.go:762
github.com/appsody/appsody/vendor/github.com/spf13/cobra.(*Command).ExecuteC
    /home/travis/gopath/src/github.com/appsody/appsody/vendor/github.com/spf13/cobra/command.go:852
github.com/appsody/appsody/vendor/github.com/spf13/cobra.(*Command).Execute
    /home/travis/gopath/src/github.com/appsody/appsody/vendor/github.com/spf13/cobra/command.go:800
github.com/appsody/appsody/cmd.ExecuteE
    /home/travis/gopath/src/github.com/appsody/appsody/cmd/root.go:240
github.com/appsody/appsody/cmd.Execute
    /home/travis/gopath/src/github.com/appsody/appsody/cmd/root.go:226
main.main
    /home/travis/gopath/src/github.com/appsody/appsody/main.go:27
runtime.main
    /home/travis/.gimme/versions/go1.12.17.linux.amd64/src/runtime/proc.go:200
runtime.goexit
    /home/travis/.gimme/versions/go1.12.17.linux.amd64/src/runtime/asm_amd64.s:1337
[Warning] Your local IDE may not build properly, but the Appsody container should still work.
[Warning] To try again, resolve the issue then run `appsody init` with no arguments.
[Debug] Successfully generated ID: 20200903122734.42971042

After this warning, init goes on to fail due to #854

Environment Details (please complete the following information):

  • OS: OpenShift 4.4
  • CLI version: 0.6.4
  • Stack you are using (including the version): vertx 0.1.4

Additional context
Looks like this occurs due to
APPSODY_MOUNTS="~/.m2/repository:/.m2/repository"
Other Java stacks use:
APPSODY_MOUNTS="~/.m2/repository:/mvn/repository

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant