From e46c8d18e5da4caf34246d2b5e52d28d3801e6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 21 Jan 2019 21:32:53 +0100 Subject: [PATCH 01/11] Implement public folder --- src/middleware/fixImageUrlsMiddleware.js | 2 +- src/middleware/fixImageUrlsMiddleware.spec.js | 4 ++-- src/server.js | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/middleware/fixImageUrlsMiddleware.js b/src/middleware/fixImageUrlsMiddleware.js index c3b828dae..e5dc47a6d 100644 --- a/src/middleware/fixImageUrlsMiddleware.js +++ b/src/middleware/fixImageUrlsMiddleware.js @@ -7,7 +7,7 @@ const legacyUrls = [ export const fixUrl = (url) => { legacyUrls.forEach((legacyUrl) => { - url = url.replace(legacyUrl, '') + url = url.replace(legacyUrl, '/api') }) return url } diff --git a/src/middleware/fixImageUrlsMiddleware.spec.js b/src/middleware/fixImageUrlsMiddleware.spec.js index 081154c5c..89d2a520d 100644 --- a/src/middleware/fixImageUrlsMiddleware.spec.js +++ b/src/middleware/fixImageUrlsMiddleware.spec.js @@ -4,14 +4,14 @@ describe('fixImageURLs', () => { describe('image url of legacy alpha', () => { it('removes domain', () => { const url = 'https://api-alpha.human-connection.org/uploads/4bfaf9172c4ba03d7645108bbbd16f0a696a37d01eacd025fb131e5da61b15d9.png' - expect(fixImageURLs(url)).toEqual('/uploads/4bfaf9172c4ba03d7645108bbbd16f0a696a37d01eacd025fb131e5da61b15d9.png') + expect(fixImageURLs(url)).toEqual('/api/uploads/4bfaf9172c4ba03d7645108bbbd16f0a696a37d01eacd025fb131e5da61b15d9.png') }) }) describe('image url of legacy staging', () => { it('removes domain', () => { const url = 'https://staging-api.human-connection.org/uploads/1b3c39a24f27e2fb62b69074b2f71363b63b263f0c4574047d279967124c026e.jpeg' - expect(fixImageURLs(url)).toEqual('/uploads/1b3c39a24f27e2fb62b69074b2f71363b63b263f0c4574047d279967124c026e.jpeg') + expect(fixImageURLs(url)).toEqual('/api/uploads/1b3c39a24f27e2fb62b69074b2f71363b63b263f0c4574047d279967124c026e.jpeg') }) }) diff --git a/src/server.js b/src/server.js index 76e8419b7..728237562 100644 --- a/src/server.js +++ b/src/server.js @@ -2,6 +2,7 @@ import { GraphQLServer } from 'graphql-yoga' import { makeExecutableSchema } from 'apollo-server' import { augmentSchema } from 'neo4j-graphql-js' import { typeDefs, resolvers } from './graphql-schema' +import express from 'express' import dotenv from 'dotenv' import mocks from './mocks' import middleware from './middleware' @@ -68,6 +69,7 @@ const createServer = (options) => { passport.use('jwt', jwtStrategy(driver)) server.express.use(passport.initialize()) + server.express.use(express.static('public')) server.express.post('/graphql', passport.authenticate(['jwt'], { session: false })) return server From 509e4feeb9ec6c289a7fd49d097aa5e8182ea94a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 21 Jan 2019 22:12:50 +0100 Subject: [PATCH 02/11] Add workflow to download remote uploads * remote uploads directory * download content of uploads directory with `scp` * share uploads volume with backend container --- db-migration-worker/import.sh | 4 +++- docker-compose.override.yml | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/db-migration-worker/import.sh b/db-migration-worker/import.sh index ba07217c0..cb7e82ce6 100755 --- a/db-migration-worker/import.sh +++ b/db-migration-worker/import.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -for var in "SSH_USERNAME" "SSH_HOST" "MONGODB_USERNAME" "MONGODB_PASSWORD" "MONGODB_DATABASE" "MONGODB_AUTH_DB" +for var in "SSH_USERNAME" "SSH_HOST" "MONGODB_USERNAME" "MONGODB_PASSWORD" "MONGODB_DATABASE" "MONGODB_AUTH_DB" "UPLOADS_DIRECTORY" do if [[ -z "${!var}" ]]; then echo "${var} is undefined" @@ -14,6 +14,7 @@ echo "MONGODB_USERNAME ${MONGODB_USERNAME}" echo "MONGODB_PASSWORD ${MONGODB_PASSWORD}" echo "MONGODB_DATABASE ${MONGODB_DATABASE}" echo "MONGODB_AUTH_DB ${MONGODB_AUTH_DB}" +echo "UPLOADS_DIRECTORY ${UPLOADS_DIRECTORY}" echo "-------------------------------------------------" mongo ${MONGODB_DATABASE} --eval "db.dropDatabase();" @@ -21,6 +22,7 @@ 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} diff --git a/docker-compose.override.yml b/docker-compose.override.yml index c5e7d5cf9..0592b801b 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -9,6 +9,7 @@ services: volumes: - .:/nitro-backend - /nitro-backend/node_modules + - uploads:/nitro-backend/public/uploads command: yarn run dev neo4j: volumes: @@ -24,6 +25,7 @@ services: context: db-migration-worker volumes: - mongo-export:/mongo-export + - uploads:/uploads - ./db-migration-worker/.ssh/:/root/.ssh/ networks: - hc-network @@ -34,7 +36,9 @@ services: - "MONGODB_PASSWORD=${MONGODB_PASSWORD}" - "MONGODB_AUTH_DB=${MONGODB_AUTH_DB}" - "MONGODB_DATABASE=${MONGODB_DATABASE}" + - "UPLOADS_DIRECTORY=${UPLOADS_DIRECTORY}" command: "--smallfiles --logpath=/dev/null" volumes: mongo-export: + uploads: From c9b8b23915fd7ee191ad2364705039ef157667fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 21 Jan 2019 22:17:00 +0100 Subject: [PATCH 03/11] Keep public folder empty --- .dockerignore | 2 ++ .gitignore | 2 ++ public/.gitkeep | 0 3 files changed, 4 insertions(+) create mode 100644 public/.gitkeep diff --git a/.dockerignore b/.dockerignore index f5a08be39..161805c9c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -18,3 +18,5 @@ dist/ db-migration-worker/ neo4j/ + +public/ diff --git a/.gitignore b/.gitignore index a5e987954..e34da736c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ yarn-error.log dist/* coverage.lcov .nyc_output/ +public/* +!.gitkeep diff --git a/public/.gitkeep b/public/.gitkeep new file mode 100644 index 000000000..e69de29bb From 2cab6fe9cf13fa8582d33eda8c1a7c73b4992c5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 21 Jan 2019 22:33:32 +0100 Subject: [PATCH 04/11] 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. --- db-migration-worker/Dockerfile | 2 +- db-migration-worker/import.sh | 3 ++- neo4j/import/todo | 7 ------- 3 files changed, 3 insertions(+), 9 deletions(-) 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}) From f69a0daeefdab5e57af8d1d488a7de6d3529f706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 21 Jan 2019 23:13:32 +0100 Subject: [PATCH 05/11] Import categories, manually assign correct icon Big fun :+1: --- neo4j/import/categories.cql | 89 +++++++++++++++++++++++++++++++++++++ neo4j/import/import.sh | 2 +- neo4j/import/todo | 6 --- 3 files changed, 90 insertions(+), 7 deletions(-) create mode 100644 neo4j/import/categories.cql diff --git a/neo4j/import/categories.cql b/neo4j/import/categories.cql new file mode 100644 index 000000000..a2bf6a352 --- /dev/null +++ b/neo4j/import/categories.cql @@ -0,0 +1,89 @@ +CALL apoc.load.json('file:/mongo-export/categories.json') YIELD value as category +MERGE(c:Category {id: category._id["$oid"]}) +ON CREATE SET +c.name = category.title, +c.slug = category.slug, +c.icon = category.icon, +c.createdAt = category.createdAt.`$date`, +c.updatedAt = category.updatedAt.`$date` +; + +MATCH (c:Category) +WHERE (c.icon = "categories-justforfun") +SET c.icon = 'smile' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-luck") +SET c.icon = 'heart-o' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-health") +SET c.icon = 'medkit' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-environment") +SET c.icon = 'tree' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-animal-justice") +SET c.icon = 'paw' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-human-rights") +SET c.icon = 'balance-scale' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-education") +SET c.icon = 'graduation-cap' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-cooperation") +SET c.icon = 'users' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-politics") +SET c.icon = 'university' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-economy") +SET c.icon = 'money' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-technology") +SET c.icon = 'flash' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-internet") +SET c.icon = 'mouse-pointer' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-art") +SET c.icon = 'paint-brush' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-freedom-of-speech") +SET c.icon = 'bullhorn' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-sustainability") +SET c.icon = 'shopping-cart' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-peace") +SET c.icon = 'angellist' +; diff --git a/neo4j/import/import.sh b/neo4j/import/import.sh index 319f1a591..7c4571991 100755 --- a/neo4j/import/import.sh +++ b/neo4j/import/import.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash SCRIPT_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" echo "MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r;" | cypher-shell -for collection in "users" "contributions" "comments" +for collection in "categories" "users" "contributions" "comments" do echo "Import ${collection}..." && cypher-shell < $SCRIPT_DIRECTORY/$collection.cql done diff --git a/neo4j/import/todo b/neo4j/import/todo index 0e0f259f0..8ee1bb83a 100644 --- a/neo4j/import/todo +++ b/neo4j/import/todo @@ -1,9 +1,3 @@ -CALL apoc.load.json('file:/mongo-export/categories.json') YIELD value as category -MERGE(c:Category {id: category._id["$oid"]}) -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, From ce7ce4027265189dd2ed32f30bf1da44ea6c722d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 21 Jan 2019 23:26:45 +0100 Subject: [PATCH 06/11] Import badges --- .dockerignore | 3 ++- .gitignore | 2 +- neo4j/import/badges.cql | 10 ++++++++++ neo4j/import/import.sh | 2 +- public/img/badges/fundraisingbox_de_airship.svg | 1 + public/img/badges/fundraisingbox_de_alienship.svg | 1 + public/img/badges/fundraisingbox_de_balloon.svg | 1 + public/img/badges/fundraisingbox_de_bigballoon.svg | 1 + public/img/badges/fundraisingbox_de_crane.svg | 1 + public/img/badges/fundraisingbox_de_glider.svg | 1 + public/img/badges/fundraisingbox_de_helicopter.svg | 1 + public/img/badges/fundraisingbox_de_starter.svg | 1 + public/img/badges/indiegogo_en_bear.svg | 1 + public/img/badges/indiegogo_en_panda.svg | 1 + public/img/badges/indiegogo_en_rabbit.svg | 1 + public/img/badges/indiegogo_en_racoon.svg | 1 + public/img/badges/indiegogo_en_rhino.svg | 1 + public/img/badges/indiegogo_en_tiger.svg | 1 + public/img/badges/indiegogo_en_turtle.svg | 1 + public/img/badges/indiegogo_en_whale.svg | 1 + public/img/badges/indiegogo_en_wolf.svg | 1 + public/img/badges/user_role_admin.svg | 1 + public/img/badges/user_role_developer.svg | 1 + public/img/badges/user_role_moderator.svg | 1 + public/img/badges/wooold_de_bee.svg | 1 + public/img/badges/wooold_de_butterfly.svg | 1 + public/img/badges/wooold_de_double_rainbow.svg | 1 + public/img/badges/wooold_de_end_of_rainbow.svg | 1 + public/img/badges/wooold_de_flower.svg | 1 + public/img/badges/wooold_de_lifetree.svg | 1 + public/img/badges/wooold_de_magic_rainbow.svg | 1 + public/img/badges/wooold_de_super_founder.svg | 1 + 32 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 neo4j/import/badges.cql create mode 100644 public/img/badges/fundraisingbox_de_airship.svg create mode 100644 public/img/badges/fundraisingbox_de_alienship.svg create mode 100644 public/img/badges/fundraisingbox_de_balloon.svg create mode 100644 public/img/badges/fundraisingbox_de_bigballoon.svg create mode 100644 public/img/badges/fundraisingbox_de_crane.svg create mode 100644 public/img/badges/fundraisingbox_de_glider.svg create mode 100644 public/img/badges/fundraisingbox_de_helicopter.svg create mode 100644 public/img/badges/fundraisingbox_de_starter.svg create mode 100644 public/img/badges/indiegogo_en_bear.svg create mode 100644 public/img/badges/indiegogo_en_panda.svg create mode 100644 public/img/badges/indiegogo_en_rabbit.svg create mode 100644 public/img/badges/indiegogo_en_racoon.svg create mode 100644 public/img/badges/indiegogo_en_rhino.svg create mode 100644 public/img/badges/indiegogo_en_tiger.svg create mode 100644 public/img/badges/indiegogo_en_turtle.svg create mode 100644 public/img/badges/indiegogo_en_whale.svg create mode 100644 public/img/badges/indiegogo_en_wolf.svg create mode 100644 public/img/badges/user_role_admin.svg create mode 100644 public/img/badges/user_role_developer.svg create mode 100644 public/img/badges/user_role_moderator.svg create mode 100644 public/img/badges/wooold_de_bee.svg create mode 100644 public/img/badges/wooold_de_butterfly.svg create mode 100644 public/img/badges/wooold_de_double_rainbow.svg create mode 100644 public/img/badges/wooold_de_end_of_rainbow.svg create mode 100644 public/img/badges/wooold_de_flower.svg create mode 100644 public/img/badges/wooold_de_lifetree.svg create mode 100644 public/img/badges/wooold_de_magic_rainbow.svg create mode 100644 public/img/badges/wooold_de_super_founder.svg diff --git a/.dockerignore b/.dockerignore index 161805c9c..dba77200f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -19,4 +19,5 @@ dist/ db-migration-worker/ neo4j/ -public/ +public/uploads/* +!.gitkeep diff --git a/.gitignore b/.gitignore index e34da736c..cbfa0b7c8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,5 @@ yarn-error.log dist/* coverage.lcov .nyc_output/ -public/* +public/uploads/* !.gitkeep diff --git a/neo4j/import/badges.cql b/neo4j/import/badges.cql new file mode 100644 index 000000000..90e4755b4 --- /dev/null +++ b/neo4j/import/badges.cql @@ -0,0 +1,10 @@ +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, +b.type = badge.type, +b.icon = badge.image.path, +b.status = badge.status, +b.createdAt = badge.createdAt.`$date`, +b.updatedAt = badge.updatedAt.`$date` +; diff --git a/neo4j/import/import.sh b/neo4j/import/import.sh index 7c4571991..86224d240 100755 --- a/neo4j/import/import.sh +++ b/neo4j/import/import.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash SCRIPT_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" echo "MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r;" | cypher-shell -for collection in "categories" "users" "contributions" "comments" +for collection in "badges" "categories" "users" "contributions" "comments" do echo "Import ${collection}..." && cypher-shell < $SCRIPT_DIRECTORY/$collection.cql done diff --git a/public/img/badges/fundraisingbox_de_airship.svg b/public/img/badges/fundraisingbox_de_airship.svg new file mode 100644 index 000000000..078dcf4f9 --- /dev/null +++ b/public/img/badges/fundraisingbox_de_airship.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/fundraisingbox_de_alienship.svg b/public/img/badges/fundraisingbox_de_alienship.svg new file mode 100644 index 000000000..e891c5fa9 --- /dev/null +++ b/public/img/badges/fundraisingbox_de_alienship.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/fundraisingbox_de_balloon.svg b/public/img/badges/fundraisingbox_de_balloon.svg new file mode 100644 index 000000000..6fc436d86 --- /dev/null +++ b/public/img/badges/fundraisingbox_de_balloon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/fundraisingbox_de_bigballoon.svg b/public/img/badges/fundraisingbox_de_bigballoon.svg new file mode 100644 index 000000000..e2650963a --- /dev/null +++ b/public/img/badges/fundraisingbox_de_bigballoon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/fundraisingbox_de_crane.svg b/public/img/badges/fundraisingbox_de_crane.svg new file mode 100644 index 000000000..4904c5ec5 --- /dev/null +++ b/public/img/badges/fundraisingbox_de_crane.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/fundraisingbox_de_glider.svg b/public/img/badges/fundraisingbox_de_glider.svg new file mode 100644 index 000000000..0c15955de --- /dev/null +++ b/public/img/badges/fundraisingbox_de_glider.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/fundraisingbox_de_helicopter.svg b/public/img/badges/fundraisingbox_de_helicopter.svg new file mode 100644 index 000000000..3a84e4466 --- /dev/null +++ b/public/img/badges/fundraisingbox_de_helicopter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/fundraisingbox_de_starter.svg b/public/img/badges/fundraisingbox_de_starter.svg new file mode 100644 index 000000000..99980560e --- /dev/null +++ b/public/img/badges/fundraisingbox_de_starter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_bear.svg b/public/img/badges/indiegogo_en_bear.svg new file mode 100644 index 000000000..43465a0e6 --- /dev/null +++ b/public/img/badges/indiegogo_en_bear.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_panda.svg b/public/img/badges/indiegogo_en_panda.svg new file mode 100644 index 000000000..a2f211e85 --- /dev/null +++ b/public/img/badges/indiegogo_en_panda.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_rabbit.svg b/public/img/badges/indiegogo_en_rabbit.svg new file mode 100644 index 000000000..c8c0c9727 --- /dev/null +++ b/public/img/badges/indiegogo_en_rabbit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_racoon.svg b/public/img/badges/indiegogo_en_racoon.svg new file mode 100644 index 000000000..619cb75f1 --- /dev/null +++ b/public/img/badges/indiegogo_en_racoon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_rhino.svg b/public/img/badges/indiegogo_en_rhino.svg new file mode 100644 index 000000000..71c0eb1ad --- /dev/null +++ b/public/img/badges/indiegogo_en_rhino.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_tiger.svg b/public/img/badges/indiegogo_en_tiger.svg new file mode 100644 index 000000000..88583a472 --- /dev/null +++ b/public/img/badges/indiegogo_en_tiger.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_turtle.svg b/public/img/badges/indiegogo_en_turtle.svg new file mode 100644 index 000000000..6b5431c2e --- /dev/null +++ b/public/img/badges/indiegogo_en_turtle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_whale.svg b/public/img/badges/indiegogo_en_whale.svg new file mode 100644 index 000000000..458e03b6d --- /dev/null +++ b/public/img/badges/indiegogo_en_whale.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_wolf.svg b/public/img/badges/indiegogo_en_wolf.svg new file mode 100644 index 000000000..e4952d86f --- /dev/null +++ b/public/img/badges/indiegogo_en_wolf.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/user_role_admin.svg b/public/img/badges/user_role_admin.svg new file mode 100644 index 000000000..101e7458d --- /dev/null +++ b/public/img/badges/user_role_admin.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/user_role_developer.svg b/public/img/badges/user_role_developer.svg new file mode 100644 index 000000000..55d363c9a --- /dev/null +++ b/public/img/badges/user_role_developer.svg @@ -0,0 +1 @@ +</> \ No newline at end of file diff --git a/public/img/badges/user_role_moderator.svg b/public/img/badges/user_role_moderator.svg new file mode 100644 index 000000000..bb2e5fde6 --- /dev/null +++ b/public/img/badges/user_role_moderator.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/wooold_de_bee.svg b/public/img/badges/wooold_de_bee.svg new file mode 100644 index 000000000..e716c6116 --- /dev/null +++ b/public/img/badges/wooold_de_bee.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/wooold_de_butterfly.svg b/public/img/badges/wooold_de_butterfly.svg new file mode 100644 index 000000000..6d2b83e31 --- /dev/null +++ b/public/img/badges/wooold_de_butterfly.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/wooold_de_double_rainbow.svg b/public/img/badges/wooold_de_double_rainbow.svg new file mode 100644 index 000000000..406001188 --- /dev/null +++ b/public/img/badges/wooold_de_double_rainbow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/wooold_de_end_of_rainbow.svg b/public/img/badges/wooold_de_end_of_rainbow.svg new file mode 100644 index 000000000..2ae24cb7b --- /dev/null +++ b/public/img/badges/wooold_de_end_of_rainbow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/wooold_de_flower.svg b/public/img/badges/wooold_de_flower.svg new file mode 100644 index 000000000..ffc4b3da4 --- /dev/null +++ b/public/img/badges/wooold_de_flower.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/wooold_de_lifetree.svg b/public/img/badges/wooold_de_lifetree.svg new file mode 100644 index 000000000..5a89fa5f9 --- /dev/null +++ b/public/img/badges/wooold_de_lifetree.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/wooold_de_magic_rainbow.svg b/public/img/badges/wooold_de_magic_rainbow.svg new file mode 100644 index 000000000..74df95190 --- /dev/null +++ b/public/img/badges/wooold_de_magic_rainbow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/wooold_de_super_founder.svg b/public/img/badges/wooold_de_super_founder.svg new file mode 100644 index 000000000..b437f6383 --- /dev/null +++ b/public/img/badges/wooold_de_super_founder.svg @@ -0,0 +1 @@ + \ No newline at end of file From 932a593cfa3cbefff6aee3f0b4cdbfd2f601749a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 21 Jan 2019 23:38:48 +0100 Subject: [PATCH 07/11] Import follows --- neo4j/import/follows.cql | 4 ++++ neo4j/import/import.sh | 2 +- neo4j/import/todo | 10 ---------- 3 files changed, 5 insertions(+), 11 deletions(-) create mode 100644 neo4j/import/follows.cql diff --git a/neo4j/import/follows.cql b/neo4j/import/follows.cql new file mode 100644 index 000000000..0dad6a435 --- /dev/null +++ b/neo4j/import/follows.cql @@ -0,0 +1,4 @@ +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) +; diff --git a/neo4j/import/import.sh b/neo4j/import/import.sh index 86224d240..d712dea0a 100755 --- a/neo4j/import/import.sh +++ b/neo4j/import/import.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash SCRIPT_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" echo "MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r;" | cypher-shell -for collection in "badges" "categories" "users" "contributions" "comments" +for collection in "badges" "categories" "users" "follows" "contributions" "comments" do echo "Import ${collection}..." && cypher-shell < $SCRIPT_DIRECTORY/$collection.cql done diff --git a/neo4j/import/todo b/neo4j/import/todo index 8ee1bb83a..73eae2396 100644 --- a/neo4j/import/todo +++ b/neo4j/import/todo @@ -1,14 +1,4 @@ -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, - b.type = badge.type, - 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}), From 494748c4c459f886e78a491c6f022e2a0da96ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 21 Jan 2019 23:43:23 +0100 Subject: [PATCH 08/11] Import shouts --- neo4j/import/import.sh | 2 +- neo4j/import/shouts.cql | 4 ++++ neo4j/import/todo | 4 ---- 3 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 neo4j/import/shouts.cql diff --git a/neo4j/import/import.sh b/neo4j/import/import.sh index d712dea0a..80b6595fc 100755 --- a/neo4j/import/import.sh +++ b/neo4j/import/import.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash SCRIPT_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" echo "MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r;" | cypher-shell -for collection in "badges" "categories" "users" "follows" "contributions" "comments" +for collection in "badges" "categories" "users" "follows" "contributions" "shouts" "comments" do echo "Import ${collection}..." && cypher-shell < $SCRIPT_DIRECTORY/$collection.cql done diff --git a/neo4j/import/shouts.cql b/neo4j/import/shouts.cql new file mode 100644 index 000000000..60aca50c9 --- /dev/null +++ b/neo4j/import/shouts.cql @@ -0,0 +1,4 @@ +CALL apoc.load.json('file:/mongo-export/shouts.json') YIELD value as shout +MATCH (u:User {id: shout.userId}), (p:Post {id: shout.foreignId}) +MERGE (u)-[:SHOUTED]->(p) +; diff --git a/neo4j/import/todo b/neo4j/import/todo index 73eae2396..139597f9c 100644 --- a/neo4j/import/todo +++ b/neo4j/import/todo @@ -1,6 +1,2 @@ -CALL apoc.load.json('file:/mongo-export/shouts.json') YIELD value as shout -MATCH (u:User {id: shout.userId}), - (p:Post {id: shout.foreignId}) -MERGE (u)-[:SHOUTED]->(p) From 5bdc7280281c422135880cff1db7ec2535be46c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 28 Jan 2019 17:28:52 +0100 Subject: [PATCH 09/11] Don't copy private SSH key into docker image We can mount the .ssh at runtime. This will allow us to push the docker image to dockerhub without exposing any secrects. --- db-migration-worker/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/db-migration-worker/Dockerfile b/db-migration-worker/Dockerfile index 025be88a4..d7265ac02 100644 --- a/db-migration-worker/Dockerfile +++ b/db-migration-worker/Dockerfile @@ -4,6 +4,5 @@ RUN apt-get update \ && apt-get -y install --no-install-recommends openssh-client rsync \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -COPY .ssh /root/.ssh/ COPY import.sh . From 3dcbbafcd6c31b68fcf27f6dc8dc487eaa04c314 Mon Sep 17 00:00:00 2001 From: Sam Joseph Date: Mon, 28 Jan 2019 17:29:21 +0000 Subject: [PATCH 10/11] Create CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..19f3854c1 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at developer@human-connection.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ From 17d87c6a9d0be477f2e41daa46db666961f65699 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 29 Jan 2019 03:34:22 +0000 Subject: [PATCH 11/11] Bump graphql-yoga from 1.17.0 to 1.17.1 Bumps [graphql-yoga](https://github.com/prisma/graphql-yoga) from 1.17.0 to 1.17.1. - [Release notes](https://github.com/prisma/graphql-yoga/releases) - [Commits](https://github.com/prisma/graphql-yoga/compare/v1.17.0...v1.17.1) Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 21349ffb2..d24d801ad 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "graphql-middleware": "~1.7.8", "graphql-shield": "~4.1.2", "graphql-tag": "~2.10.1", - "graphql-yoga": "~1.17.0", + "graphql-yoga": "~1.17.1", "jsonwebtoken": "~8.4.0", "linkifyjs": "~2.1.7", "lodash": "~4.17.11", diff --git a/yarn.lock b/yarn.lock index 50b8a7cc6..310133908 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3473,12 +3473,12 @@ graphql-iso-date@~3.6.1: resolved "https://registry.yarnpkg.com/graphql-iso-date/-/graphql-iso-date-3.6.1.tgz#bd2d0dc886e0f954cbbbc496bbf1d480b57ffa96" integrity sha512-AwFGIuYMJQXOEAgRlJlFL4H1ncFM8n8XmoVDTNypNOZyQ8LFDG2ppMFlsS862BSTCDcSUfHp8PD3/uJhv7t59Q== -graphql-middleware@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/graphql-middleware/-/graphql-middleware-3.0.0.tgz#df498cc2c19ca5936fc67e9e39df6c484dbf4d80" - integrity sha512-m1V5G8jTatG8ZbFWLWBqrlVbHNpJv/U15LJ8U3XAoLjxm5HRY9rVXns6I4gigJqUt/0i/xYO7Lk3YkxqHi8QmQ== +graphql-middleware@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/graphql-middleware/-/graphql-middleware-3.0.1.tgz#8e1f1b2b9738002c1132372cb51d9cceb1b962ec" + integrity sha512-mKXoFYBozbFfAwUPqADO/xpL/DcLKE8fGc0qHTL1ssA6+6Ynt609m4V36/c4FAxcnJsgsV1p22aBbiraXg+ddA== dependencies: - graphql-tools "^4.0.3" + graphql-tools "^4.0.4" graphql-middleware@~1.7.8: version "1.7.8" @@ -3542,10 +3542,10 @@ graphql-tag@^2.9.2, graphql-tag@~2.10.1: resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.10.1.tgz#10aa41f1cd8fae5373eaf11f1f67260a3cad5e02" integrity sha512-jApXqWBzNXQ8jYa/HLkZJaVw9jgwNqZkywa2zfFn16Iv1Zb7ELNHkJaXHR7Quvd5SIGsy6Ny7SUKATgnu05uEg== -graphql-tools@^4.0.0, graphql-tools@^4.0.2, graphql-tools@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/graphql-tools/-/graphql-tools-4.0.3.tgz#23b5cb52c519212b1b2e4630a361464396ad264b" - integrity sha512-NNZM0WSnVLX1zIMUxu7SjzLZ4prCp15N5L2T2ro02OVyydZ0fuCnZYRnx/yK9xjGWbZA0Q58yEO//Bv/psJWrg== +graphql-tools@^4.0.0, graphql-tools@^4.0.2, graphql-tools@^4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/graphql-tools/-/graphql-tools-4.0.4.tgz#ca08a63454221fdde825fe45fbd315eb2a6d566b" + integrity sha512-chF12etTIGVVGy3fCTJ1ivJX2KB7OSG4c6UOJQuqOHCmBQwTyNgCDuejZKvpYxNZiEx7bwIjrodDgDe9RIkjlw== dependencies: apollo-link "^1.2.3" apollo-utilities "^1.0.1" @@ -3563,10 +3563,10 @@ graphql-upload@^8.0.2: http-errors "^1.7.1" object-path "^0.11.4" -graphql-yoga@~1.17.0: - version "1.17.0" - resolved "https://registry.yarnpkg.com/graphql-yoga/-/graphql-yoga-1.17.0.tgz#54836fbb43720a19f5ff2357273c2f380e536ed7" - integrity sha512-2uPz7tmkOP8ktnsFIc6blRO6R5RTofWY0ugxKcvR4QlTveNcfKwOiXMVEn8yJulodEGhJLENXJklSxEIyeIbOg== +graphql-yoga@~1.17.1: + version "1.17.1" + resolved "https://registry.yarnpkg.com/graphql-yoga/-/graphql-yoga-1.17.1.tgz#13bace9f063e4c57ab7da40c60b9aea4135b89a4" + integrity sha512-8j2omHHMsSFFn4XFb4hXiMIhBAdqra/Ok5lJxBihMlC2ocNU16aa8sMXjAcwwpgcAV0dpDOU5fL3X1DS0pmTQA== dependencies: "@types/cors" "^2.8.4" "@types/express" "^4.11.1" @@ -3583,7 +3583,7 @@ graphql-yoga@~1.17.0: graphql "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0" graphql-deduplicator "^2.0.1" graphql-import "^0.7.0" - graphql-middleware "3.0.0" + graphql-middleware "3.0.1" graphql-playground-middleware-express "1.7.6" graphql-playground-middleware-lambda "1.7.6" graphql-subscriptions "^0.5.8"