Openshift Data Directory Access with URL

I want to access the data directory in OpenShift. I created a folder called uploads , and I also created a symbolic link using putty, yet I cannot access the file, and it shows page 404.

Can someone tell me the process in detail (step by step) since I recently started working with OpenShift.

Also, whenever I update the repository using the git client, it removes the symlink. I am working on a maven project.

+1
source share
2 answers

Below are the steps that I followed:

  • cd <openshift deploy dir in my local system>
  • touch .openshift/action_hooks/deploy
  • vi .openshift/action_hooks/deploy
  • Paste the following code ln -sf ${OPENSHIFT_DATA_DIR}images /var/lib/openshift/<app-id>/jbossews/webapps into the file. Note: the dir image is already present in the data directory on the openshift server.
  • chmod +x .openshift/action_hooks/deploy
  • git add .openshift/action_hooks/deploy
  • git commit -a -m "added deploy"
  • git push origin

I managed to access the folder with images here: https: // app-url / images

Hope this helps

0
source

Create a symbolic link in the deployment action shortcut to prevent the symbolic link from being overwritten.

In .openshift/action_hooks/deploy :

 #!/bin/bash # This deploy hook gets executed after dependencies are resolved and the # build hook has been run but before the application has been started back # up again. # create the uploads directory if it doesn't exist if [ ! -d ${OPENSHIFT_DATA_DIR}uploads ]; then mkdir ${OPENSHIFT_DATA_DIR}uploads fi # create symlink to uploads directory ln -sf ${OPENSHIFT_DATA_DIR}uploads ${OPENSHIFT_REPO_DIR}webapps/ 

See line 67 of WordPress QuickStart for an example.

+3
source

Source: https://habr.com/ru/post/1245852/


All Articles