Access Data Directory in Openshift with URL

旧街凉风 提交于 2019-11-30 16:29:09

问题


I want to access a data directory in OpenShift. I created a folder called uploads and I also created the symlink using putty, still I cant access the file and it shows a 404 page.

Can anybody tell me the process in detail (step by step), as I recently started working with OpenShift.

Also, whenever I update the repository using a git client it deletes the symlink. I'm working on a maven project.


回答1:


Here are the steps which I followed:

  1. cd <openshift deploy dir in my local system>
  2. touch .openshift/action_hooks/deploy
  3. vi .openshift/action_hooks/deploy
  4. Pasted the following code ln -sf ${OPENSHIFT_DATA_DIR}images /var/lib/openshift/<app-id>/jbossews/webapps in the file. Note: images dir is already present in the data dir on the openshift server.
  5. chmod +x .openshift/action_hooks/deploy
  6. git add .openshift/action_hooks/deploy
  7. git commit -a -m "added deploy"
  8. git push origin

I was able to access the images folder here: https://app-url/images

Hope this helps




回答2:


Create the symlink in a deploy action hook to prevent the symlink 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 the WordPress QuickStart as an example.



来源:https://stackoverflow.com/questions/29914046/access-data-directory-in-openshift-with-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!