-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Add push_db #6
Comments
The workflow I use for that is I have Forge set up to auto-deploy when pushed to the So I don't really need a script to do that; if you want to then pull the Pull requests would be awesome if you do decide to make a |
If you do, you might also want to make an analogous |
Has anything happened with this? I may be misunderstanding how these scripts should be utilised, but our current setup is |
@shornuk you should try using a workflow as described here: https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms You absolutely can pull the db & assets to your staging environment; just set up a |
@sjelfull did you ever work up a workflow for |
Naah, I did not. Someday 😬 |
@chasegiunta @sjelfull Anyone think this would work for pushing the local database to the remote database? I tried to plug into their scripts and variables as much as possible. This has been tested in pieces, but not as a whole. I'm about 99% sure it should work, but 1% of me still thinks it will crash everything : P One of my main concerns is that running the remote push_db.sh#!/bin/bash
# Get the directory of the currently executing script
DIR="$(dirname "${BASH_SOURCE[0]}")"
# Include files
INCLUDE_FILES=(
"common/defaults.sh"
".env.sh"
"common/common_env.sh"
"common/common_db.sh"
)
for INCLUDE_FILE in "${INCLUDE_FILES[@]}"; do
if [[ ! -f "${DIR}/${INCLUDE_FILE}" ]] ; then
echo "File ${DIR}/${INCLUDE_FILE} is missing, aborting."
exit 1
fi
source "${DIR}/${INCLUDE_FILE}"
done
# Backup local database:
./backup_db.sh
# Set the backup db file name, parent directory path, and full path
BACKUP_DB_DIR_PATH="${LOCAL_BACKUPS_PATH}${LOCAL_DB_NAME}/${DB_BACKUP_SUBDIR}/"
BACKUP_DB_NAME="$(basename $(ls -t $BACKUP_DB_DIR_PATH*.sql* | head -1))";
BACKUP_DB_PATH="${BACKUP_DB_DIR_PATH}${BACKUP_DB_NAME}";
# Copy local backup to server:
echo "*** Copying $BACKUP_DB_PATH to $REMOTE_BACKUPS_PATH$BACKUP_DB_NAME";
scp "$BACKUP_DB_PATH" "$REMOTE_SSH_LOGIN:$REMOTE_BACKUPS_PATH$BACKUP_DB_NAME";
# Log into server and restore local backup
ssh -t $REMOTE_SSH_LOGIN << EOF
"${REMOTE_ROOT_PATH}scripts/restore_db.sh" "$REMOTE_BACKUPS_PATH$BACKUP_DB_NAME";
EOF
# Normal exit
exit 0 |
When developing a site locally, I usually push to staging all the time. Do you have a script for pushing to remote already, or should I send you a pull request?
The text was updated successfully, but these errors were encountered: