diff --git a/db-migration-worker/Dockerfile b/db-migration-worker/Dockerfile index 92dff618f..025be88a4 100644 --- a/db-migration-worker/Dockerfile +++ b/db-migration-worker/Dockerfile @@ -1,7 +1,7 @@ FROM mongo:4 RUN apt-get update \ - && apt-get -y install --no-install-recommends openssh-client \ + && apt-get -y install --no-install-recommends openssh-client rsync \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* COPY .ssh /root/.ssh/ diff --git a/db-migration-worker/import.sh b/db-migration-worker/import.sh index cb7e82ce6..0251a3582 100755 --- a/db-migration-worker/import.sh +++ b/db-migration-worker/import.sh @@ -22,10 +22,11 @@ rm -f /mongo-export/* ssh -4 -M -S my-ctrl-socket -fnNT -L 27018:localhost:27017 -l ${SSH_USERNAME} ${SSH_HOST} mongodump --host localhost -d ${MONGODB_DATABASE} --port 27018 --username ${MONGODB_USERNAME} --password ${MONGODB_PASSWORD} --authenticationDatabase ${MONGODB_AUTH_DB} --gzip --archive | mongorestore --gzip --archive -scp -r ${SSH_USERNAME}@${SSH_HOST}:${UPLOADS_DIRECTORY}/* /uploads/ ssh -S my-ctrl-socket -O check -l ${SSH_USERNAME} ${SSH_HOST} ssh -S my-ctrl-socket -O exit -l ${SSH_USERNAME} ${SSH_HOST} +rsync --archive --update --verbose ${SSH_USERNAME}@${SSH_HOST}:${UPLOADS_DIRECTORY}/* /uploads/ + for collection in "categories" "badges" "users" "contributions" "comments" "follows" "shouts" do mongoexport --db ${MONGODB_DATABASE} --collection $collection --out "/mongo-export/$collection.json" diff --git a/neo4j/import/todo b/neo4j/import/todo index 0b86c8bc5..0e0f259f0 100644 --- a/neo4j/import/todo +++ b/neo4j/import/todo @@ -4,7 +4,6 @@ ON CREATE SET c.name = category.title, c.slug = category.slug, c.icon = category.icon - CALL apoc.load.json('file:/mongo-export/badges.json') YIELD value as badge MERGE(b:Badge {id: badge._id["$oid"]}) ON CREATE SET b.key = badge.key, @@ -12,17 +11,11 @@ ON CREATE SET b.key = badge.key, b.icon = badge.image.path, b.status = badge.status - - - - - CALL apoc.load.json('file:/mongo-export/follows.json') YIELD value as follow MATCH (u1:User {id: follow.userId}), (u2:User {id: follow.foreignId}) MERGE (u1)-[:FOLLOWS]->(u2) - CALL apoc.load.json('file:/mongo-export/shouts.json') YIELD value as shout MATCH (u:User {id: shout.userId}), (p:Post {id: shout.foreignId})