Commit 976a94f6 authored by Visay Keo's avatar Visay Keo

[FEATURE] Add possibility to overwrite remote path

parent 94732bb1
...@@ -27,6 +27,12 @@ bin/syncontent demo-014-007 ...@@ -27,6 +27,12 @@ bin/syncontent demo-014-007
- You need to make sure that you have auto login with public key to `demo-014-007@10.10.10.27` - You need to make sure that you have auto login with public key to `demo-014-007@10.10.10.27`
- Only `latest` or `demo` is supported at the moment. We don't recommend you to have autologin access to the live site - Only `latest` or `demo` is supported at the moment. We don't recommend you to have autologin access to the live site
- You can only run the command from the root directory of your project - You can only run the command from the root directory of your project
- If your remote path is in another directory below `public_html`, set it in the second argument like below:
```bash
bin/syncontent demo-014-007 neosbox
bin/syncontent demo-014-007 neosbox/my_root_dir
```
### Customization ### Customization
...@@ -58,6 +64,8 @@ And the script will automatically take `demo-014-007` as the content master. ...@@ -58,6 +64,8 @@ And the script will automatically take `demo-014-007` as the content master.
- There should be only one master at a time. That means you should not have more than more file in the `config/master` - There should be only one master at a time. That means you should not have more than more file in the `config/master`
directory. In case there are more than one file exists, the script will take first file only to process. directory. In case there are more than one file exists, the script will take first file only to process.
- With this mode, you cannot overwrite the remote path as argument. This will come in the next release of this package.
## Author ## Author
Visay Keo <visay@web-essentials.asia> Visay Keo <visay@web-essentials.asia>
......
#!/bin/bash #!/bin/bash
ARG=$1 USER_NAME=$1
ROOT_DIR=`pwd` ROOT_DIR=`pwd`
PACKAGE_DIR="${ROOT_DIR}/Packages/Libraries/visay/syncontent" PACKAGE_DIR="${ROOT_DIR}/Packages/Libraries/visay/syncontent"
if [ -z "${ARG}" ]; then if [ -z "${USER_NAME}" ]; then
MASTER=`ls ${PACKAGE_DIR}/config/master | sort -n | head -1` MASTER=`ls ${PACKAGE_DIR}/config/master | sort -n | head -1`
else else
MASTER="${ARG}" MASTER="${USER_NAME}"
REMOTE_DIR=$2
fi fi
if [ -z "${MASTER}" ]; then if [ -z "${MASTER}" ]; then
...@@ -37,6 +38,12 @@ if [ "${PING}" != "OK" ]; then ...@@ -37,6 +38,12 @@ if [ "${PING}" != "OK" ]; then
exit 0 exit 0
fi fi
if [ -z "${REMOTE_DIR}" ]; then
REMOTE_PATH="/home/${SSH_USER}/public_html"
else
REMOTE_PATH="/home/${SSH_USER}/public_html/${REMOTE_DIR}"
fi
# Use Development context if Flow Context is not set # Use Development context if Flow Context is not set
FLOW_CONTEXT=${FLOW_CONTEXT:=Development} FLOW_CONTEXT=${FLOW_CONTEXT:=Development}
...@@ -46,7 +53,7 @@ ansible-playbook -i ${PACKAGE_DIR}/ansible/hosts.ini ${PACKAGE_DIR}/ansible/play ...@@ -46,7 +53,7 @@ ansible-playbook -i ${PACKAGE_DIR}/ansible/hosts.ini ${PACKAGE_DIR}/ansible/play
--extra-vars "stage=${STAGE} --extra-vars "stage=${STAGE}
ssh_user=${SSH_USER} ssh_user=${SSH_USER}
local_path=${ROOT_DIR} local_path=${ROOT_DIR}
remote_path=/home/${SSH_USER}/public_html remote_path=${REMOTE_PATH}
local_flow_context=${FLOW_CONTEXT}" local_flow_context=${FLOW_CONTEXT}"
echo "Sync content from ${STAGE} completed!" echo "Sync content from ${STAGE} completed!"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment