mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
I encourage @ulfgebhardt to run the following command once: ``` SH_USERNAME=ulf SSH_HOST=***** MONGODB_USERNAME='hc-api' MONGODB_PASSWORD=***** MONGODB_DATABASE=hc_api MONGODB_AUTH_DB=admin UPLOADS_DIRECTORY=/data/api/uploads docker-compose -f docker-compose.maintenance.yml up --build ``` Once you're done with everything. You don't have to run docker for development, but this procedure would ensure docker environment works as expected.
46 lines
1.5 KiB
Bash
Executable File
46 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
# import .env config
|
|
set -o allexport
|
|
source $(dirname "$0")/.env
|
|
set +o allexport
|
|
|
|
# Export collection function defintion
|
|
function export_collection () {
|
|
"${EXPORT_MONGOEXPORT_BIN}" --db ${MONGODB_DATABASE} --host localhost -d ${MONGODB_DATABASE} --port 27018 --username ${MONGODB_USERNAME} --password ${MONGODB_PASSWORD} --authenticationDatabase ${MONGODB_AUTH_DB} --collection $1 --collection $1 --out "${EXPORT_PATH}$1.json"
|
|
mkdir -p ${EXPORT_PATH}splits/$1/
|
|
split -l 1000 -a 3 ${EXPORT_PATH}$1.json ${EXPORT_PATH}splits/$1/
|
|
}
|
|
|
|
# Delete old export & ensure directory
|
|
rm -rf ${EXPORT_PATH}*
|
|
mkdir -p ${EXPORT_PATH}
|
|
|
|
# Open SSH Tunnel
|
|
ssh -4 -M -S my-ctrl-socket -fnNT -L 27018:localhost:27017 -l ${SSH_USERNAME} ${SSH_HOST}
|
|
|
|
# Export all Data from the Alpha to json and split them up
|
|
export_collection "badges"
|
|
export_collection "categories"
|
|
export_collection "comments"
|
|
export_collection "contributions"
|
|
export_collection "emotions"
|
|
export_collection "follows"
|
|
export_collection "invites"
|
|
export_collection "notifications"
|
|
export_collection "organizations"
|
|
export_collection "pages"
|
|
export_collection "projects"
|
|
export_collection "settings"
|
|
export_collection "shouts"
|
|
export_collection "status"
|
|
export_collection "systemnotifications"
|
|
export_collection "users"
|
|
export_collection "userscandos"
|
|
export_collection "usersettings"
|
|
|
|
# Close SSH Tunnel
|
|
ssh -S my-ctrl-socket -O check -l ${SSH_USERNAME} ${SSH_HOST}
|
|
ssh -S my-ctrl-socket -O exit -l ${SSH_USERNAME} ${SSH_HOST}
|