mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Replace scp with rsync
`rsync` is faster on multiple runs. The `--update` flag will only download newer images and does not overwrite existing files. Thus, it will only download missing images.
This commit is contained in:
parent
c9b8b23915
commit
2cab6fe9cf
@ -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/
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user