Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Local Asset Sync #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions scripts/craft2-example.env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ REMOTE_SSH_PORT="22"
# Should we connect to the remote database server via ssh?
REMOTE_DB_USING_SSH="yes"

# Should we connect to the remote server via ssh for assets?
REMOTE_ASSETS_USING_SSH="yes"

# Remote path constants; paths should always have a trailing /
REMOTE_ROOT_PATH="REPLACE_ME"
REMOTE_ASSETS_PATH=${REMOTE_ROOT_PATH}"REPLACE_ME"
Expand Down
3 changes: 3 additions & 0 deletions scripts/craft3-example.env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ REMOTE_SSH_PORT="22"
# Should we connect to the remote database server via ssh?
REMOTE_DB_USING_SSH="yes"

# Should we connect to the remote server via ssh for assets?
REMOTE_ASSETS_USING_SSH="yes"

# Remote path constants; paths should always have a trailing /
REMOTE_ROOT_PATH="REPLACE_ME"
REMOTE_ASSETS_PATH=${REMOTE_ROOT_PATH}"REPLACE_ME"
Expand Down
12 changes: 10 additions & 2 deletions scripts/pull_assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ mkdir -p "${LOCAL_ASSETS_PATH}"
# Pull down the asset dir files via rsync
for DIR in "${LOCAL_ASSETS_DIRS[@]}"
do
rsync -F -L -a -z -e "ssh -p ${REMOTE_SSH_PORT}" --delete-after --progress "${REMOTE_SSH_LOGIN}:${REMOTE_ASSETS_PATH}${DIR}" "${LOCAL_ASSETS_PATH}"
if [[ "${REMOTE_ASSETS_USING_SSH}" == "yes" ]] ; then
rsync -F -L -a -z -e "ssh -p ${REMOTE_SSH_PORT}" --delete-after --progress "${REMOTE_SSH_LOGIN}:${REMOTE_ASSETS_PATH}${DIR}" "${LOCAL_ASSETS_PATH}"
else
rsync -F -L -a -z --delete-after --progress "${REMOTE_ASSETS_PATH}${DIR}" "${LOCAL_ASSETS_PATH}"
fi
echo "*** Synced assets from ${REMOTE_ASSETS_PATH}${DIR}"
done

Expand All @@ -47,7 +51,11 @@ mkdir -p "${LOCAL_CRAFT_FILES_PATH}"
# Pull down the Craft-specific dir files via rsync
for DIR in "${LOCAL_CRAFT_FILE_DIRS[@]}"
do
rsync -F -L -a -z -e "ssh -p ${REMOTE_SSH_PORT}" --delete-after --progress "${REMOTE_SSH_LOGIN}:${REMOTE_CRAFT_FILES_PATH}${DIR}" "${LOCAL_CRAFT_FILES_PATH}"
if [[ "${REMOTE_ASSETS_USING_SSH}" == "yes" ]] ; then
rsync -F -L -a -z -e "ssh -p ${REMOTE_SSH_PORT}" --delete-after --progress "${REMOTE_SSH_LOGIN}:${REMOTE_CRAFT_FILES_PATH}${DIR}" "${LOCAL_CRAFT_FILES_PATH}"
else
rsync -F -L -a -z --delete-after --progress "${REMOTE_CRAFT_FILES_PATH}${DIR}" "${LOCAL_CRAFT_FILES_PATH}"
fi
echo "*** Synced assets from ${REMOTE_CRAFT_FILES_PATH}${DIR}"
done

Expand Down