mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
Merge remote-tracking branch 'origin/master' into 2019/kw15/User_can_change_its_username_to_emptystring
This commit is contained in:
commit
0637d97648
1
.gitignore
vendored
1
.gitignore
vendored
@ -16,3 +16,4 @@ cypress/screenshots/
|
||||
cypress.env.json
|
||||
|
||||
!.gitkeep
|
||||
**/coverage
|
||||
|
||||
@ -28,7 +28,7 @@ script:
|
||||
- docker-compose exec webapp yarn run lint
|
||||
- docker-compose exec webapp yarn run test --ci --verbose=false
|
||||
- docker-compose exec -d backend yarn run test:before:seeder
|
||||
- yarn run cypress:run
|
||||
- CYPRESS_RETRIES=1 yarn run cypress:run
|
||||
|
||||
after_success:
|
||||
- wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
# Human-Connection
|
||||
|
||||
[](https://travis-ci.com/Human-Connection/Human-Connection)
|
||||
[](https://codecov.io/gh/Human-Connection/Human-Connection/)
|
||||
[](https://github.com/Human-Connection/Nitro-Backend/blob/backend/LICENSE.md)
|
||||
[](https://discord.gg/6ub73U3)
|
||||
|
||||
|
||||
11
SUMMARY.md
11
SUMMARY.md
@ -5,7 +5,6 @@
|
||||
* [Installation](installation.md)
|
||||
* [Backend](backend/README.md)
|
||||
* [GraphQL](backend/graphql.md)
|
||||
* [Legacy Migration](backend/db-migration-worker/README.md)
|
||||
* [Webapp](webapp/README.md)
|
||||
* [COMPONENTS](webapp/components.md)
|
||||
* [PLUGINS](webapp/plugins.md)
|
||||
@ -21,7 +20,15 @@
|
||||
* [Frontend tests](webapp/testing.md)
|
||||
* [Backend tests](backend/testing.md)
|
||||
* [Contributing](CONTRIBUTING.md)
|
||||
* [Deployment](deployment/README.md)
|
||||
* [Kubernetes Deployment](deployment/README.md)
|
||||
* [Minikube](deployment/minikube/README.md)
|
||||
* [Digital Ocean](deployment/digital-ocean/README.md)
|
||||
* [Kubernetes Dashboard](deployment/digital-ocean/dashboard/README.md)
|
||||
* [HTTPS](deployment/digital-ocean/https/README.md)
|
||||
* [Human Connection](deployment/human-connection/README.md)
|
||||
* [Volumes](deployment/volumes/README.md)
|
||||
* [Neo4J DB Backup](deployment/backup.md)
|
||||
* [Legacy Migration](deployment/legacy-migration/README.md)
|
||||
* [Feature Specification](cypress/features.md)
|
||||
* [Code of conduct](CODE_OF_CONDUCT.md)
|
||||
* [License](LICENSE.md)
|
||||
|
||||
@ -15,7 +15,7 @@ node_modules/
|
||||
scripts/
|
||||
dist/
|
||||
|
||||
db-migration-worker/
|
||||
maintenance-worker/
|
||||
neo4j/
|
||||
|
||||
public/uploads/*
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
FROM mongo:4
|
||||
|
||||
RUN apt-get update && apt-get -y install --no-install-recommends wget apt-transport-https \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN wget -O - https://debian.neo4j.org/neotechnology.gpg.key | apt-key add -
|
||||
RUN echo 'deb https://debian.neo4j.org/repo stable/' | tee /etc/apt/sources.list.d/neo4j.list
|
||||
RUN apt-get update && apt-get -y install --no-install-recommends openjdk-8-jre openssh-client neo4j rsync \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
COPY migration ./migration
|
||||
COPY migrate.sh /usr/local/bin/migrate
|
||||
COPY sync_uploads.sh /usr/local/bin/sync_uploads
|
||||
@ -1,40 +0,0 @@
|
||||
# Legacy Migration
|
||||
|
||||
This guide helps you to import data from our legacy servers, which are using FeathersJS and MongoDB.
|
||||
|
||||
**You can skip this if you don't plan to migrate any legacy applications!**
|
||||
|
||||
## Prerequisites
|
||||
|
||||
You need [docker](https://www.docker.com/) installed on your machine. Furthermore you need SSH access to the server and you need to know the following login credentials and server settings:
|
||||
|
||||
| Environment variable | Description |
|
||||
| :--- | :--- |
|
||||
| SSH\_USERNAME | Your ssh username on the server |
|
||||
| SSH\_HOST | The IP address of the server |
|
||||
| MONGODB\_USERNAME | Mongo username on the server |
|
||||
| MONGODB\_PASSWORD | Mongo password on the server |
|
||||
| MONGODB\_AUTH\_DB | Mongo authentication database |
|
||||
| MONGODB\_DATABASE | The name of the mongo database |
|
||||
| UPLOADS\_DIRECTORY | Path to remote uploads folder |
|
||||
|
||||
## Run the database migration
|
||||
|
||||
Run `docker-compose` with all environment variables specified:
|
||||
|
||||
```bash
|
||||
SSH_USERNAME=username SSH_HOST=some.server.com MONGODB_USERNAME='hc-api' MONGODB_PASSWORD='secret' MONGODB_DATABASE=hc_api MONGODB_AUTH_DB=hc_api UPLOADS_DIRECTORY=/var/www/api/uploads docker-compose up
|
||||
```
|
||||
|
||||
Download the remote mongo database:
|
||||
|
||||
```bash
|
||||
docker-compose exec db-migration-worker ./import.sh
|
||||
```
|
||||
|
||||
Import the local download into Neo4J:
|
||||
|
||||
```bash
|
||||
docker-compose exec neo4j import/import.sh
|
||||
```
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
neo4j:
|
||||
environment:
|
||||
- NEO4J_AUTH=none
|
||||
ports:
|
||||
- 7687:7687
|
||||
- 7474:7474
|
||||
backend:
|
||||
ports:
|
||||
- 4001:4001
|
||||
- 4123:4123
|
||||
image: humanconnection/nitro-backend:builder
|
||||
build:
|
||||
context: .
|
||||
target: builder
|
||||
command: yarn run test:cypress
|
||||
@ -1,36 +0,0 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
backend:
|
||||
volumes:
|
||||
- uploads:/nitro-backend/public/uploads
|
||||
neo4j:
|
||||
volumes:
|
||||
- mongo-export:/mongo-export
|
||||
environment:
|
||||
- NEO4J_apoc_import_file_enabled=true
|
||||
db-migration-worker:
|
||||
build:
|
||||
context: db-migration-worker
|
||||
volumes:
|
||||
- mongo-export:/mongo-export
|
||||
- uploads:/uploads
|
||||
- ./db-migration-worker/migration/:/migration
|
||||
- ./db-migration-worker/.ssh/:/root/.ssh/
|
||||
networks:
|
||||
- hc-network
|
||||
depends_on:
|
||||
- backend
|
||||
environment:
|
||||
- NEO4J_URI=bolt://neo4j:7687
|
||||
- "SSH_USERNAME=${SSH_USERNAME}"
|
||||
- "SSH_HOST=${SSH_HOST}"
|
||||
- "MONGODB_USERNAME=${MONGODB_USERNAME}"
|
||||
- "MONGODB_PASSWORD=${MONGODB_PASSWORD}"
|
||||
- "MONGODB_AUTH_DB=${MONGODB_AUTH_DB}"
|
||||
- "MONGODB_DATABASE=${MONGODB_DATABASE}"
|
||||
- "UPLOADS_DIRECTORY=${UPLOADS_DIRECTORY}"
|
||||
|
||||
volumes:
|
||||
mongo-export:
|
||||
uploads:
|
||||
@ -1,23 +0,0 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
backend:
|
||||
image: humanconnection/nitro-backend:builder
|
||||
build:
|
||||
context: .
|
||||
target: builder
|
||||
volumes:
|
||||
- .:/nitro-backend
|
||||
- /nitro-backend/node_modules
|
||||
command: yarn run dev
|
||||
neo4j:
|
||||
environment:
|
||||
- NEO4J_AUTH=none
|
||||
ports:
|
||||
- 7687:7687
|
||||
- 7474:7474
|
||||
volumes:
|
||||
- neo4j-data:/data
|
||||
|
||||
volumes:
|
||||
neo4j-data:
|
||||
@ -1,14 +0,0 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
neo4j:
|
||||
environment:
|
||||
- NEO4J_AUTH=none
|
||||
ports:
|
||||
- 7687:7687
|
||||
- 7474:7474
|
||||
backend:
|
||||
image: humanconnection/nitro-backend:builder
|
||||
build:
|
||||
context: .
|
||||
target: builder
|
||||
@ -1,34 +0,0 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
backend:
|
||||
image: humanconnection/nitro-backend:latest
|
||||
build:
|
||||
context: .
|
||||
target: production
|
||||
networks:
|
||||
- hc-network
|
||||
depends_on:
|
||||
- neo4j
|
||||
ports:
|
||||
- 4000:4000
|
||||
environment:
|
||||
- NEO4J_URI=bolt://neo4j:7687
|
||||
- GRAPHQL_PORT=4000
|
||||
- GRAPHQL_URI=http://localhost:4000
|
||||
- CLIENT_URI=http://localhost:3000
|
||||
- JWT_SECRET=b/&&7b78BF&fv/Vd
|
||||
- MOCK=false
|
||||
- MAPBOX_TOKEN=pk.eyJ1IjoiaHVtYW4tY29ubmVjdGlvbiIsImEiOiJjajl0cnBubGoweTVlM3VwZ2lzNTNud3ZtIn0.KZ8KK9l70omjXbEkkbHGsQ
|
||||
- PRIVATE_KEY_PASSPHRASE=a7dsf78sadg87ad87sfagsadg78
|
||||
|
||||
neo4j:
|
||||
image: humanconnection/neo4j:latest
|
||||
build:
|
||||
context: neo4j
|
||||
networks:
|
||||
- hc-network
|
||||
|
||||
networks:
|
||||
hc-network:
|
||||
name: hc-network
|
||||
@ -26,6 +26,8 @@
|
||||
"license": "MIT",
|
||||
"jest": {
|
||||
"verbose": true,
|
||||
"collectCoverage": true,
|
||||
"coverageReporters": ["text", "lcov"],
|
||||
"testMatch": [
|
||||
"**/src/**/?(*.)+(spec|test).js?(x)"
|
||||
]
|
||||
@ -43,55 +45,55 @@
|
||||
"cross-env": "~5.2.0",
|
||||
"date-fns": "2.0.0-alpha.27",
|
||||
"debug": "~4.1.1",
|
||||
"dotenv": "~7.0.0",
|
||||
"dotenv": "~8.0.0",
|
||||
"express": "~4.16.4",
|
||||
"faker": "~4.1.0",
|
||||
"graphql": "~14.2.1",
|
||||
"graphql-custom-directives": "~0.2.14",
|
||||
"graphql-iso-date": "~3.6.1",
|
||||
"graphql-middleware": "~3.0.2",
|
||||
"graphql-shield": "~5.3.3",
|
||||
"graphql-shield": "~5.3.5",
|
||||
"graphql-tag": "~2.10.1",
|
||||
"graphql-yoga": "~1.17.4",
|
||||
"helmet": "~3.16.0",
|
||||
"helmet": "~3.18.0",
|
||||
"jsonwebtoken": "~8.5.1",
|
||||
"linkifyjs": "~2.1.8",
|
||||
"lodash": "~4.17.11",
|
||||
"ms": "~2.1.1",
|
||||
"neo4j-driver": "~1.7.3",
|
||||
"neo4j-driver": "~1.7.4",
|
||||
"neo4j-graphql-js": "~2.4.2",
|
||||
"node-fetch": "~2.3.0",
|
||||
"node-fetch": "~2.5.0",
|
||||
"npm-run-all": "~4.1.5",
|
||||
"request": "~2.88.0",
|
||||
"sanitize-html": "~1.20.0",
|
||||
"sanitize-html": "~1.20.1",
|
||||
"slug": "~1.1.0",
|
||||
"trunc-html": "~1.1.2",
|
||||
"uuid": "~3.3.2",
|
||||
"wait-on": "~3.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "~7.4.3",
|
||||
"@babel/core": "~7.4.3",
|
||||
"@babel/cli": "~7.4.4",
|
||||
"@babel/core": "~7.4.4",
|
||||
"@babel/node": "~7.2.2",
|
||||
"@babel/plugin-proposal-throw-expressions": "^7.2.0",
|
||||
"@babel/preset-env": "~7.4.3",
|
||||
"@babel/register": "~7.4.0",
|
||||
"@babel/preset-env": "~7.4.4",
|
||||
"@babel/register": "~7.4.4",
|
||||
"apollo-server-testing": "~2.4.8",
|
||||
"babel-core": "~7.0.0-0",
|
||||
"babel-eslint": "~10.0.1",
|
||||
"babel-jest": "~24.7.1",
|
||||
"babel-jest": "~24.8.0",
|
||||
"chai": "~4.2.0",
|
||||
"cucumber": "~5.1.0",
|
||||
"eslint": "~5.16.0",
|
||||
"eslint-config-standard": "~12.0.0",
|
||||
"eslint-plugin-import": "~2.17.2",
|
||||
"eslint-plugin-jest": "~22.4.1",
|
||||
"eslint-plugin-jest": "~22.5.1",
|
||||
"eslint-plugin-node": "~8.0.1",
|
||||
"eslint-plugin-promise": "~4.1.1",
|
||||
"eslint-plugin-standard": "~4.0.0",
|
||||
"graphql-request": "~1.8.2",
|
||||
"jest": "~24.7.1",
|
||||
"nodemon": "~1.18.11",
|
||||
"nodemon": "~1.19.0",
|
||||
"supertest": "~4.0.2"
|
||||
}
|
||||
}
|
||||
@ -11,6 +11,7 @@ import shout from './resolvers/shout.js'
|
||||
import rewards from './resolvers/rewards.js'
|
||||
import socialMedia from './resolvers/socialMedia.js'
|
||||
import notifications from './resolvers/notifications'
|
||||
import comments from './resolvers/comments'
|
||||
|
||||
export const typeDefs = fs
|
||||
.readFileSync(
|
||||
@ -22,7 +23,8 @@ export const resolvers = {
|
||||
Query: {
|
||||
...statistics.Query,
|
||||
...userManagement.Query,
|
||||
...notifications.Query
|
||||
...notifications.Query,
|
||||
...comments.Query
|
||||
},
|
||||
Mutation: {
|
||||
...userManagement.Mutation,
|
||||
@ -33,6 +35,7 @@ export const resolvers = {
|
||||
...shout.Mutation,
|
||||
...rewards.Mutation,
|
||||
...socialMedia.Mutation,
|
||||
...notifications.Mutation
|
||||
...notifications.Mutation,
|
||||
...comments.Mutation
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,7 +86,8 @@ const permissions = shield({
|
||||
unshout: isAuthenticated,
|
||||
changePassword: isAuthenticated,
|
||||
enable: isModerator,
|
||||
disable: isModerator
|
||||
disable: isModerator,
|
||||
CreateComment: isAuthenticated
|
||||
// CreateUser: allow,
|
||||
},
|
||||
User: {
|
||||
|
||||
@ -23,21 +23,19 @@ beforeAll(async () => {
|
||||
])
|
||||
|
||||
await Promise.all([
|
||||
factory.create('Comment', { id: 'c2', content: 'Enabled comment on public post' })
|
||||
factory.create('Comment', { id: 'c2', postId: 'p3', content: 'Enabled comment on public post' })
|
||||
])
|
||||
|
||||
await Promise.all([
|
||||
factory.relate('Comment', 'Author', { from: 'u1', to: 'c2' }),
|
||||
factory.relate('Comment', 'Post', { from: 'c2', to: 'p3' })
|
||||
factory.relate('Comment', 'Author', { from: 'u1', to: 'c2' })
|
||||
])
|
||||
|
||||
const asTroll = Factory()
|
||||
await asTroll.authenticateAs({ email: 'troll@example.org', password: '1234' })
|
||||
await asTroll.create('Post', { id: 'p2', title: 'Disabled post', content: 'This is an offensive post content', image: '/some/offensive/image.jpg', deleted: false })
|
||||
await asTroll.create('Comment', { id: 'c1', content: 'Disabled comment' })
|
||||
await asTroll.create('Comment', { id: 'c1', postId: 'p3', content: 'Disabled comment' })
|
||||
await Promise.all([
|
||||
asTroll.relate('Comment', 'Author', { from: 'u2', to: 'c1' }),
|
||||
asTroll.relate('Comment', 'Post', { from: 'c1', to: 'p3' })
|
||||
asTroll.relate('Comment', 'Author', { from: 'u2', to: 'c1' })
|
||||
])
|
||||
|
||||
const asModerator = Factory()
|
||||
|
||||
55
backend/src/resolvers/comments.js
Normal file
55
backend/src/resolvers/comments.js
Normal file
@ -0,0 +1,55 @@
|
||||
import { neo4jgraphql } from 'neo4j-graphql-js'
|
||||
import { UserInputError } from 'apollo-server'
|
||||
|
||||
const COMMENT_MIN_LENGTH = 1
|
||||
const NO_POST_ERR_MESSAGE = 'Comment cannot be created without a post!'
|
||||
|
||||
export default {
|
||||
Mutation: {
|
||||
CreateComment: async (object, params, context, resolveInfo) => {
|
||||
const content = params.content.replace(/<(?:.|\n)*?>/gm, '').trim()
|
||||
const { postId } = params
|
||||
// Adding relationship from comment to post by passing in the postId,
|
||||
// but we do not want to create the comment with postId as an attribute
|
||||
// because we use relationships for this. So, we are deleting it from params
|
||||
// before comment creation.
|
||||
delete params.postId
|
||||
|
||||
if (!params.content || content.length < COMMENT_MIN_LENGTH) {
|
||||
throw new UserInputError(`Comment must be at least ${COMMENT_MIN_LENGTH} character long!`)
|
||||
}
|
||||
if (!postId.trim()) {
|
||||
throw new UserInputError(NO_POST_ERR_MESSAGE)
|
||||
}
|
||||
|
||||
const session = context.driver.session()
|
||||
const postQueryRes = await session.run(`
|
||||
MATCH (post:Post {id: $postId})
|
||||
RETURN post`, {
|
||||
postId
|
||||
}
|
||||
)
|
||||
const [post] = postQueryRes.records.map(record => {
|
||||
return record.get('post')
|
||||
})
|
||||
|
||||
if (!post) {
|
||||
throw new UserInputError(NO_POST_ERR_MESSAGE)
|
||||
}
|
||||
const comment = await neo4jgraphql(object, params, context, resolveInfo, false)
|
||||
|
||||
await session.run(`
|
||||
MATCH (post:Post {id: $postId}), (comment:Comment {id: $commentId}), (author:User {id: $userId})
|
||||
MERGE (post)<-[:COMMENTS]-(comment)<-[:WROTE]-(author)
|
||||
RETURN post`, {
|
||||
userId: context.user.id,
|
||||
postId,
|
||||
commentId: comment.id
|
||||
}
|
||||
)
|
||||
session.close()
|
||||
|
||||
return comment
|
||||
}
|
||||
}
|
||||
}
|
||||
178
backend/src/resolvers/comments.spec.js
Normal file
178
backend/src/resolvers/comments.spec.js
Normal file
@ -0,0 +1,178 @@
|
||||
import Factory from '../seed/factories'
|
||||
import { GraphQLClient } from 'graphql-request'
|
||||
import { host, login } from '../jest/helpers'
|
||||
|
||||
const factory = Factory()
|
||||
let client
|
||||
let createCommentVariables
|
||||
let createPostVariables
|
||||
let createCommentVariablesSansPostId
|
||||
let createCommentVariablesWithNonExistentPost
|
||||
|
||||
beforeEach(async () => {
|
||||
await factory.create('User', {
|
||||
email: 'test@example.org',
|
||||
password: '1234'
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await factory.cleanDatabase()
|
||||
})
|
||||
|
||||
describe('CreateComment', () => {
|
||||
const createCommentMutation = `
|
||||
mutation($postId: ID, $content: String!) {
|
||||
CreateComment(postId: $postId, content: $content) {
|
||||
id
|
||||
content
|
||||
}
|
||||
}
|
||||
`
|
||||
const createPostMutation = `
|
||||
mutation($id: ID!, $title: String!, $content: String!) {
|
||||
CreatePost(id: $id, title: $title, content: $content) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`
|
||||
const commentQueryForPostId = `
|
||||
query($content: String) {
|
||||
Comment(content: $content) {
|
||||
postId
|
||||
}
|
||||
}
|
||||
`
|
||||
describe('unauthenticated', () => {
|
||||
it('throws authorization error', async () => {
|
||||
createCommentVariables = {
|
||||
postId: 'p1',
|
||||
content: 'I\'m not authorised to comment'
|
||||
}
|
||||
client = new GraphQLClient(host)
|
||||
await expect(client.request(createCommentMutation, createCommentVariables)).rejects.toThrow('Not Authorised')
|
||||
})
|
||||
})
|
||||
|
||||
describe('authenticated', () => {
|
||||
let headers
|
||||
beforeEach(async () => {
|
||||
headers = await login({ email: 'test@example.org', password: '1234' })
|
||||
client = new GraphQLClient(host, { headers })
|
||||
createCommentVariables = {
|
||||
postId: 'p1',
|
||||
content: 'I\'m authorised to comment'
|
||||
}
|
||||
createPostVariables = {
|
||||
id: 'p1',
|
||||
title: 'post to comment on',
|
||||
content: 'please comment on me'
|
||||
}
|
||||
await client.request(createPostMutation, createPostVariables)
|
||||
})
|
||||
|
||||
it('creates a comment', async () => {
|
||||
const expected = {
|
||||
CreateComment: {
|
||||
content: 'I\'m authorised to comment'
|
||||
}
|
||||
}
|
||||
|
||||
await expect(client.request(createCommentMutation, createCommentVariables)).resolves.toMatchObject(expected)
|
||||
})
|
||||
|
||||
it('assigns the authenticated user as author', async () => {
|
||||
await client.request(createCommentMutation, createCommentVariables)
|
||||
|
||||
const { User } = await client.request(`{
|
||||
User(email: "test@example.org") {
|
||||
comments {
|
||||
content
|
||||
}
|
||||
}
|
||||
}`)
|
||||
|
||||
expect(User).toEqual([ { comments: [ { content: 'I\'m authorised to comment' } ] } ])
|
||||
})
|
||||
|
||||
it('throw an error if an empty string is sent from the editor as content', async () => {
|
||||
createCommentVariables = {
|
||||
postId: 'p1',
|
||||
content: '<p></p>'
|
||||
}
|
||||
|
||||
await expect(client.request(createCommentMutation, createCommentVariables))
|
||||
.rejects.toThrow('Comment must be at least 1 character long!')
|
||||
})
|
||||
|
||||
it('throws an error if a comment sent from the editor does not contain a single character', async () => {
|
||||
createCommentVariables = {
|
||||
postId: 'p1',
|
||||
content: '<p> </p>'
|
||||
}
|
||||
|
||||
await expect(client.request(createCommentMutation, createCommentVariables))
|
||||
.rejects.toThrow('Comment must be at least 1 character long!')
|
||||
})
|
||||
|
||||
it('throws an error if postId is sent as an empty string', async () => {
|
||||
createCommentVariables = {
|
||||
postId: 'p1',
|
||||
content: ''
|
||||
}
|
||||
|
||||
await expect(client.request(createCommentMutation, createCommentVariables))
|
||||
.rejects.toThrow('Comment must be at least 1 character long!')
|
||||
})
|
||||
|
||||
it('throws an error if content is sent as an string of empty characters', async () => {
|
||||
createCommentVariables = {
|
||||
postId: 'p1',
|
||||
content: ' '
|
||||
}
|
||||
|
||||
await expect(client.request(createCommentMutation, createCommentVariables))
|
||||
.rejects.toThrow('Comment must be at least 1 character long!')
|
||||
})
|
||||
|
||||
it('throws an error if postId is sent as an empty string', async () => {
|
||||
createCommentVariablesSansPostId = {
|
||||
postId: '',
|
||||
content: 'this comment should not be created'
|
||||
}
|
||||
|
||||
await expect(client.request(createCommentMutation, createCommentVariablesSansPostId))
|
||||
.rejects.toThrow('Comment cannot be created without a post!')
|
||||
})
|
||||
|
||||
it('throws an error if postId is sent as an string of empty characters', async () => {
|
||||
createCommentVariablesSansPostId = {
|
||||
postId: ' ',
|
||||
content: 'this comment should not be created'
|
||||
}
|
||||
|
||||
await expect(client.request(createCommentMutation, createCommentVariablesSansPostId))
|
||||
.rejects.toThrow('Comment cannot be created without a post!')
|
||||
})
|
||||
|
||||
it('throws an error if the post does not exist in the database', async () => {
|
||||
createCommentVariablesWithNonExistentPost = {
|
||||
postId: 'p2',
|
||||
content: 'comment should not be created cause the post doesn\'t exist'
|
||||
}
|
||||
|
||||
await expect(client.request(createCommentMutation, createCommentVariablesWithNonExistentPost))
|
||||
.rejects.toThrow('Comment cannot be created without a post!')
|
||||
})
|
||||
|
||||
it('does not create the comment with the postId as an attribute', async () => {
|
||||
const commentQueryVariablesByContent = {
|
||||
content: 'I\'m authorised to comment'
|
||||
}
|
||||
|
||||
await client.request(createCommentMutation, createCommentVariables)
|
||||
const { Comment } = await client.request(commentQueryForPostId, commentQueryVariablesByContent)
|
||||
expect(Comment).toEqual([{ postId: null }])
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -16,6 +16,9 @@ const setupAuthenticateClient = (params) => {
|
||||
|
||||
let createResource
|
||||
let authenticateClient
|
||||
let createPostVariables
|
||||
let createCommentVariables
|
||||
|
||||
beforeEach(() => {
|
||||
createResource = () => {}
|
||||
authenticateClient = () => {
|
||||
@ -103,18 +106,21 @@ describe('disable', () => {
|
||||
variables = {
|
||||
id: 'c47'
|
||||
}
|
||||
|
||||
createPostVariables = {
|
||||
id: 'p3',
|
||||
title: 'post to comment on',
|
||||
content: 'please comment on me'
|
||||
}
|
||||
createCommentVariables = {
|
||||
id: 'c47',
|
||||
postId: 'p3',
|
||||
content: 'this comment was created for this post'
|
||||
}
|
||||
createResource = async () => {
|
||||
await factory.create('User', { id: 'u45', email: 'commenter@example.org', password: '1234' })
|
||||
await factory.authenticateAs({ email: 'commenter@example.org', password: '1234' })
|
||||
await Promise.all([
|
||||
factory.create('Post', { id: 'p3' }),
|
||||
factory.create('Comment', { id: 'c47' })
|
||||
])
|
||||
await Promise.all([
|
||||
factory.relate('Comment', 'Author', { from: 'u45', to: 'c47' }),
|
||||
factory.relate('Comment', 'Post', { from: 'c47', to: 'p3' })
|
||||
])
|
||||
const asAuthenticatedUser = await factory.authenticateAs({ email: 'commenter@example.org', password: '1234' })
|
||||
await asAuthenticatedUser.create('Post', createPostVariables)
|
||||
await asAuthenticatedUser.create('Comment', createCommentVariables)
|
||||
}
|
||||
})
|
||||
|
||||
@ -277,18 +283,21 @@ describe('enable', () => {
|
||||
variables = {
|
||||
id: 'c456'
|
||||
}
|
||||
|
||||
createPostVariables = {
|
||||
id: 'p9',
|
||||
title: 'post to comment on',
|
||||
content: 'please comment on me'
|
||||
}
|
||||
createCommentVariables = {
|
||||
id: 'c456',
|
||||
postId: 'p9',
|
||||
content: 'this comment was created for this post'
|
||||
}
|
||||
createResource = async () => {
|
||||
await factory.create('User', { id: 'u123', email: 'author@example.org', password: '1234' })
|
||||
await factory.authenticateAs({ email: 'author@example.org', password: '1234' })
|
||||
await Promise.all([
|
||||
factory.create('Post', { id: 'p9' }),
|
||||
factory.create('Comment', { id: 'c456' })
|
||||
])
|
||||
await Promise.all([
|
||||
factory.relate('Comment', 'Author', { from: 'u123', to: 'c456' }),
|
||||
factory.relate('Comment', 'Post', { from: 'c456', to: 'p9' })
|
||||
])
|
||||
const asAuthenticatedUser = await factory.authenticateAs({ email: 'author@example.org', password: '1234' })
|
||||
await asAuthenticatedUser.create('Post', createPostVariables)
|
||||
await asAuthenticatedUser.create('Comment', createCommentVariables)
|
||||
|
||||
const disableMutation = `
|
||||
mutation {
|
||||
|
||||
@ -9,6 +9,7 @@ describe('report', () => {
|
||||
let headers
|
||||
let returnedObject
|
||||
let variables
|
||||
let createPostVariables
|
||||
|
||||
beforeEach(async () => {
|
||||
returnedObject = '{ description }'
|
||||
@ -128,8 +129,14 @@ describe('report', () => {
|
||||
|
||||
describe('reported resource is a comment', () => {
|
||||
beforeEach(async () => {
|
||||
await factory.authenticateAs({ email: 'test@example.org', password: '1234' })
|
||||
await factory.create('Comment', { id: 'c34', content: 'Robert getting tired.' })
|
||||
createPostVariables = {
|
||||
id: 'p1',
|
||||
title: 'post to comment on',
|
||||
content: 'please comment on me'
|
||||
}
|
||||
const asAuthenticatedUser = await factory.authenticateAs({ email: 'test@example.org', password: '1234' })
|
||||
await asAuthenticatedUser.create('Post', createPostVariables)
|
||||
await asAuthenticatedUser.create('Comment', { postId: 'p1', id: 'c34', content: 'Robert getting tired.' })
|
||||
variables = { id: 'c34' }
|
||||
})
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ import { neo4jgraphql } from 'neo4j-graphql-js'
|
||||
export default {
|
||||
Mutation: {
|
||||
CreateSocialMedia: async (object, params, context, resolveInfo) => {
|
||||
const socialMedia = await neo4jgraphql(object, params, context, resolveInfo, true)
|
||||
const socialMedia = await neo4jgraphql(object, params, context, resolveInfo, false)
|
||||
const session = context.driver.session()
|
||||
await session.run(
|
||||
`MATCH (owner:User {id: $userId}), (socialMedia:SocialMedia {id: $socialMediaId})
|
||||
|
||||
@ -16,6 +16,7 @@ type Query {
|
||||
LIMIT $limit
|
||||
"""
|
||||
)
|
||||
CommentByPost(postId: ID!): [Comment]!
|
||||
}
|
||||
type Mutation {
|
||||
# Get a JWT Token for the given Email and password
|
||||
@ -210,6 +211,7 @@ type Post {
|
||||
type Comment {
|
||||
id: ID!
|
||||
activityId: String
|
||||
postId: ID
|
||||
author: User @relation(name: "WROTE", direction: "IN")
|
||||
content: String!
|
||||
contentExcerpt: String
|
||||
|
||||
@ -4,6 +4,7 @@ import uuid from 'uuid/v4'
|
||||
export default function (params) {
|
||||
const {
|
||||
id = uuid(),
|
||||
postId = 'p6',
|
||||
content = [
|
||||
faker.lorem.sentence(),
|
||||
faker.lorem.sentence()
|
||||
@ -12,12 +13,12 @@ export default function (params) {
|
||||
|
||||
return {
|
||||
mutation: `
|
||||
mutation($id: ID!, $content: String!) {
|
||||
CreateComment(id: $id, content: $content) {
|
||||
mutation($id: ID!, $postId: ID, $content: String!) {
|
||||
CreateComment(id: $id, postId: $postId, content: $content) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`,
|
||||
variables: { id, content }
|
||||
variables: { id, postId, content }
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,45 +189,18 @@ import Factory from './factories'
|
||||
])
|
||||
|
||||
await Promise.all([
|
||||
f.create('Comment', { id: 'c1' }),
|
||||
f.create('Comment', { id: 'c2' }),
|
||||
f.create('Comment', { id: 'c3' }),
|
||||
f.create('Comment', { id: 'c4' }),
|
||||
f.create('Comment', { id: 'c5' }),
|
||||
f.create('Comment', { id: 'c6' }),
|
||||
f.create('Comment', { id: 'c7' }),
|
||||
f.create('Comment', { id: 'c8' }),
|
||||
f.create('Comment', { id: 'c9' }),
|
||||
f.create('Comment', { id: 'c10' }),
|
||||
f.create('Comment', { id: 'c11' }),
|
||||
f.create('Comment', { id: 'c12' })
|
||||
])
|
||||
|
||||
await Promise.all([
|
||||
f.relate('Comment', 'Author', { from: 'u3', to: 'c1' }),
|
||||
f.relate('Comment', 'Post', { from: 'c1', to: 'p1' }),
|
||||
f.relate('Comment', 'Author', { from: 'u1', to: 'c2' }),
|
||||
f.relate('Comment', 'Post', { from: 'c2', to: 'p1' }),
|
||||
f.relate('Comment', 'Author', { from: 'u1', to: 'c3' }),
|
||||
f.relate('Comment', 'Post', { from: 'c3', to: 'p3' }),
|
||||
f.relate('Comment', 'Author', { from: 'u4', to: 'c4' }),
|
||||
f.relate('Comment', 'Post', { from: 'c4', to: 'p2' }),
|
||||
f.relate('Comment', 'Author', { from: 'u4', to: 'c5' }),
|
||||
f.relate('Comment', 'Post', { from: 'c5', to: 'p3' }),
|
||||
f.relate('Comment', 'Author', { from: 'u3', to: 'c6' }),
|
||||
f.relate('Comment', 'Post', { from: 'c6', to: 'p4' }),
|
||||
f.relate('Comment', 'Author', { from: 'u2', to: 'c7' }),
|
||||
f.relate('Comment', 'Post', { from: 'c7', to: 'p2' }),
|
||||
f.relate('Comment', 'Author', { from: 'u5', to: 'c8' }),
|
||||
f.relate('Comment', 'Post', { from: 'c8', to: 'p15' }),
|
||||
f.relate('Comment', 'Author', { from: 'u6', to: 'c9' }),
|
||||
f.relate('Comment', 'Post', { from: 'c9', to: 'p15' }),
|
||||
f.relate('Comment', 'Author', { from: 'u7', to: 'c10' }),
|
||||
f.relate('Comment', 'Post', { from: 'c10', to: 'p15' }),
|
||||
f.relate('Comment', 'Author', { from: 'u5', to: 'c11' }),
|
||||
f.relate('Comment', 'Post', { from: 'c11', to: 'p15' }),
|
||||
f.relate('Comment', 'Author', { from: 'u6', to: 'c12' }),
|
||||
f.relate('Comment', 'Post', { from: 'c12', to: 'p15' })
|
||||
asUser.create('Comment', { id: 'c1', postId: 'p1' }),
|
||||
asTick.create('Comment', { id: 'c2', postId: 'p1' }),
|
||||
asTrack.create('Comment', { id: 'c3', postId: 'p3' }),
|
||||
asTrick.create('Comment', { id: 'c4', postId: 'p2' }),
|
||||
asModerator.create('Comment', { id: 'c5', postId: 'p3' }),
|
||||
asAdmin.create('Comment', { id: 'c6', postId: 'p4' }),
|
||||
asUser.create('Comment', { id: 'c7', postId: 'p2' }),
|
||||
asTick.create('Comment', { id: 'c8', postId: 'p15' }),
|
||||
asTrick.create('Comment', { id: 'c9', postId: 'p15' }),
|
||||
asTrack.create('Comment', { id: 'c10', postId: 'p15' }),
|
||||
asUser.create('Comment', { id: 'c11', postId: 'p15' }),
|
||||
asUser.create('Comment', { id: 'c12', postId: 'p15' })
|
||||
])
|
||||
|
||||
const disableMutation = 'mutation($id: ID!) { disable(id: $id) }'
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,17 +0,0 @@
|
||||
// ***********************************************************
|
||||
// This example plugins/index.js can be used to load plugins
|
||||
//
|
||||
// You can change the location of this file or turn off loading
|
||||
// the plugins file with the 'pluginsFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/plugins-guide
|
||||
// ***********************************************************
|
||||
|
||||
// This function is called when a project is opened or re-opened (e.g. due to
|
||||
// the project's config changing)
|
||||
|
||||
module.exports = (on, config) => {
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
// ***********************************************
|
||||
// This example commands.js shows you how to
|
||||
// create various custom commands and overwrite
|
||||
// existing commands.
|
||||
//
|
||||
// For more comprehensive examples of custom
|
||||
// commands please read more here:
|
||||
// https://on.cypress.io/custom-commands
|
||||
// ***********************************************
|
||||
//
|
||||
//
|
||||
// -- This is a parent command --
|
||||
// Cypress.Commands.add("login", (email, password) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a child command --
|
||||
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a dual command --
|
||||
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is will overwrite an existing command --
|
||||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
||||
@ -1,20 +0,0 @@
|
||||
// ***********************************************************
|
||||
// This example support/index.js is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
25
cypress/integration/common/post.js
Normal file
25
cypress/integration/common/post.js
Normal file
@ -0,0 +1,25 @@
|
||||
import { When, Then } from 'cypress-cucumber-preprocessor/steps'
|
||||
|
||||
const narratorAvatar = 'https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg'
|
||||
|
||||
Then('I click on the {string} button', text => {
|
||||
cy.get('button').contains(text).click()
|
||||
})
|
||||
|
||||
Then('my comment should be successfully created', () => {
|
||||
cy.get('.iziToast-message')
|
||||
.contains('Comment Submitted')
|
||||
})
|
||||
|
||||
Then('I should see my comment', () => {
|
||||
cy.get('div.comment p')
|
||||
.should('contain', 'Human Connection rocks')
|
||||
.get('.ds-avatar img')
|
||||
.should('have.attr', 'src')
|
||||
.and('contain', narratorAvatar)
|
||||
})
|
||||
|
||||
Then('the editor should be cleared', () => {
|
||||
cy.get('.ProseMirror p')
|
||||
.should('have.class', 'is-empty')
|
||||
})
|
||||
@ -49,25 +49,20 @@ When('I click on "Report Post" from the content menu of the post', () => {
|
||||
.click()
|
||||
})
|
||||
|
||||
When(
|
||||
'I click on "Report User" from the content menu in the user info box',
|
||||
() => {
|
||||
cy.contains('.ds-card', davidIrvingName)
|
||||
.find('.content-menu-trigger')
|
||||
.first()
|
||||
.click({force: true})
|
||||
When('I click on "Report User" from the content menu in the user info box', () => {
|
||||
cy.contains('.ds-card', davidIrvingPostTitle)
|
||||
.get('.user-content-menu .content-menu-trigger')
|
||||
.click({ force: true })
|
||||
|
||||
cy.get('.popover .ds-menu-item-link')
|
||||
.contains('Report User')
|
||||
.click()
|
||||
}
|
||||
)
|
||||
cy.get('.popover .ds-menu-item-link')
|
||||
.contains('Report User')
|
||||
.click()
|
||||
})
|
||||
|
||||
When('I click on the author', () => {
|
||||
cy.get('a.user')
|
||||
.first()
|
||||
cy.get('.username')
|
||||
.click()
|
||||
.wait(200)
|
||||
.url().should('include', '/profile/')
|
||||
})
|
||||
|
||||
When('I report the author', () => {
|
||||
|
||||
@ -11,6 +11,7 @@ let loginCredentials = {
|
||||
}
|
||||
const narratorParams = {
|
||||
name: 'Peter Pan',
|
||||
avatar: 'https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg',
|
||||
...loginCredentials
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Feature: Report and Moderate
|
||||
As a user
|
||||
I would like to report content that viloates the community guidlines
|
||||
I would like to report content that violates the community guidlines
|
||||
So the moderators can take action on it
|
||||
|
||||
As a moderator
|
||||
@ -12,18 +12,19 @@ Feature: Report and Moderate
|
||||
| Author | id | title | content |
|
||||
| David Irving | p1 | The Truth about the Holocaust | It never existed! |
|
||||
|
||||
|
||||
Scenario Outline: Report a post from various pages
|
||||
Given I am logged in with a "user" role
|
||||
When I see David Irving's post on the <Page>
|
||||
And I click on "Report Post" from the content menu of the post
|
||||
And I confirm the reporting dialog because it is a criminal act under German law:
|
||||
"""
|
||||
Do you really want to report the contribution "The Truth about the Holocaust"?
|
||||
"""
|
||||
"""
|
||||
Do you really want to report the contribution "The Truth about the Holocaust"?
|
||||
"""
|
||||
Then I see a success message:
|
||||
"""
|
||||
Thanks for reporting!
|
||||
"""
|
||||
"""
|
||||
Thanks for reporting!
|
||||
"""
|
||||
Examples:
|
||||
| Page |
|
||||
| landing page |
|
||||
@ -35,13 +36,13 @@ Feature: Report and Moderate
|
||||
When I click on the author
|
||||
And I click on "Report User" from the content menu in the user info box
|
||||
And I confirm the reporting dialog because he is a holocaust denier:
|
||||
"""
|
||||
Do you really want to report the user "David Irving"?
|
||||
"""
|
||||
"""
|
||||
Do you really want to report the user "David Irving"?
|
||||
"""
|
||||
Then I see a success message:
|
||||
"""
|
||||
Thanks for reporting!
|
||||
"""
|
||||
"""
|
||||
Thanks for reporting!
|
||||
"""
|
||||
|
||||
Scenario: Review reported content
|
||||
Given somebody reported the following posts:
|
||||
|
||||
22
cypress/integration/post/Comment.feature
Normal file
22
cypress/integration/post/Comment.feature
Normal file
@ -0,0 +1,22 @@
|
||||
Feature: Post Comment
|
||||
As a user
|
||||
I want to comment on contributions of others
|
||||
To be able to express my thoughts and emotions about these, discuss, and add give further information.
|
||||
|
||||
Background:
|
||||
Given we have the following posts in our database:
|
||||
| id | title | slug |
|
||||
| bWBjpkTKZp | 101 Essays that will change the way you think | 101-essays |
|
||||
And I have a user account
|
||||
And I am logged in
|
||||
|
||||
Scenario: Comment creation
|
||||
Given I visit "post/bWBjpkTKZp/101-essays"
|
||||
And I type in the following text:
|
||||
"""
|
||||
Human Connection rocks
|
||||
"""
|
||||
And I click on the "Comment" button
|
||||
Then my comment should be successfully created
|
||||
And I should see my comment
|
||||
And the editor should be cleared
|
||||
@ -14,8 +14,13 @@
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
|
||||
import './commands'
|
||||
import './factories'
|
||||
|
||||
// intermittent failing tests
|
||||
import 'cypress-plugin-retries'
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
|
||||
|
||||
5
deployment/.gitignore
vendored
5
deployment/.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
secrets.yaml
|
||||
*/secrets.yaml
|
||||
kubeconfig.yaml
|
||||
configmap.yaml
|
||||
**/secrets.yaml
|
||||
**/configmap.yaml
|
||||
|
||||
@ -4,223 +4,8 @@ We deploy with [kubernetes](https://kubernetes.io/). In order to deploy your own
|
||||
network you have to [install kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
|
||||
and get a kubernetes cluster.
|
||||
|
||||
We have tested two different kubernetes providers: [Minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/)
|
||||
and [Digital Ocean](https://www.digitalocean.com/).
|
||||
|
||||
## Minikube
|
||||
|
||||
There are many Kubernetes providers, but if you're just getting started, Minikube is a tool that you can use to get your feet wet.
|
||||
|
||||
[Install Minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/)
|
||||
|
||||
Open minikube dashboard:
|
||||
|
||||
```text
|
||||
$ minikube dashboard
|
||||
```
|
||||
|
||||
This will give you an overview. Some of the steps below need some timing to make ressources available to other dependent deployments. Keeping an eye on the dashboard is a great way to check that.
|
||||
|
||||
Follow the [installation instruction](deployment.md#installation-with-kubernetes) below. If all the pods and services have settled and everything looks green in your minikube dashboard, expose the `nitro-web` service on your host system with:
|
||||
|
||||
```text
|
||||
$ minikube service nitro-web --namespace=human-connection
|
||||
```
|
||||
|
||||
## Digital Ocean
|
||||
|
||||
1. At first, create a cluster on Digital Ocean.
|
||||
2. Download the config.yaml if the process has finished.
|
||||
3. Put the config file where you can find it later \(preferable in your home directory under `~/.kube/`\)
|
||||
4. In the open terminal you can set the current config for the active session: `export KUBECONFIG=~/.kube/THE-NAME-OF-YOUR-CLUSTER-kubeconfig.yaml`. You could make this change permanent by adding the line to your `.bashrc` or `~/.config/fish/config.fish` depending on your shell.
|
||||
|
||||
Otherwise you would have to always add `--kubeconfig ~/.kube/THE-NAME-OF-YOUR-CLUSTER-kubeconfig.yaml` on every `kubectl` command that you are running.
|
||||
|
||||
5. Now check if you can connect to the cluster and if its your newly created one by running: `kubectl get nodes`
|
||||
|
||||
If you got the steps right above and see your nodes you can continue.
|
||||
|
||||
First, install kubernetes dashboard:
|
||||
|
||||
```bash
|
||||
$ kubectl apply -f dashboard/
|
||||
$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended/kubernetes-dashboard.yaml
|
||||
```
|
||||
|
||||
Get your token on the command line:
|
||||
|
||||
```bash
|
||||
$ kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')
|
||||
```
|
||||
|
||||
It should print something like:
|
||||
|
||||
```text
|
||||
Name: admin-user-token-6gl6l
|
||||
Namespace: kube-system
|
||||
Labels: <none>
|
||||
Annotations: kubernetes.io/service-account.name=admin-user
|
||||
kubernetes.io/service-account.uid=b16afba9-dfec-11e7-bbb9-901b0e532516
|
||||
|
||||
Type: kubernetes.io/service-account-token
|
||||
|
||||
Data
|
||||
====
|
||||
ca.crt: 1025 bytes
|
||||
namespace: 11 bytes
|
||||
token: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJhZG1pbi11c2VyLXRva2VuLTZnbDZsIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImFkbWluLXVzZXIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJiMTZhZmJhOS1kZmVjLTExZTctYmJiOS05MDFiMGU1MzI1MTYiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06YWRtaW4tdXNlciJ9.M70CU3lbu3PP4OjhFms8PVL5pQKj-jj4RNSLA4YmQfTXpPUuxqXjiTf094_Rzr0fgN_IVX6gC4fiNUL5ynx9KU-lkPfk0HnX8scxfJNzypL039mpGt0bbe1IXKSIRaq_9VW59Xz-yBUhycYcKPO9RM2Qa1Ax29nqNVko4vLn1_1wPqJ6XSq3GYI8anTzV8Fku4jasUwjrws6Cn6_sPEGmL54sq5R4Z5afUtv-mItTmqZZdxnkRqcJLlg2Y8WbCPogErbsaCDJoABQ7ppaqHetwfM_0yMun6ABOQbIwwl8pspJhpplKwyo700OSpvTT9zlBsu-b35lzXGBRHzv5g_RA
|
||||
```
|
||||
|
||||
Proxy localhost to the remote kubernetes dashboard:
|
||||
|
||||
```bash
|
||||
$ kubectl proxy
|
||||
```
|
||||
|
||||
Grab the token from above and paste it into the login screen at [http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/](http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/)
|
||||
|
||||
## Installation with kubernetes
|
||||
|
||||
You have to do some prerequisites e.g. change some secrets according to your own setup.
|
||||
|
||||
### Edit secrets
|
||||
|
||||
```bash
|
||||
$ cp secrets.template.yaml human-connection/secrets.yaml
|
||||
```
|
||||
|
||||
Change all secrets as needed.
|
||||
|
||||
If you want to edit secrets, you have to `base64` encode them. See [kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/secret/#creating-a-secret-manually).
|
||||
|
||||
```text
|
||||
# example how to base64 a string:
|
||||
$ echo -n 'admin' | base64
|
||||
YWRtaW4=
|
||||
```
|
||||
|
||||
Those secrets get `base64` decoded in a kubernetes pod.
|
||||
|
||||
### Create a namespace
|
||||
|
||||
```text
|
||||
$ kubectl apply -f namespace-human-connection.yaml
|
||||
```
|
||||
|
||||
Switch to the namespace `human-connection` in your kubernetes dashboard.
|
||||
|
||||
### Run the configuration
|
||||
|
||||
```text
|
||||
$ kubectl apply -f human-connection/
|
||||
```
|
||||
|
||||
This can take a while because kubernetes will download the docker images. Sit back and relax and have a look into your kubernetes dashboard. Wait until all pods turn green and they don't show a warning `Waiting: ContainerCreating` anymore.
|
||||
|
||||
#### Setup Ingress and HTTPS
|
||||
|
||||
Follow [this quick start guide](https://docs.cert-manager.io/en/latest/tutorials/acme/quick-start/index.html) and install certmanager via helm and tiller:
|
||||
|
||||
```text
|
||||
$ kubectl create serviceaccount tiller --namespace=kube-system
|
||||
$ kubectl create clusterrolebinding tiller-admin --serviceaccount=kube-system:tiller --clusterrole=cluster-admin
|
||||
$ helm init --service-account=tiller
|
||||
$ helm repo update
|
||||
$ helm install stable/nginx-ingress
|
||||
$ kubectl apply -f https://raw.githubusercontent.com/jetstack/cert-manager/release-0.6/deploy/manifests/00-crds.yaml
|
||||
$ helm install --name cert-manager --namespace cert-manager stable/cert-manager
|
||||
```
|
||||
|
||||
Create letsencrypt issuers. _Change the email address_ in these files before running this command.
|
||||
|
||||
```bash
|
||||
$ kubectl apply -f human-connection/https/
|
||||
```
|
||||
|
||||
Create an ingress service in namespace `human-connection`. _Change the domain name_ according to your needs:
|
||||
|
||||
```bash
|
||||
$ kubectl apply -f human-connection/ingress/
|
||||
```
|
||||
|
||||
Check the ingress server is working correctly:
|
||||
|
||||
```bash
|
||||
$ curl -kivL -H 'Host: <DOMAIN_NAME>' 'https://<IP_ADDRESS>'
|
||||
```
|
||||
|
||||
If the response looks good, configure your domain registrar for the new IP address and the domain.
|
||||
|
||||
Now let's get a valid HTTPS certificate. According to the tutorial above, check your tls certificate for staging:
|
||||
|
||||
```bash
|
||||
$ kubectl describe --namespace=human-connection certificate tls
|
||||
$ kubectl describe --namespace=human-connection secret tls
|
||||
```
|
||||
|
||||
If everything looks good, update the issuer of your ingress. Change the annotation `certmanager.k8s.io/issuer` from `letsencrypt-staging` to `letsencrypt-prod` in your ingress configuration in `human-connection/ingress/ingress.yaml`.
|
||||
|
||||
```bash
|
||||
$ kubectl apply -f human-connection/ingress/ingress.yaml
|
||||
```
|
||||
|
||||
Delete the former secret to force a refresh:
|
||||
|
||||
```text
|
||||
$ kubectl --namespace=human-connection delete secret tls
|
||||
```
|
||||
|
||||
Now, HTTPS should be configured on your domain. Congrats.
|
||||
|
||||
#### Legacy data migration
|
||||
|
||||
This setup is completely optional and only required if you have data on a server which is running our legacy code and you want to import that data. It will import the uploads folder and migrate a dump of mongodb into neo4j.
|
||||
|
||||
**Prepare migration of Human Connection legacy server**
|
||||
|
||||
Create a configmap with the specific connection data of your legacy server:
|
||||
|
||||
```bash
|
||||
$ kubectl create configmap db-migration-worker \
|
||||
--namespace=human-connection \
|
||||
--from-literal=SSH_USERNAME=someuser \
|
||||
--from-literal=SSH_HOST=yourhost \
|
||||
--from-literal=MONGODB_USERNAME=hc-api \
|
||||
--from-literal=MONGODB_PASSWORD=secretpassword \
|
||||
--from-literal=MONGODB_AUTH_DB=hc_api \
|
||||
--from-literal=MONGODB_DATABASE=hc_api \
|
||||
--from-literal=UPLOADS_DIRECTORY=/var/www/api/uploads \
|
||||
--from-literal=NEO4J_URI=bolt://localhost:7687
|
||||
```
|
||||
|
||||
Create a secret with your public and private ssh keys. As the [kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/secret/#use-case-pod-with-ssh-keys) points out, you should be careful with your ssh keys. Anyone with access to your cluster will have access to your ssh keys. Better create a new pair with `ssh-keygen` and copy the public key to your legacy server with `ssh-copy-id`:
|
||||
|
||||
```bash
|
||||
$ kubectl create secret generic ssh-keys \
|
||||
--namespace=human-connection \
|
||||
--from-file=id_rsa=/path/to/.ssh/id_rsa \
|
||||
--from-file=id_rsa.pub=/path/to/.ssh/id_rsa.pub \
|
||||
--from-file=known_hosts=/path/to/.ssh/known_hosts
|
||||
```
|
||||
|
||||
**Migrate legacy database**
|
||||
|
||||
Patch the existing deployments to use a multi-container setup:
|
||||
|
||||
```bash
|
||||
cd legacy-migration
|
||||
kubectl apply -f volume-claim-mongo-export.yaml
|
||||
kubectl patch --namespace=human-connection deployment nitro-backend --patch "$(cat deployment-backend.yaml)"
|
||||
kubectl patch --namespace=human-connection deployment nitro-neo4j --patch "$(cat deployment-neo4j.yaml)"
|
||||
cd ..
|
||||
```
|
||||
|
||||
Run the migration:
|
||||
|
||||
```text
|
||||
$ kubectl --namespace=human-connection get pods
|
||||
# change <POD_IDs> below
|
||||
$ kubectl --namespace=human-connection exec -it nitro-neo4j-65bbdb597c-nc2lv migrate
|
||||
$ kubectl --namespace=human-connection exec -it nitro-backend-c6cc5ff69-8h96z sync_uploads
|
||||
```
|
||||
We have tested two different kubernetes providers: [Minikube](./minikube/README.md)
|
||||
and [Digital Ocean](./digital-ocean/README.md).
|
||||
|
||||
Check out the specific documentation for your provider. After that, learn how
|
||||
to apply the specific kubernetes configuration for [Human Connection](./human-connection/README.md).
|
||||
|
||||
83
deployment/backup.md
Normal file
83
deployment/backup.md
Normal file
@ -0,0 +1,83 @@
|
||||
# Backup (offline)
|
||||
|
||||
This tutorial explains how to carry out an offline backup of your Neo4J
|
||||
database in a kubernetes cluster.
|
||||
|
||||
An offline backup requires the Neo4J database to be stopped. Read
|
||||
[the docs](https://neo4j.com/docs/operations-manual/current/tools/dump-load/).
|
||||
Neo4J also offers online backups but this is available in enterprise edition
|
||||
only.
|
||||
|
||||
The tricky part is to stop the Neo4J database *without* stopping the container.
|
||||
Neo4J's docker container image starts `neo4j` by default, so we have to override
|
||||
this command with sth. that keeps the container spinning but does not terminate
|
||||
it.
|
||||
|
||||
## Stop and Restart Neo4J Database in Kubernetes
|
||||
|
||||
[This tutorial](http://bigdatums.net/2017/11/07/how-to-keep-docker-containers-running/)
|
||||
explains how to keep a docker container running. For kubernetes, the way to
|
||||
override the docker image `CMD` is explained [here](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#define-a-command-and-arguments-when-you-create-a-pod).
|
||||
|
||||
So, all we have to do is edit the kubernetes deployment of our Neo4J database
|
||||
and set a custom `command` every time we have to carry out tasks like backup,
|
||||
restore, seed etc.
|
||||
|
||||
{% hint style="info" %} TODO: implement maintenance mode {% endhint %}
|
||||
First bring the application into maintenance mode to ensure there are no
|
||||
database connections left and nobody can access the application.
|
||||
|
||||
Run the following:
|
||||
|
||||
```sh
|
||||
kubectl --namespace=human-connection edit deployment nitro-neo4j
|
||||
```
|
||||
|
||||
Add the following to `spec.template.spec.containers`:
|
||||
```
|
||||
["tail", "-f", "/dev/null"]
|
||||
```
|
||||
and write the file which will update the deployment.
|
||||
|
||||
The command `tail -f /dev/null` is the equivalent of *sleep forever*. It is a
|
||||
hack to keep the container busy and to prevent its shutdown. It will also
|
||||
override the default `neo4j` command and the kubernetes pod will not start the
|
||||
database.
|
||||
|
||||
Now perform your tasks!
|
||||
|
||||
When you're done, edit the deployment again and remove the `command`. Write the
|
||||
file and trigger an update of the deployment.
|
||||
|
||||
## Create a Backup in Kubernetes
|
||||
|
||||
First stop your Neo4J database, see above. Then:
|
||||
```sh
|
||||
kubectl --namespace=human-connection get pods
|
||||
# Copy the ID of the pod running Neo4J.
|
||||
kubectl --namespace=human-connection exec -it <POD-ID> bash
|
||||
# Once you're in the pod, dump the db to a file e.g. `/root/neo4j-backup`.
|
||||
neo4j-admin dump --to=/root/neo4j-backup
|
||||
exit
|
||||
# Download the file from the pod to your computer.
|
||||
kubectl cp human-connection/<POD-ID>:/root/neo4j-backup ./neo4j-backup
|
||||
```
|
||||
Revert your changes to deployment `nitro-neo4j` which will restart the database.
|
||||
|
||||
## Restore a Backup in Kubernetes
|
||||
|
||||
First stop your Neo4J database. Then:
|
||||
```sh
|
||||
kubectl --namespace=human-connection get pods
|
||||
# Copy the ID of the pod running Neo4J.
|
||||
# Then upload your local backup to the pod. Note that once the pod gets deleted
|
||||
# e.g. if you change the deployment, the backup file is gone with it.
|
||||
kubectl cp ./neo4j-backup human-connection/<POD-ID>:/root/
|
||||
kubectl --namespace=human-connection exec -it <POD-ID> bash
|
||||
# Once you're in the pod restore the backup and overwrite the default database
|
||||
# called `graph.db` with `--force`.
|
||||
# This will delete all existing data in database `graph.db`!
|
||||
neo4j-admin load --from=/root/neo4j-backup --force
|
||||
exit
|
||||
```
|
||||
Revert your changes to deployment `nitro-neo4j` which will restart the database.
|
||||
@ -9,8 +9,6 @@
|
||||
NEO4J_USER: "neo4j"
|
||||
NEO4J_AUTH: "none"
|
||||
CLIENT_URI: "https://nitro-staging.human-connection.org"
|
||||
MAPBOX_TOKEN: "pk.eyJ1IjoiaHVtYW4tY29ubmVjdGlvbiIsImEiOiJjajl0cnBubGoweTVlM3VwZ2lzNTNud3ZtIn0.KZ8KK9l70omjXbEkkbHGsQ"
|
||||
PRIVATE_KEY_PASSPHRASE: "a7dsf78sadg87ad87sfagsadg78"
|
||||
metadata:
|
||||
name: configmap
|
||||
namespace: human-connection
|
||||
@ -1,39 +0,0 @@
|
||||
---
|
||||
kind: Pod
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: nitro-db-migration-worker
|
||||
namespace: human-connection
|
||||
spec:
|
||||
volumes:
|
||||
- name: secret-volume
|
||||
secret:
|
||||
secretName: ssh-keys
|
||||
defaultMode: 0400
|
||||
- name: mongo-export
|
||||
persistentVolumeClaim:
|
||||
claimName: mongo-export-claim
|
||||
containers:
|
||||
- name: nitro-db-migration-worker
|
||||
image: humanconnection/db-migration-worker:latest
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: db-migration-worker
|
||||
volumeMounts:
|
||||
- name: secret-volume
|
||||
readOnly: false
|
||||
mountPath: /root/.ssh
|
||||
- name: mongo-export
|
||||
mountPath: /mongo-export/
|
||||
---
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: mongo-export-claim
|
||||
namespace: human-connection
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
26
deployment/digital-ocean/README.md
Normal file
26
deployment/digital-ocean/README.md
Normal file
@ -0,0 +1,26 @@
|
||||
# Digital Ocean
|
||||
|
||||
As a start, read the [introduction into kubernetes](https://www.digitalocean.com/community/tutorials/an-introduction-to-kubernetes) by the folks at Digital Ocean. The following section should enable you to deploy Human Connection to your kubernetes cluster.
|
||||
|
||||
## Connect to your local cluster
|
||||
|
||||
1. Create a cluster at [Digital Ocean](https://www.digitalocean.com/).
|
||||
2. Download the `***-kubeconfig.yaml` from the Web UI.
|
||||
3. Move the file to the default location where kubectl expects it to be: `mv ***-kubeconfig.yaml ~/.kube/config`. Alternatively you can set the config on every command: `--kubeconfig ***-kubeconfig.yaml`
|
||||
4. Now check if you can connect to the cluster and if its your newly created one by running: `kubectl get nodes`
|
||||
|
||||
The output should look about like this:
|
||||
```
|
||||
$ kubectl get nodes
|
||||
NAME STATUS ROLES AGE VERSION
|
||||
nifty-driscoll-uu1w Ready <none> 69d v1.13.2
|
||||
nifty-driscoll-uuiw Ready <none> 69d v1.13.2
|
||||
nifty-driscoll-uusn Ready <none> 69d v1.13.2
|
||||
```
|
||||
|
||||
If you got the steps right above and see your nodes you can continue.
|
||||
|
||||
Digital Ocean kubernetes clusters don't have a graphical interface, so I suggest
|
||||
to setup the [kubernetes dashboard](./dashboard/README.md) as a next step.
|
||||
Configuring [HTTPS](./https/README.md) is bit tricky and therefore I suggest to
|
||||
do this as a last step.
|
||||
55
deployment/digital-ocean/dashboard/README.md
Normal file
55
deployment/digital-ocean/dashboard/README.md
Normal file
@ -0,0 +1,55 @@
|
||||
# Install Kubernetes Dashboard
|
||||
|
||||
The kubernetes dashboard is optional but very helpful for debugging. If you want to install it, you have to do so only **once** per cluster:
|
||||
|
||||
```bash
|
||||
# in folder deployment/digital-ocean/
|
||||
$ kubectl apply -f dashboard/
|
||||
$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended/kubernetes-dashboard.yaml
|
||||
```
|
||||
|
||||
### Login to your dashboard
|
||||
|
||||
Proxy the remote kubernetes dashboard to localhost:
|
||||
|
||||
```bash
|
||||
$ kubectl proxy
|
||||
```
|
||||
|
||||
Visit:
|
||||
|
||||
[http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/](http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/)
|
||||
|
||||
You should see a login screen.
|
||||
|
||||
To get your token for the dashboard you can run this command:
|
||||
|
||||
```bash
|
||||
$ kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')
|
||||
```
|
||||
|
||||
It should print something like:
|
||||
|
||||
```text
|
||||
Name: admin-user-token-6gl6l
|
||||
Namespace: kube-system
|
||||
Labels: <none>
|
||||
Annotations: kubernetes.io/service-account.name=admin-user
|
||||
kubernetes.io/service-account.uid=b16afba9-dfec-11e7-bbb9-901b0e532516
|
||||
|
||||
Type: kubernetes.io/service-account-token
|
||||
|
||||
Data
|
||||
====
|
||||
ca.crt: 1025 bytes
|
||||
namespace: 11 bytes
|
||||
token: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJhZG1pbi11c2VyLXRva2VuLTZnbDZsIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6ImFkbWluLXVzZXIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiJiMTZhZmJhOS1kZmVjLTExZTctYmJiOS05MDFiMGU1MzI1MTYiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06YWRtaW4tdXNlciJ9.M70CU3lbu3PP4OjhFms8PVL5pQKj-jj4RNSLA4YmQfTXpPUuxqXjiTf094_Rzr0fgN_IVX6gC4fiNUL5ynx9KU-lkPfk0HnX8scxfJNzypL039mpGt0bbe1IXKSIRaq_9VW59Xz-yBUhycYcKPO9RM2Qa1Ax29nqNVko4vLn1_1wPqJ6XSq3GYI8anTzV8Fku4jasUwjrws6Cn6_sPEGmL54sq5R4Z5afUtv-mItTmqZZdxnkRqcJLlg2Y8WbCPogErbsaCDJoABQ7ppaqHetwfM_0yMun6ABOQbIwwl8pspJhpplKwyo700OSpvTT9zlBsu-b35lzXGBRHzv5g_RA
|
||||
```
|
||||
|
||||
Grab the token from above and paste it into the [login screen](http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/)
|
||||
|
||||
When you are logged in, you should see sth. like:
|
||||
|
||||

|
||||
|
||||
Feel free to save the login token from above in your password manager. Unlike the `kubeconfig` file, this token does not expire.
|
||||
BIN
deployment/digital-ocean/dashboard/dashboard-screenshot.png
Normal file
BIN
deployment/digital-ocean/dashboard/dashboard-screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 178 KiB |
57
deployment/digital-ocean/https/README.md
Normal file
57
deployment/digital-ocean/https/README.md
Normal file
@ -0,0 +1,57 @@
|
||||
# Setup Ingress and HTTPS
|
||||
|
||||
Follow [this quick start guide](https://docs.cert-manager.io/en/latest/tutorials/acme/quick-start/index.html) and install certmanager via helm and tiller:
|
||||
|
||||
```text
|
||||
$ kubectl create serviceaccount tiller --namespace=kube-system
|
||||
$ kubectl create clusterrolebinding tiller-admin --serviceaccount=kube-system:tiller --clusterrole=cluster-admin
|
||||
$ helm init --service-account=tiller
|
||||
$ helm repo update
|
||||
$ helm install stable/nginx-ingress
|
||||
$ kubectl apply -f https://raw.githubusercontent.com/jetstack/cert-manager/release-0.6/deploy/manifests/00-crds.yaml
|
||||
$ helm install --name cert-manager --namespace cert-manager stable/cert-manager
|
||||
```
|
||||
|
||||
Create letsencrypt issuers. _Change the email address_ in these files before running this command.
|
||||
|
||||
```bash
|
||||
# in folder deployment/digital-ocean/https/
|
||||
$ kubectl apply -f issuer.yaml
|
||||
```
|
||||
|
||||
Create an ingress service in namespace `human-connection`. _Change the domain name_ according to your needs:
|
||||
|
||||
```bash
|
||||
# in folder deployment/digital-ocean/https/
|
||||
$ kubectl apply -f ingress.yaml
|
||||
```
|
||||
|
||||
Check the ingress server is working correctly:
|
||||
|
||||
```bash
|
||||
$ curl -kivL -H 'Host: <DOMAIN_NAME>' 'https://<IP_ADDRESS>'
|
||||
```
|
||||
|
||||
If the response looks good, configure your domain registrar for the new IP address and the domain.
|
||||
|
||||
Now let's get a valid HTTPS certificate. According to the tutorial above, check your tls certificate for staging:
|
||||
|
||||
```bash
|
||||
$ kubectl describe --namespace=human-connection certificate tls
|
||||
$ kubectl describe --namespace=human-connection secret tls
|
||||
```
|
||||
|
||||
If everything looks good, update the issuer of your ingress. Change the annotation `certmanager.k8s.io/issuer` from `letsencrypt-staging` to `letsencrypt-prod` in your ingress configuration in `ingress.yaml`.
|
||||
|
||||
```bash
|
||||
# in folder deployment/digital-ocean/https/
|
||||
$ kubectl apply -f ingress.yaml
|
||||
```
|
||||
|
||||
Delete the former secret to force a refresh:
|
||||
|
||||
```text
|
||||
$ kubectl --namespace=human-connection delete secret tls
|
||||
```
|
||||
|
||||
Now, HTTPS should be configured on your domain. Congrats.
|
||||
58
deployment/human-connection/README.md
Normal file
58
deployment/human-connection/README.md
Normal file
@ -0,0 +1,58 @@
|
||||
# Kubernetes Configuration for Human Connection
|
||||
|
||||
Deploying Human Connection with kubernetes is straight forward. All you have to
|
||||
do is to change certain parameters, like domain names and API keys, then you
|
||||
just apply our provided configuration files to your cluster.
|
||||
|
||||
## Configuration
|
||||
|
||||
Copy our provided templates:
|
||||
|
||||
```bash
|
||||
$ cp secrets.template.yaml human-connection/secrets.yaml
|
||||
$ cp configmap.template.yaml human-connection/configmap.yaml
|
||||
```
|
||||
|
||||
Change the `configmap.yaml` as needed, all variables will be available as
|
||||
environment variables in your deployed kubernetes pods.
|
||||
|
||||
If you want to edit secrets, you have to `base64` encode them. See [kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/secret/#creating-a-secret-manually).
|
||||
|
||||
```bash
|
||||
# example how to base64 a string:
|
||||
$ echo -n 'admin' | base64 --wrap 0
|
||||
YWRtaW4=
|
||||
```
|
||||
|
||||
Those secrets get `base64` decoded and are available as environment variables in
|
||||
your deployed kubernetes pods.
|
||||
|
||||
## Create a namespace
|
||||
|
||||
```bash
|
||||
$ kubectl apply -f namespace-human-connection.yaml
|
||||
```
|
||||
|
||||
If you have a [kubernets dashboard](../digital-ocean/dashboard/README.md)
|
||||
deployed you should switch to namespace `human-connection` in order to
|
||||
monitor the state of your deployments.
|
||||
|
||||
## Create persistent volumes
|
||||
|
||||
While the deployments and services can easily be restored, simply by deleting
|
||||
and applying the kubernetes configurations again, certain data is not that
|
||||
easily recovered. Therefore we separated persistent volumes from deployments
|
||||
and services. There is a [dedicated section](../volumes/README.md). Create those
|
||||
persistent volumes once before you apply the configuration.
|
||||
|
||||
## Apply the configuration
|
||||
|
||||
```bash
|
||||
# in folder deployment/
|
||||
$ kubectl apply -f human-connection/
|
||||
```
|
||||
|
||||
This can take a while because kubernetes will download the docker images. Sit
|
||||
back and relax and have a look into your kubernetes dashboard. Wait until all
|
||||
pods turn green and they don't show a warning `Waiting: ContainerCreating`
|
||||
anymore.
|
||||
@ -43,15 +43,3 @@
|
||||
restartPolicy: Always
|
||||
terminationGracePeriodSeconds: 30
|
||||
status: {}
|
||||
---
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: uploads-claim
|
||||
namespace: human-connection
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 2Gi
|
||||
|
||||
@ -6,6 +6,10 @@
|
||||
namespace: human-connection
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 0
|
||||
maxUnavailable: "100%"
|
||||
selector:
|
||||
matchLabels:
|
||||
human-connection.org/selector: deployment-human-connection-neo4j
|
||||
@ -53,15 +57,3 @@
|
||||
claimName: neo4j-data-claim
|
||||
restartPolicy: Always
|
||||
terminationGracePeriodSeconds: 30
|
||||
---
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: neo4j-data-claim
|
||||
namespace: human-connection
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
|
||||
85
deployment/legacy-migration/README.md
Normal file
85
deployment/legacy-migration/README.md
Normal file
@ -0,0 +1,85 @@
|
||||
# Legacy data migration
|
||||
|
||||
This setup is **completely optional** and only required if you have data on a
|
||||
server which is running our legacy code and you want to import that data. It
|
||||
will import the uploads folder and migrate a dump of the legacy Mongo database
|
||||
into our new Neo4J graph database.
|
||||
|
||||
## Configure Maintenance-Worker Pod
|
||||
|
||||
Create a configmap with the specific connection data of your legacy server:
|
||||
|
||||
```bash
|
||||
$ kubectl create configmap maintenance-worker \
|
||||
--namespace=human-connection \
|
||||
--from-literal=SSH_USERNAME=someuser \
|
||||
--from-literal=SSH_HOST=yourhost \
|
||||
--from-literal=MONGODB_USERNAME=hc-api \
|
||||
--from-literal=MONGODB_PASSWORD=secretpassword \
|
||||
--from-literal=MONGODB_AUTH_DB=hc_api \
|
||||
--from-literal=MONGODB_DATABASE=hc_api \
|
||||
--from-literal=UPLOADS_DIRECTORY=/var/www/api/uploads
|
||||
```
|
||||
|
||||
Create a secret with your public and private ssh keys. As the [kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/secret/#use-case-pod-with-ssh-keys) points out, you should be careful with your ssh keys. Anyone with access to your cluster will have access to your ssh keys. Better create a new pair with `ssh-keygen` and copy the public key to your legacy server with `ssh-copy-id`:
|
||||
|
||||
```bash
|
||||
$ kubectl create secret generic ssh-keys \
|
||||
--namespace=human-connection \
|
||||
--from-file=id_rsa=/path/to/.ssh/id_rsa \
|
||||
--from-file=id_rsa.pub=/path/to/.ssh/id_rsa.pub \
|
||||
--from-file=known_hosts=/path/to/.ssh/known_hosts
|
||||
```
|
||||
|
||||
## Deploy a Temporary Maintenance-Worker Pod
|
||||
|
||||
Bring the application into maintenance mode.
|
||||
|
||||
{% hint style="info" %} TODO: implement maintenance mode {% endhint %}
|
||||
|
||||
|
||||
Then temporarily delete backend and database deployments
|
||||
|
||||
```bash
|
||||
$ kubectl --namespace=human-connection get deployments
|
||||
NAME READY UP-TO-DATE AVAILABLE AGE
|
||||
nitro-backend 1/1 1 1 3d11h
|
||||
nitro-neo4j 1/1 1 1 3d11h
|
||||
nitro-web 2/2 2 2 73d
|
||||
$ kubectl --namespace=human-connection delete deployment nitro-neo4j
|
||||
deployment.extensions "nitro-neo4j" deleted
|
||||
$ kubectl --namespace=human-connection delete deployment nitro-backend
|
||||
deployment.extensions "nitro-backend" deleted
|
||||
```
|
||||
|
||||
Deploy one-time maintenance-worker pod:
|
||||
|
||||
```bash
|
||||
# in deployment/legacy-migration/
|
||||
$ kubectl apply -f db-migration-worker.yaml
|
||||
pod/nitro-maintenance-worker created
|
||||
```
|
||||
|
||||
Import legacy database and uploads:
|
||||
|
||||
```bash
|
||||
$ kubectl --namespace=human-connection exec -it nitro-maintenance-worker bash
|
||||
$ import_legacy_db
|
||||
$ import_uploads
|
||||
$ exit
|
||||
```
|
||||
|
||||
Delete the pod when you're done:
|
||||
|
||||
```bash
|
||||
$ kubectl --namespace=human-connection delete pod nitro-maintenance-worker
|
||||
```
|
||||
|
||||
Oh, and of course you have to get those deleted deployments back. One way of
|
||||
doing it would be:
|
||||
|
||||
```bash
|
||||
# in folder deployment/
|
||||
$ kubectl apply -f human-connection/deployment-backend.yaml -f human-connection/deployment-neo4j.yaml
|
||||
```
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nitro-backend
|
||||
namespace: human-connection
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: nitro-db-migration-worker
|
||||
image: humanconnection/db-migration-worker:latest
|
||||
imagePullPolicy: Always
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: db-migration-worker
|
||||
volumeMounts:
|
||||
- name: secret-volume
|
||||
readOnly: false
|
||||
mountPath: /root/.ssh
|
||||
- name: uploads
|
||||
mountPath: /uploads/
|
||||
volumes:
|
||||
- name: secret-volume
|
||||
secret:
|
||||
secretName: ssh-keys
|
||||
defaultMode: 0400
|
||||
@ -1,39 +0,0 @@
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nitro-neo4j
|
||||
namespace: human-connection
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: nitro-db-migration-worker
|
||||
image: humanconnection/db-migration-worker:latest
|
||||
imagePullPolicy: Always
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: db-migration-worker
|
||||
env:
|
||||
- name: COMMIT
|
||||
value: <BACKEND_COMMIT>
|
||||
- name: NEO4J_URI
|
||||
value: bolt://localhost:7687
|
||||
volumeMounts:
|
||||
- name: secret-volume
|
||||
readOnly: false
|
||||
mountPath: /root/.ssh
|
||||
- name: mongo-export
|
||||
mountPath: /mongo-export/
|
||||
- name: nitro-neo4j
|
||||
volumeMounts:
|
||||
- mountPath: /mongo-export/
|
||||
name: mongo-export
|
||||
volumes:
|
||||
- name: secret-volume
|
||||
secret:
|
||||
secretName: ssh-keys
|
||||
defaultMode: 0400
|
||||
- name: mongo-export
|
||||
persistentVolumeClaim:
|
||||
claimName: mongo-export-claim
|
||||
34
deployment/legacy-migration/maintenance-worker.yaml
Normal file
34
deployment/legacy-migration/maintenance-worker.yaml
Normal file
@ -0,0 +1,34 @@
|
||||
---
|
||||
kind: Pod
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: nitro-maintenance-worker
|
||||
namespace: human-connection
|
||||
spec:
|
||||
containers:
|
||||
- name: nitro-maintenance-worker
|
||||
image: humanconnection/maintenance-worker:latest
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: maintenance-worker
|
||||
- configMapRef:
|
||||
name: configmap
|
||||
volumeMounts:
|
||||
- name: secret-volume
|
||||
readOnly: false
|
||||
mountPath: /root/.ssh
|
||||
- name: uploads
|
||||
mountPath: /nitro-backend/public/uploads
|
||||
- name: neo4j-data
|
||||
mountPath: /data/
|
||||
volumes:
|
||||
- name: secret-volume
|
||||
secret:
|
||||
secretName: ssh-keys
|
||||
defaultMode: 0400
|
||||
- name: uploads
|
||||
persistentVolumeClaim:
|
||||
claimName: uploads-claim
|
||||
- name: neo4j-data
|
||||
persistentVolumeClaim:
|
||||
claimName: neo4j-data-claim
|
||||
11
deployment/legacy-migration/maintenance-worker/Dockerfile
Normal file
11
deployment/legacy-migration/maintenance-worker/Dockerfile
Normal file
@ -0,0 +1,11 @@
|
||||
FROM humanconnection/neo4j:latest
|
||||
|
||||
ENV NODE_ENV=maintenance
|
||||
EXPOSE 7687 7474
|
||||
|
||||
RUN apk upgrade --update
|
||||
RUN apk add --no-cache mongodb-tools openssh nodejs yarn rsync
|
||||
|
||||
COPY known_hosts /root/.ssh/known_hosts
|
||||
COPY migration ./migration
|
||||
COPY ./binaries/* /usr/local/bin/
|
||||
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
mkdir -p ~/.ssh
|
||||
echo $SSH_PRIVATE_KEY | base64 -d > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
@ -9,4 +9,5 @@ do
|
||||
fi
|
||||
done
|
||||
|
||||
[ -z "$SSH_PRIVATE_KEY" ] || create_private_ssh_key_from_env
|
||||
rsync --archive --update --verbose ${SSH_USERNAME}@${SSH_HOST}:${UPLOADS_DIRECTORY}/* /uploads/
|
||||
@ -0,0 +1,42 @@
|
||||
version: "3.4"
|
||||
|
||||
services:
|
||||
maintenance:
|
||||
image: humanconnection/maintenance-worker:latest
|
||||
build:
|
||||
context: .
|
||||
volumes:
|
||||
- uploads:/uploads
|
||||
- neo4j-data:/data
|
||||
- ./migration/:/migration
|
||||
networks:
|
||||
- hc-network
|
||||
environment:
|
||||
- GRAPHQL_PORT=4000
|
||||
- GRAPHQL_URI=http://localhost:4000
|
||||
- CLIENT_URI=http://localhost:3000
|
||||
- JWT_SECRET=b/&&7b78BF&fv/Vd
|
||||
- MOCK=false
|
||||
- MAPBOX_TOKEN=pk.eyJ1IjoiaHVtYW4tY29ubmVjdGlvbiIsImEiOiJjajl0cnBubGoweTVlM3VwZ2lzNTNud3ZtIn0.KZ8KK9l70omjXbEkkbHGsQ
|
||||
- PRIVATE_KEY_PASSPHRASE=a7dsf78sadg87ad87sfagsadg78
|
||||
- NEO4J_URI=bolt://localhost:7687
|
||||
- NEO4J_apoc_import_file_enabled=true
|
||||
- NEO4J_AUTH=none
|
||||
- "SSH_USERNAME=${SSH_USERNAME}"
|
||||
- "SSH_HOST=${SSH_HOST}"
|
||||
- "SSH_PRIVATE_KEY=${SSH_PRIVATE_KEY}"
|
||||
- "MONGODB_USERNAME=${MONGODB_USERNAME}"
|
||||
- "MONGODB_PASSWORD=${MONGODB_PASSWORD}"
|
||||
- "MONGODB_AUTH_DB=${MONGODB_AUTH_DB}"
|
||||
- "MONGODB_DATABASE=${MONGODB_DATABASE}"
|
||||
- "UPLOADS_DIRECTORY=${UPLOADS_DIRECTORY}"
|
||||
ports:
|
||||
- 7687:7687
|
||||
- 7474:7474
|
||||
|
||||
volumes:
|
||||
uploads:
|
||||
neo4j-data:
|
||||
|
||||
networks:
|
||||
hc-network:
|
||||
@ -9,16 +9,17 @@ echo "MONGODB_DATABASE ${MONGODB_DATABASE}"
|
||||
echo "MONGODB_AUTH_DB ${MONGODB_AUTH_DB}"
|
||||
echo "-------------------------------------------------"
|
||||
|
||||
mongo ${MONGODB_DATABASE} --eval "db.dropDatabase();"
|
||||
rm -rf /mongo-export/*
|
||||
[ -z "$SSH_PRIVATE_KEY" ] || create_private_ssh_key_from_env
|
||||
|
||||
rm -rf /tmp/mongo-export/*
|
||||
mkdir -p /tmp/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=/tmp/mongodump.archive
|
||||
mongorestore --gzip --archive=/tmp/mongodump.archive
|
||||
ssh -S my-ctrl-socket -O check -l ${SSH_USERNAME} ${SSH_HOST}
|
||||
ssh -S my-ctrl-socket -O exit -l ${SSH_USERNAME} ${SSH_HOST}
|
||||
|
||||
for collection in "categories" "badges" "users" "contributions" "comments" "follows" "shouts"
|
||||
do
|
||||
mongoexport --db ${MONGODB_DATABASE} --collection $collection --out "/mongo-export/$collection.json"
|
||||
mongoexport --host localhost -d ${MONGODB_DATABASE} --port 27018 --username ${MONGODB_USERNAME} --password ${MONGODB_PASSWORD} --authenticationDatabase ${MONGODB_AUTH_DB} --db ${MONGODB_DATABASE} --collection $collection --out "/tmp/mongo-export/$collection.json"
|
||||
done
|
||||
|
||||
ssh -S my-ctrl-socket -O check -l ${SSH_USERNAME} ${SSH_HOST}
|
||||
ssh -S my-ctrl-socket -O exit -l ${SSH_USERNAME} ${SSH_HOST}
|
||||
@ -1,4 +1,4 @@
|
||||
CALL apoc.load.json('file:/mongo-export/badges.json') YIELD value as badge
|
||||
CALL apoc.load.json('file:/tmp/mongo-export/badges.json') YIELD value as badge
|
||||
MERGE(b:Badge {id: badge._id["$oid"]})
|
||||
ON CREATE SET
|
||||
b.key = badge.key,
|
||||
@ -1,4 +1,4 @@
|
||||
CALL apoc.load.json('file:/mongo-export/categories.json') YIELD value as category
|
||||
CALL apoc.load.json('file:/tmp/mongo-export/categories.json') YIELD value as category
|
||||
MERGE(c:Category {id: category._id["$oid"]})
|
||||
ON CREATE SET
|
||||
c.name = category.title,
|
||||
@ -1,4 +1,4 @@
|
||||
CALL apoc.load.json('file:/mongo-export/comments.json') YIELD value as json
|
||||
CALL apoc.load.json('file:/tmp/mongo-export/comments.json') YIELD value as json
|
||||
MERGE (comment:Comment {id: json._id["$oid"]})
|
||||
ON CREATE SET
|
||||
comment.content = json.content,
|
||||
@ -1,4 +1,4 @@
|
||||
CALL apoc.load.json('file:/mongo-export/contributions.json') YIELD value as post
|
||||
CALL apoc.load.json('file:/tmp/mongo-export/contributions.json') YIELD value as post
|
||||
MERGE (p:Post {id: post._id["$oid"]})
|
||||
ON CREATE SET
|
||||
p.title = post.title,
|
||||
@ -1,4 +1,4 @@
|
||||
CALL apoc.load.json('file:/mongo-export/follows.json') YIELD value as follow
|
||||
CALL apoc.load.json('file:/tmp/mongo-export/follows.json') YIELD value as follow
|
||||
MATCH (u1:User {id: follow.userId}), (u2:User {id: follow.foreignId})
|
||||
MERGE (u1)-[:FOLLOWS]->(u2)
|
||||
;
|
||||
@ -1,4 +1,4 @@
|
||||
CALL apoc.load.json('file:/mongo-export/shouts.json') YIELD value as shout
|
||||
CALL apoc.load.json('file:/tmp/mongo-export/shouts.json') YIELD value as shout
|
||||
MATCH (u:User {id: shout.userId}), (p:Post {id: shout.foreignId})
|
||||
MERGE (u)-[:SHOUTED]->(p)
|
||||
;
|
||||
@ -1,4 +1,4 @@
|
||||
CALL apoc.load.json('file:/mongo-export/users.json') YIELD value as user
|
||||
CALL apoc.load.json('file:/tmp/mongo-export/users.json') YIELD value as user
|
||||
MERGE(u:User {id: user._id["$oid"]})
|
||||
ON CREATE SET
|
||||
u.name = user.name,
|
||||
25
deployment/minikube/README.md
Normal file
25
deployment/minikube/README.md
Normal file
@ -0,0 +1,25 @@
|
||||
# Minikube
|
||||
|
||||
There are many Kubernetes providers, but if you're just getting started, Minikube is a tool that you can use to get your feet wet.
|
||||
|
||||
After you [installed Minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/)
|
||||
open your minikube dashboard:
|
||||
|
||||
```text
|
||||
$ minikube dashboard
|
||||
```
|
||||
|
||||
This will give you an overview. Some of the steps below need some timing to make ressources available to other dependent deployments. Keeping an eye on the dashboard is a great way to check that.
|
||||
|
||||
Follow the installation instruction for [Human Connection](../human-connection/README.md).
|
||||
If all the pods and services have settled and everything looks green in your
|
||||
minikube dashboard, expose the services you want on your host system.
|
||||
|
||||
For example:
|
||||
|
||||
```text
|
||||
$ minikube service nitro-web --namespace=human-connection
|
||||
# optionally
|
||||
$ minikube service nitro-backend --namespace=human-connection
|
||||
```
|
||||
|
||||
@ -4,6 +4,7 @@ data:
|
||||
JWT_SECRET: "Yi8mJjdiNzhCRiZmdi9WZA=="
|
||||
MONGODB_PASSWORD: "TU9OR09EQl9QQVNTV09SRA=="
|
||||
PRIVATE_KEY_PASSPHRASE: "YTdkc2Y3OHNhZGc4N2FkODdzZmFnc2FkZzc4"
|
||||
MAPBOX_TOKEN: "cGsuZXlKMUlqb2lhSFZ0WVc0dFkyOXVibVZqZEdsdmJpSXNJbUVpT2lKamFqbDBjbkJ1Ykdvd2VUVmxNM1Z3WjJsek5UTnVkM1p0SW4wLktaOEtLOWw3MG9talhiRWtrYkhHc1EK"
|
||||
metadata:
|
||||
name: human-connection
|
||||
namespace: human-connection
|
||||
|
||||
42
deployment/volumes/README.md
Normal file
42
deployment/volumes/README.md
Normal file
@ -0,0 +1,42 @@
|
||||
# Persistent Volumes
|
||||
|
||||
At the moment, the application needs two persistent volumes:
|
||||
|
||||
* The `/data/` folder where `neo4j` stores its database and
|
||||
* the folder `/nitro-backend/public/uploads` where the backend stores uploads.
|
||||
|
||||
As a matter of precaution, the persistent volume claims that setup these volumes
|
||||
live in a separate folder. You don't want to accidently loose all your data in
|
||||
your database by running `kubectl delete -f human-connection/`, do you?
|
||||
|
||||
## Create Persistent Volume Claims
|
||||
|
||||
Run the following:
|
||||
```sh
|
||||
# in folder deployments/
|
||||
$ kubectl apply -f volumes
|
||||
persistentvolumeclaim/neo4j-data-claim created
|
||||
persistentvolumeclaim/uploads-claim created
|
||||
```
|
||||
|
||||
## Change Reclaim Policy
|
||||
|
||||
We recommend to change the `ReclaimPolicy`, so if you delete the persistent
|
||||
volume claims, the associated volumes will be released, not deleted:
|
||||
|
||||
```sh
|
||||
$ kubectl --namespace=human-connection get pv
|
||||
|
||||
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
|
||||
pvc-bd02a715-66d0-11e9-be52-ba9c337f4551 1Gi RWO Delete Bound human-connection/neo4j-data-claim do-block-storage 4m24s
|
||||
pvc-bd208086-66d0-11e9-be52-ba9c337f4551 2Gi RWO Delete Bound human-connection/uploads-claim do-block-storage 4m12s
|
||||
```
|
||||
|
||||
Get the volume id from above, then change `ReclaimPolicy` with:
|
||||
```sh
|
||||
kubectl patch pv <VOLUME-ID> -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'
|
||||
|
||||
# in the above example
|
||||
kubectl patch pv pvc-bd02a715-66d0-11e9-be52-ba9c337f4551 -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'
|
||||
kubectl patch pv pvc-bd208086-66d0-11e9-be52-ba9c337f4551 -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'
|
||||
```
|
||||
@ -2,7 +2,7 @@
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: mongo-export-claim
|
||||
name: neo4j-data-claim
|
||||
namespace: human-connection
|
||||
spec:
|
||||
accessModes:
|
||||
12
deployment/volumes/uploads.yaml
Normal file
12
deployment/volumes/uploads.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: uploads-claim
|
||||
namespace: human-connection
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 2Gi
|
||||
@ -38,7 +38,7 @@ services:
|
||||
neo4j:
|
||||
image: humanconnection/neo4j:latest
|
||||
build:
|
||||
context: backend/neo4j
|
||||
context: neo4j
|
||||
networks:
|
||||
- hc-network
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
FROM neo4j:3.5.4
|
||||
FROM neo4j:3.5.5
|
||||
RUN wget https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.5.0.1/apoc-3.5.0.1-all.jar -P plugins/
|
||||
COPY migrate.sh /usr/local/bin/migrate
|
||||
@ -15,16 +15,19 @@
|
||||
"cypress:webapp": "cd webapp && cross-env GRAPHQL_URI=http://localhost:4123 yarn run dev",
|
||||
"cypress:setup": "run-p cypress:backend:* cypress:webapp",
|
||||
"cypress:run": "cypress run --browser chromium",
|
||||
"cypress:open": "cypress open --browser chromium"
|
||||
"cypress:open": "cypress open --browser chromium",
|
||||
"test:jest": "cd webapp && yarn test && cd ../backend && yarn test:jest && codecov"
|
||||
},
|
||||
"devDependencies": {
|
||||
"codecov": "^3.3.0",
|
||||
"cross-env": "^5.2.0",
|
||||
"cypress": "^3.2.0",
|
||||
"cypress-cucumber-preprocessor": "^1.11.0",
|
||||
"dotenv": "^7.0.0",
|
||||
"cypress-plugin-retries": "^1.2.0",
|
||||
"dotenv": "^8.0.0",
|
||||
"faker": "^4.1.0",
|
||||
"graphql-request": "^1.8.2",
|
||||
"neo4j-driver": "^1.7.3",
|
||||
"neo4j-driver": "^1.7.4",
|
||||
"npm-run-all": "^4.1.5"
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,7 +154,10 @@
|
||||
</ds-button>
|
||||
</div>
|
||||
</editor-floating-menu>
|
||||
<editor-content :editor="editor" />
|
||||
<editor-content
|
||||
ref="editor"
|
||||
:editor="editor"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -224,7 +227,7 @@ export default {
|
||||
new ListItem(),
|
||||
new Placeholder({
|
||||
emptyNodeClass: 'is-empty',
|
||||
emptyNodeText: 'Schreib etwas inspirerendes…'
|
||||
emptyNodeText: this.$t('editor.placeholder')
|
||||
}),
|
||||
new History(),
|
||||
new Mention({
|
||||
@ -445,6 +448,9 @@ export default {
|
||||
// remove link
|
||||
command({ href: null })
|
||||
}
|
||||
},
|
||||
clear() {
|
||||
this.editor.clearContent(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,14 +9,19 @@ localVue.use(Styleguide)
|
||||
describe('Editor.vue', () => {
|
||||
let wrapper
|
||||
let propsData
|
||||
let mocks
|
||||
|
||||
beforeEach(() => {
|
||||
propsData = {}
|
||||
mocks = {
|
||||
$t: () => {}
|
||||
}
|
||||
})
|
||||
|
||||
describe('mount', () => {
|
||||
let Wrapper = () => {
|
||||
return (wrapper = mount(Editor, {
|
||||
mocks,
|
||||
propsData,
|
||||
localVue,
|
||||
sync: false,
|
||||
|
||||
126
webapp/components/comments/CommentForm/index.vue
Normal file
126
webapp/components/comments/CommentForm/index.vue
Normal file
@ -0,0 +1,126 @@
|
||||
<template>
|
||||
<ds-form
|
||||
v-model="form"
|
||||
@submit="handleSubmit"
|
||||
>
|
||||
<template slot-scope="{ errors }">
|
||||
<ds-card>
|
||||
<no-ssr>
|
||||
<hc-editor
|
||||
ref="editor"
|
||||
:users="users"
|
||||
:value="form.content"
|
||||
@input="updateEditorContent"
|
||||
/>
|
||||
</no-ssr>
|
||||
<ds-space />
|
||||
<ds-flex :gutter="{ base: 'small', md: 'small', sm: 'x-large', xs: 'x-large' }">
|
||||
<ds-flex-item :width="{ base: '0%', md: '50%', sm: '0%', xs: '0%' }" />
|
||||
<ds-flex-item :width="{ base: '40%', md: '20%', sm: '30%', xs: '30%' }">
|
||||
<ds-button
|
||||
:disabled="disabled"
|
||||
ghost
|
||||
class="cancelBtn"
|
||||
@click.prevent="clear"
|
||||
>
|
||||
{{ $t('actions.cancel') }}
|
||||
</ds-button>
|
||||
</ds-flex-item>
|
||||
<ds-flex-item :width="{ base: '40%', md: '20%', sm: '40%', xs: '40%' }">
|
||||
<ds-button
|
||||
type="submit"
|
||||
:loading="loading"
|
||||
:disabled="disabled || errors"
|
||||
primary
|
||||
>
|
||||
{{ $t('post.comment.submit') }}
|
||||
</ds-button>
|
||||
</ds-flex-item>
|
||||
</ds-flex>
|
||||
</ds-card>
|
||||
</template>
|
||||
</ds-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import gql from 'graphql-tag'
|
||||
import HcEditor from '~/components/Editor'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
HcEditor
|
||||
},
|
||||
props: {
|
||||
post: { type: Object, default: () => {} },
|
||||
comments: { type: Array, default: () => [] }
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
disabled: true,
|
||||
loading: false,
|
||||
form: {
|
||||
content: ''
|
||||
},
|
||||
users: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateEditorContent(value) {
|
||||
const content = value.replace(/<(?:.|\n)*?>/gm, '').trim()
|
||||
if (content.length < 1) {
|
||||
this.disabled = true
|
||||
} else {
|
||||
this.disabled = false
|
||||
}
|
||||
this.form.content = value
|
||||
},
|
||||
clear() {
|
||||
this.$refs.editor.clear()
|
||||
},
|
||||
handleSubmit() {
|
||||
this.loading = true
|
||||
this.disabled = true
|
||||
this.$apollo
|
||||
.mutate({
|
||||
mutation: gql`
|
||||
mutation($postId: ID, $content: String!) {
|
||||
CreateComment(postId: $postId, content: $content) {
|
||||
id
|
||||
content
|
||||
}
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
postId: this.post.id,
|
||||
content: this.form.content
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
this.loading = false
|
||||
this.$root.$emit('refetchPostComments', res.data.CreateComment)
|
||||
this.$refs.editor.clear()
|
||||
this.$toast.success(this.$t('post.comment.submitted'))
|
||||
this.disabled = false
|
||||
})
|
||||
.catch(err => {
|
||||
this.$toast.error(err.message)
|
||||
})
|
||||
}
|
||||
},
|
||||
apollo: {
|
||||
User: {
|
||||
query() {
|
||||
return gql(`{
|
||||
User(orderBy: slug_asc) {
|
||||
id
|
||||
slug
|
||||
}
|
||||
}`)
|
||||
},
|
||||
result(result) {
|
||||
this.users = result.data.User
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
69
webapp/components/comments/CommentList/CommentList.spec.js
Normal file
69
webapp/components/comments/CommentList/CommentList.spec.js
Normal file
@ -0,0 +1,69 @@
|
||||
import { config, mount, createLocalVue } from '@vue/test-utils'
|
||||
import CommentList from '.'
|
||||
import Empty from '~/components/Empty'
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
import Filters from '~/plugins/vue-filters'
|
||||
import Styleguide from '@human-connection/styleguide'
|
||||
|
||||
const localVue = createLocalVue()
|
||||
|
||||
localVue.use(Styleguide)
|
||||
localVue.use(Vuex)
|
||||
localVue.filter('truncate', string => string)
|
||||
|
||||
config.stubs['v-popover'] = '<span><slot /></span>'
|
||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
||||
config.stubs['no-ssr'] = '<span><slot /></span>'
|
||||
|
||||
describe('CommentList.vue', () => {
|
||||
let mocks
|
||||
let store
|
||||
let wrapper
|
||||
let propsData
|
||||
let data
|
||||
|
||||
propsData = {
|
||||
post: { id: 1 }
|
||||
}
|
||||
store = new Vuex.Store({
|
||||
getters: {
|
||||
'auth/user': () => {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
})
|
||||
mocks = {
|
||||
$t: jest.fn()
|
||||
}
|
||||
data = () => {
|
||||
return {
|
||||
comments: []
|
||||
}
|
||||
}
|
||||
|
||||
describe('shallowMount', () => {
|
||||
const Wrapper = () => {
|
||||
return mount(CommentList, { store, mocks, localVue, propsData, data })
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper()
|
||||
wrapper.setData({
|
||||
comments: [{ id: 'c1', contentExcerpt: 'this is a comment' }]
|
||||
})
|
||||
})
|
||||
|
||||
it('displays a message icon when there are no comments to display', () => {
|
||||
expect(Wrapper().findAll(Empty)).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('displays a comments counter', () => {
|
||||
expect(wrapper.find('span.ds-tag').text()).toEqual('1')
|
||||
})
|
||||
|
||||
it('displays comments when there are comments to display', () => {
|
||||
expect(wrapper.find('div#comments').text()).toEqual('this is a comment')
|
||||
})
|
||||
})
|
||||
})
|
||||
80
webapp/components/comments/CommentList/index.vue
Normal file
80
webapp/components/comments/CommentList/index.vue
Normal file
@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<div>
|
||||
<h3 style="margin-top: -10px;">
|
||||
<span>
|
||||
<ds-icon name="comments" />
|
||||
<ds-tag
|
||||
v-if="comments"
|
||||
style="margin-top: -4px; margin-left: -12px; position: absolute;"
|
||||
color="primary"
|
||||
size="small"
|
||||
round
|
||||
>{{ comments.length }}</ds-tag> Comments
|
||||
</span>
|
||||
</h3>
|
||||
<ds-space margin-bottom="large" />
|
||||
<div
|
||||
v-if="comments && comments.length"
|
||||
id="comments"
|
||||
class="comments"
|
||||
>
|
||||
<comment
|
||||
v-for="comment in comments"
|
||||
:key="comment.id"
|
||||
:comment="comment"
|
||||
/>
|
||||
</div>
|
||||
<hc-empty
|
||||
v-else
|
||||
name="empty"
|
||||
icon="messages"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import Comment from '~/components/Comment.vue'
|
||||
import HcEmpty from '~/components/Empty.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Comment,
|
||||
HcEmpty
|
||||
},
|
||||
props: {
|
||||
post: { type: Object, default: () => {} }
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
comments: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
Post(post) {
|
||||
this.comments = post[0].comments || []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$root.$on('refetchPostComments', comment => {
|
||||
this.refetchPostComments(comment)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
refetchPostComments(comment) {
|
||||
this.$apollo.queries.Post.refetch()
|
||||
}
|
||||
},
|
||||
apollo: {
|
||||
Post: {
|
||||
query() {
|
||||
return require('~/graphql/PostCommentsQuery.js').default(this)
|
||||
},
|
||||
variables() {
|
||||
return {
|
||||
slug: this.post.slug
|
||||
}
|
||||
},
|
||||
fetchPolicy: 'cache-and-network'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -8,7 +8,6 @@ services:
|
||||
target: production
|
||||
ports:
|
||||
- 3000:3000
|
||||
- 8080:8080
|
||||
networks:
|
||||
- hc-network
|
||||
environment:
|
||||
|
||||
35
webapp/graphql/CommentQuery.js
Normal file
35
webapp/graphql/CommentQuery.js
Normal file
@ -0,0 +1,35 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export default app => {
|
||||
const lang = app.$i18n.locale().toUpperCase()
|
||||
return gql(`
|
||||
query Comment($postId: ID) {
|
||||
Comment(postId: $postId) {
|
||||
id
|
||||
contentExcerpt
|
||||
createdAt
|
||||
author {
|
||||
id
|
||||
slug
|
||||
name
|
||||
avatar
|
||||
disabled
|
||||
deleted
|
||||
shoutedCount
|
||||
contributionsCount
|
||||
commentsCount
|
||||
followedByCount
|
||||
followedByCurrentUser
|
||||
location {
|
||||
name: name${lang}
|
||||
}
|
||||
badges {
|
||||
id
|
||||
key
|
||||
icon
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`)
|
||||
}
|
||||
39
webapp/graphql/PostCommentsQuery.js
Normal file
39
webapp/graphql/PostCommentsQuery.js
Normal file
@ -0,0 +1,39 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export default app => {
|
||||
const lang = app.$i18n.locale().toUpperCase()
|
||||
return gql(`
|
||||
query Post($slug: String!) {
|
||||
Post(slug: $slug) {
|
||||
comments(orderBy: createdAt_asc) {
|
||||
id
|
||||
contentExcerpt
|
||||
createdAt
|
||||
disabled
|
||||
deleted
|
||||
author {
|
||||
id
|
||||
slug
|
||||
name
|
||||
avatar
|
||||
disabled
|
||||
deleted
|
||||
shoutedCount
|
||||
contributionsCount
|
||||
commentsCount
|
||||
followedByCount
|
||||
followedByCurrentUser
|
||||
location {
|
||||
name: name${lang}
|
||||
}
|
||||
badges {
|
||||
id
|
||||
key
|
||||
icon
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`)
|
||||
}
|
||||
@ -6,8 +6,13 @@
|
||||
"email": "Deine E-Mail",
|
||||
"password": "Dein Passwort",
|
||||
"moreInfo": "Was ist Human Connection?",
|
||||
"moreInfoURL": "https://human-connection.org",
|
||||
"moreInfoHint": "zur Präsentationsseite",
|
||||
"hello": "Hallo"
|
||||
},
|
||||
"editor": {
|
||||
"placeholder": "Schreib etwas Inspirierendes..."
|
||||
},
|
||||
"profile": {
|
||||
"name": "Mein Profil",
|
||||
"memberSince": "Mitglied seit",
|
||||
@ -114,6 +119,10 @@
|
||||
},
|
||||
"takeAction": {
|
||||
"name": "Aktiv werden"
|
||||
},
|
||||
"comment": {
|
||||
"submit": "Kommentiere",
|
||||
"submitted": "Kommentar Gesendet"
|
||||
}
|
||||
},
|
||||
"quotes": {
|
||||
|
||||
@ -6,8 +6,13 @@
|
||||
"email": "Your Email",
|
||||
"password": "Your Password",
|
||||
"moreInfo": "What is Human Connection?",
|
||||
"moreInfoURL": "https://human-connection.org/en/",
|
||||
"moreInfoHint": "to the presentation page",
|
||||
"hello": "Hello"
|
||||
},
|
||||
"editor": {
|
||||
"placeholder": "Leave your inspirational thoughts..."
|
||||
},
|
||||
"profile": {
|
||||
"name": "My Profile",
|
||||
"memberSince": "Member since",
|
||||
@ -114,6 +119,10 @@
|
||||
},
|
||||
"takeAction": {
|
||||
"name": "Take action"
|
||||
},
|
||||
"comment": {
|
||||
"submit": "Comment",
|
||||
"submitted": "Comment Submitted"
|
||||
}
|
||||
},
|
||||
"quotes": {
|
||||
|
||||
@ -17,6 +17,8 @@
|
||||
},
|
||||
"jest": {
|
||||
"verbose": true,
|
||||
"collectCoverage": true,
|
||||
"coverageReporters": ["text", "lcov"],
|
||||
"moduleFileExtensions": [
|
||||
"js",
|
||||
"json",
|
||||
@ -47,40 +49,40 @@
|
||||
"graphql": "~14.2.1",
|
||||
"jsonwebtoken": "~8.5.1",
|
||||
"linkify-it": "~2.1.0",
|
||||
"nuxt": "~2.6.2",
|
||||
"nuxt": "~2.6.3",
|
||||
"nuxt-env": "~0.1.0",
|
||||
"stack-utils": "^1.0.2",
|
||||
"string-hash": "^1.1.3",
|
||||
"tiptap": "^1.14.0",
|
||||
"tiptap-extensions": "^1.15.0",
|
||||
"v-tooltip": "~2.0.1",
|
||||
"tiptap": "^1.18.0",
|
||||
"tiptap-extensions": "^1.18.1",
|
||||
"v-tooltip": "~2.0.2",
|
||||
"vue-count-to": "~1.0.13",
|
||||
"vue-izitoast": "1.1.2",
|
||||
"vue-sweetalert-icons": "~3.2.0",
|
||||
"vuex-i18n": "~1.11.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "~7.4.3",
|
||||
"@babel/preset-env": "~7.4.3",
|
||||
"@vue/cli-shared-utils": "~3.6.0",
|
||||
"@babel/core": "~7.4.4",
|
||||
"@babel/preset-env": "~7.4.4",
|
||||
"@vue/cli-shared-utils": "~3.7.0",
|
||||
"@vue/eslint-config-prettier": "~4.0.1",
|
||||
"@vue/server-test-utils": "~1.0.0-beta.29",
|
||||
"@vue/test-utils": "~1.0.0-beta.29",
|
||||
"babel-core": "~7.0.0-bridge.0",
|
||||
"babel-eslint": "~10.0.1",
|
||||
"babel-jest": "~24.7.1",
|
||||
"babel-jest": "~24.8.0",
|
||||
"eslint": "~5.16.0",
|
||||
"eslint-config-prettier": "~4.1.0",
|
||||
"eslint-config-prettier": "~4.2.0",
|
||||
"eslint-loader": "~2.1.2",
|
||||
"eslint-plugin-prettier": "~3.0.1",
|
||||
"eslint-plugin-vue": "~5.2.2",
|
||||
"fuse.js": "^3.4.4",
|
||||
"jest": "~24.7.1",
|
||||
"node-sass": "~4.11.0",
|
||||
"nodemon": "~1.18.11",
|
||||
"jest": "~24.8.0",
|
||||
"node-sass": "~4.12.0",
|
||||
"nodemon": "~1.19.0",
|
||||
"prettier": "~1.14.3",
|
||||
"sass-loader": "~7.1.0",
|
||||
"tippy.js": "^4.2.1",
|
||||
"tippy.js": "^4.3.0",
|
||||
"vue-jest": "~3.0.4",
|
||||
"vue-svg-loader": "~0.12.0"
|
||||
}
|
||||
|
||||
@ -79,8 +79,8 @@
|
||||
</ds-button>
|
||||
<ds-space margin="x-small">
|
||||
<a
|
||||
href="https://human-connection.org"
|
||||
title="zur Präsentationsseite"
|
||||
:href="$t('login.moreInfoURL')"
|
||||
:title="$t('login.moreInfoHint')"
|
||||
target="_blank"
|
||||
>
|
||||
{{ $t('login.moreInfo') }}
|
||||
|
||||
@ -96,34 +96,9 @@
|
||||
<ds-space margin="small" />
|
||||
<!-- Comments -->
|
||||
<ds-section slot="footer">
|
||||
<h3 style="margin-top: 0;">
|
||||
<span>
|
||||
<ds-icon name="comments" />
|
||||
<ds-tag
|
||||
v-if="post.comments"
|
||||
style="margin-top: -4px; margin-left: -12px; position: absolute;"
|
||||
color="primary"
|
||||
size="small"
|
||||
round
|
||||
>{{ post.commentsCount }}</ds-tag> Comments
|
||||
</span>
|
||||
</h3>
|
||||
<hc-comment-list :post="post" />
|
||||
<ds-space margin-bottom="large" />
|
||||
<div
|
||||
v-if="post.comments"
|
||||
id="comments"
|
||||
class="comments"
|
||||
>
|
||||
<comment
|
||||
v-for="comment in post.comments"
|
||||
:key="comment.id"
|
||||
:comment="comment"
|
||||
/>
|
||||
</div>
|
||||
<hc-empty
|
||||
v-else
|
||||
icon="messages"
|
||||
/>
|
||||
<hc-comment-form :post="post" />
|
||||
</ds-section>
|
||||
</ds-card>
|
||||
</transition>
|
||||
@ -137,8 +112,8 @@ import HcTag from '~/components/Tag'
|
||||
import ContentMenu from '~/components/ContentMenu'
|
||||
import HcUser from '~/components/User'
|
||||
import HcShoutButton from '~/components/ShoutButton.vue'
|
||||
import HcEmpty from '~/components/Empty.vue'
|
||||
import Comment from '~/components/Comment.vue'
|
||||
import HcCommentForm from '~/components/comments/CommentForm'
|
||||
import HcCommentList from '~/components/comments/CommentList'
|
||||
|
||||
export default {
|
||||
transition: {
|
||||
@ -150,9 +125,9 @@ export default {
|
||||
HcCategory,
|
||||
HcUser,
|
||||
HcShoutButton,
|
||||
HcEmpty,
|
||||
Comment,
|
||||
ContentMenu
|
||||
ContentMenu,
|
||||
HcCommentForm,
|
||||
HcCommentList
|
||||
},
|
||||
head() {
|
||||
return {
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
resource-type="user"
|
||||
:resource="user"
|
||||
:is-owner="myProfile"
|
||||
class="user-content-menu"
|
||||
/>
|
||||
</no-ssr>
|
||||
<ds-space margin="small">
|
||||
|
||||
1366
webapp/yarn.lock
1366
webapp/yarn.lock
File diff suppressed because it is too large
Load Diff
91
yarn.lock
91
yarn.lock
@ -762,6 +762,13 @@ acorn@^6.0.2:
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.1.1.tgz#7d25ae05bb8ad1f9b699108e1094ecd7884adc1f"
|
||||
integrity sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==
|
||||
|
||||
agent-base@^4.1.0:
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9"
|
||||
integrity sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==
|
||||
dependencies:
|
||||
es6-promisify "^5.0.0"
|
||||
|
||||
ajv@^6.5.5:
|
||||
version "6.10.0"
|
||||
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.0.tgz#90d0d54439da587cd7e843bfb7045f50bd22bdf1"
|
||||
@ -840,6 +847,11 @@ argparse@^1.0.7:
|
||||
dependencies:
|
||||
sprintf-js "~1.0.2"
|
||||
|
||||
argv@^0.0.2:
|
||||
version "0.0.2"
|
||||
resolved "https://registry.yarnpkg.com/argv/-/argv-0.0.2.tgz#ecbd16f8949b157183711b1bda334f37840185ab"
|
||||
integrity sha1-7L0W+JSbFXGDcRsb2jNPN4QBhas=
|
||||
|
||||
arr-diff@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf"
|
||||
@ -1491,6 +1503,17 @@ code-point-at@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
|
||||
integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=
|
||||
|
||||
codecov@^3.3.0:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/codecov/-/codecov-3.3.0.tgz#7bf337b3f7b0474606b5c31c56dd9e44e395e15d"
|
||||
integrity sha512-S70c3Eg9SixumOvxaKE/yKUxb9ihu/uebD9iPO2IR73IdP4i6ZzjXEULj3d0HeyWPr0DqBfDkjNBWxURjVO5hw==
|
||||
dependencies:
|
||||
argv "^0.0.2"
|
||||
ignore-walk "^3.0.1"
|
||||
js-yaml "^3.12.0"
|
||||
teeny-request "^3.7.0"
|
||||
urlgrey "^0.4.4"
|
||||
|
||||
coffee-react-transform@^3.1.0:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/coffee-react-transform/-/coffee-react-transform-3.3.0.tgz#f1f90fa22de8d767fca2793e3b70f0f7d7a2e467"
|
||||
@ -1787,6 +1810,11 @@ cypress-cucumber-preprocessor@^1.11.0:
|
||||
glob "^7.1.2"
|
||||
through "^2.3.8"
|
||||
|
||||
cypress-plugin-retries@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/cypress-plugin-retries/-/cypress-plugin-retries-1.2.0.tgz#a4e120c1bc417d1be525632e7d38e52a87bc0578"
|
||||
integrity sha512-seQFI/0j5WCqX7IVN2k0tbd3FLdhbPuSCWdDtdzDmU9oJfUkRUlluV47TYD+qQ/l+fJYkQkpw8csLg8/LohfRg==
|
||||
|
||||
cypress@^3.2.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/cypress/-/cypress-3.2.0.tgz#c2d5befd5077dab6fb52ad70721e0868ac057001"
|
||||
@ -1999,10 +2027,10 @@ domain-browser@^1.2.0:
|
||||
resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda"
|
||||
integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==
|
||||
|
||||
dotenv@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-7.0.0.tgz#a2be3cd52736673206e8a85fb5210eea29628e7c"
|
||||
integrity sha512-M3NhsLbV1i6HuGzBUH8vXrtxOk+tWmzWKDMbAVSUp3Zsjm7ywFeuwrUXhmhQyRK1q5B5GGy7hcXPbj3bnfZg2g==
|
||||
dotenv@^8.0.0:
|
||||
version "8.0.0"
|
||||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.0.0.tgz#ed310c165b4e8a97bb745b0a9d99c31bda566440"
|
||||
integrity sha512-30xVGqjLjiUOArT4+M5q9sYdvuR4riM6yK9wMcas9Vbp6zZa+ocC9dp6QoftuhTPhFAiLK/0C5Ni2nou/Bk8lg==
|
||||
|
||||
duplexer2@^0.1.2, duplexer2@~0.1.0, duplexer2@~0.1.2:
|
||||
version "0.1.4"
|
||||
@ -2103,6 +2131,18 @@ es6-iterator@~2.0.3:
|
||||
es5-ext "^0.10.35"
|
||||
es6-symbol "^3.1.1"
|
||||
|
||||
es6-promise@^4.0.3:
|
||||
version "4.2.6"
|
||||
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.6.tgz#b685edd8258886365ea62b57d30de28fadcd974f"
|
||||
integrity sha512-aRVgGdnmW2OiySVPUC9e6m+plolMAJKjZnQlCwNSuK5yQ0JN61DZSO1X1Ufd1foqWRAlig0rhduTCHe7sVtK5Q==
|
||||
|
||||
es6-promisify@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
|
||||
integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=
|
||||
dependencies:
|
||||
es6-promise "^4.0.3"
|
||||
|
||||
es6-symbol@^3.1.1, es6-symbol@~3.1.1:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77"
|
||||
@ -2632,6 +2672,14 @@ https-browserify@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73"
|
||||
integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=
|
||||
|
||||
https-proxy-agent@^2.2.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz#51552970fa04d723e04c56d04178c3f92592bbc0"
|
||||
integrity sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==
|
||||
dependencies:
|
||||
agent-base "^4.1.0"
|
||||
debug "^3.1.0"
|
||||
|
||||
iconv-lite@^0.4.4:
|
||||
version "0.4.24"
|
||||
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
|
||||
@ -3007,6 +3055,14 @@ js-levenshtein@^1.1.3:
|
||||
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
|
||||
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
|
||||
|
||||
js-yaml@^3.12.0:
|
||||
version "3.13.1"
|
||||
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847"
|
||||
integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==
|
||||
dependencies:
|
||||
argparse "^1.0.7"
|
||||
esprima "^4.0.0"
|
||||
|
||||
js-yaml@^3.9.0:
|
||||
version "3.13.0"
|
||||
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.0.tgz#38ee7178ac0eea2c97ff6d96fff4b18c7d8cf98e"
|
||||
@ -3473,10 +3529,10 @@ needle@^2.2.1:
|
||||
iconv-lite "^0.4.4"
|
||||
sax "^1.2.4"
|
||||
|
||||
neo4j-driver@^1.7.3:
|
||||
version "1.7.3"
|
||||
resolved "https://registry.yarnpkg.com/neo4j-driver/-/neo4j-driver-1.7.3.tgz#1c1108ab26b7243975f1b20045daf31d8f685207"
|
||||
integrity sha512-UCNOFiQdouq14PvZGTr+psy657BJsBpO6O2cJpP+NprZnEF4APrDzAcydPZSFxE1nfooLNc50vfuZ0q54UyY2Q==
|
||||
neo4j-driver@^1.7.4:
|
||||
version "1.7.4"
|
||||
resolved "https://registry.yarnpkg.com/neo4j-driver/-/neo4j-driver-1.7.4.tgz#9661cf643b63818bff85e82c4691918e75098c1e"
|
||||
integrity sha512-pbK1HbXh92zNSwMlXL8aNynkHohg9Jx/Tk+EewdJawGm8n8sKIY4NpRkp0nRw6RHvVBU3u9cQXt01ftFVe7j+A==
|
||||
dependencies:
|
||||
babel-runtime "^6.26.0"
|
||||
text-encoding "^0.6.4"
|
||||
@ -3509,6 +3565,11 @@ node-fetch@2.1.2:
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.1.2.tgz#ab884e8e7e57e38a944753cec706f788d1768bb5"
|
||||
integrity sha1-q4hOjn5X44qUR1POxwb3iNF2i7U=
|
||||
|
||||
node-fetch@^2.2.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.3.0.tgz#1a1d940bbfb916a1d3e0219f037e89e71f8c5fa5"
|
||||
integrity sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA==
|
||||
|
||||
node-pre-gyp@^0.10.0:
|
||||
version "0.10.3"
|
||||
resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz#3070040716afdc778747b61b6887bf78880b80fc"
|
||||
@ -4621,6 +4682,15 @@ tar@^4:
|
||||
safe-buffer "^5.1.2"
|
||||
yallist "^3.0.2"
|
||||
|
||||
teeny-request@^3.7.0:
|
||||
version "3.11.3"
|
||||
resolved "https://registry.yarnpkg.com/teeny-request/-/teeny-request-3.11.3.tgz#335c629f7645e5d6599362df2f3230c4cbc23a55"
|
||||
integrity sha512-CKncqSF7sH6p4rzCgkb/z/Pcos5efl0DmolzvlqRQUNcpRIruOhY9+T1FsIlyEbfWd7MsFpodROOwHYh2BaXzw==
|
||||
dependencies:
|
||||
https-proxy-agent "^2.2.1"
|
||||
node-fetch "^2.2.0"
|
||||
uuid "^3.3.2"
|
||||
|
||||
text-encoding@^0.6.4:
|
||||
version "0.6.4"
|
||||
resolved "https://registry.yarnpkg.com/text-encoding/-/text-encoding-0.6.4.tgz#e399a982257a276dae428bb92845cb71bdc26d19"
|
||||
@ -4847,6 +4917,11 @@ url@0.11.0, url@~0.11.0:
|
||||
punycode "1.3.2"
|
||||
querystring "0.2.0"
|
||||
|
||||
urlgrey@^0.4.4:
|
||||
version "0.4.4"
|
||||
resolved "https://registry.yarnpkg.com/urlgrey/-/urlgrey-0.4.4.tgz#892fe95960805e85519f1cd4389f2cb4cbb7652f"
|
||||
integrity sha1-iS/pWWCAXoVRnxzUOJ8stMu3ZS8=
|
||||
|
||||
use@^3.1.0:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user