diff --git a/SUMMARY.md b/SUMMARY.md index c993fe120..e1cf09126 100644 --- a/SUMMARY.md +++ b/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,9 @@ * [Frontend tests](webapp/testing.md) * [Backend tests](backend/testing.md) * [Contributing](CONTRIBUTING.md) -* [Deployment](deployment/README.md) +* [Kubernetes Deployment](deployment/README.md) + * [Neo4J DB Backup](deployment/backup.md) +* [Maintenance](maintenance/README.md) * [Feature Specification](cypress/features.md) * [Code of conduct](CODE_OF_CONDUCT.md) * [License](LICENSE.md) diff --git a/backend/yarn.lock b/backend/yarn.lock index 980111644..b7cf8099b 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -4926,9 +4926,9 @@ joi@^13.0.0: topo "3.x.x" jquery@^3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca" - integrity sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg== + version "3.4.0" + resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.4.0.tgz#8de513fa0fa4b2c7d2e48a530e26f0596936efdf" + integrity sha512-ggRCXln9zEqv6OqAGXFEcshF5dSBvCkzj6Gm2gzuR5fWawaX8t7cxKVkkygKODrDAzKdoYw3l/e3pm3vlT4IbQ== js-levenshtein@^1.1.3: version "1.1.4" diff --git a/deployment/README.md b/deployment/README.md index 982a886ac..84912d2a5 100644 --- a/deployment/README.md +++ b/deployment/README.md @@ -181,7 +181,7 @@ This setup is completely optional and only required if you have data on a server Create a configmap with the specific connection data of your legacy server: ```bash -$ kubectl create configmap db-migration-worker \ +$ kubectl create configmap maintenance-worker \ --namespace=human-connection \ --from-literal=SSH_USERNAME=someuser \ --from-literal=SSH_HOST=yourhost \ diff --git a/deployment/backup.md b/deployment/backup.md new file mode 100644 index 000000000..5d6d61866 --- /dev/null +++ b/deployment/backup.md @@ -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 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/:/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/:/root/ +kubectl --namespace=human-connection exec -it 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. diff --git a/webapp/package.json b/webapp/package.json index 4e3305ca2..58adc74a2 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -51,8 +51,8 @@ "nuxt-env": "~0.1.0", "stack-utils": "^1.0.2", "string-hash": "^1.1.3", - "tiptap": "^1.14.0", - "tiptap-extensions": "^1.15.0", + "tiptap": "^1.16.2", + "tiptap-extensions": "^1.16.2", "v-tooltip": "~2.0.1", "vue-count-to": "~1.0.13", "vue-izitoast": "1.1.2", diff --git a/webapp/yarn.lock b/webapp/yarn.lock index ecc1955e6..1059cfb53 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -8881,10 +8881,10 @@ prosemirror-utils@^0.7.6: resolved "https://registry.yarnpkg.com/prosemirror-utils/-/prosemirror-utils-0.7.6.tgz#c462ddfbf2452e56e4b25d1f02b34caccddb0f33" integrity sha512-vzsCBTiJ56R3nRDpIJnKOJzsZP7KFO8BkXk7zvQgQiXpml2o/djPCRhuyaFc7VTqSHlLPQHVI1feTLAwHp+prQ== -prosemirror-view@^1.0.0, prosemirror-view@^1.1.0, prosemirror-view@^1.8.8: - version "1.8.8" - resolved "https://registry.yarnpkg.com/prosemirror-view/-/prosemirror-view-1.8.8.tgz#e61f60ed716d4f943be2fbc3f3be765322ff891f" - integrity sha512-rBDmBKRPmWhF4R2k9vW7CkGo+bafjj278lFxEGVpCHlnLhhhYX1XHU59KgMCsDnNhxh8Oexup1yIPbfg99eynA== +prosemirror-view@^1.0.0, prosemirror-view@^1.1.0, prosemirror-view@^1.8.9: + version "1.8.9" + resolved "https://registry.yarnpkg.com/prosemirror-view/-/prosemirror-view-1.8.9.tgz#9303def925eba0a8ce4589e64b4a011eaccfc1e0" + integrity sha512-K3/z7qDR6rEMH/gKXqu5pmjmtyhtuTWeQyselK6HMp3jbn1UANU4CfdU/awQT+zbRjv4ZJXGb9lxnuNmdUQS3Q== dependencies: prosemirror-model "^1.1.0" prosemirror-state "^1.0.0" @@ -10362,10 +10362,10 @@ tippy.js@^4.2.1: dependencies: popper.js "^1.14.7" -tiptap-commands@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/tiptap-commands/-/tiptap-commands-1.7.0.tgz#d15cec2cb09264b5c1f6f712dab8819bb9ab7e13" - integrity sha512-JhgvBPIhGnisEdxD6gmM3U76BUlKF9n1LW1X/dO1AUOsm3Xc9tQB5BIOV/DpZTvrjntLP3AUTfd+yJeRIz5CPA== +tiptap-commands@^1.7.1: + version "1.7.1" + resolved "https://registry.yarnpkg.com/tiptap-commands/-/tiptap-commands-1.7.1.tgz#88f615e623836c49f3c4ad1b1cdd95ebed7cf0e1" + integrity sha512-HQVFgfBeeOe9mJFYUDkYxiX1D+aYjyO9rO0SeYdumqv9rNHTF3GFfx7qJSk4/d2+GgXDRyoiO35B25EkxGjJJw== dependencies: prosemirror-commands "^1.0.7" prosemirror-inputrules "^1.0.1" @@ -10373,19 +10373,19 @@ tiptap-commands@^1.7.0: prosemirror-state "^1.2.2" tiptap-utils "^1.3.0" -tiptap-extensions@^1.15.0: - version "1.15.0" - resolved "https://registry.yarnpkg.com/tiptap-extensions/-/tiptap-extensions-1.15.0.tgz#72768ba4c1d016ce752468466c91b33c87699e60" - integrity sha512-BqrHw5ZiF1WJVDw1r/9Xbta+ln1rITeQZHhA2p5ZaTi9ZRM7y9Bp44oSn2Pwzvb3bwCz+TO1Jv1MwASRKDMhug== +tiptap-extensions@^1.16.2: + version "1.16.2" + resolved "https://registry.yarnpkg.com/tiptap-extensions/-/tiptap-extensions-1.16.2.tgz#deea16318b6f1d2b080d3d240ff9bfe4940f5261" + integrity sha512-b6/uv56eMTdmUPTobZpS2aJFmZd9h7FTi+LcVYfbytcw8iow/p6Rzf/gGny5c1L9x0Tvk93fvUQE+wuKg38DKw== dependencies: lowlight "^1.11.0" prosemirror-history "^1.0.4" prosemirror-state "^1.2.2" prosemirror-tables "^0.7.10" prosemirror-utils "^0.7.6" - prosemirror-view "^1.8.8" - tiptap "^1.15.0" - tiptap-commands "^1.7.0" + prosemirror-view "^1.8.9" + tiptap "^1.16.2" + tiptap-commands "^1.7.1" tiptap-utils@^1.3.0: version "1.3.0" @@ -10397,10 +10397,10 @@ tiptap-utils@^1.3.0: prosemirror-tables "^0.7.9" prosemirror-utils "^0.7.6" -tiptap@^1.14.0, tiptap@^1.15.0: - version "1.15.0" - resolved "https://registry.yarnpkg.com/tiptap/-/tiptap-1.15.0.tgz#198b6a3b477a10a25de79674a4d8bb58dad56743" - integrity sha512-qQfcK9Vs0QzUgw1x9oKYXimX8+m1TckivTrD/0als095qrq+fFQpQWkce++8kBW+2lGkM6nXsogZvHoV6Dzl4Q== +tiptap@^1.16.2: + version "1.16.2" + resolved "https://registry.yarnpkg.com/tiptap/-/tiptap-1.16.2.tgz#0a94ea8f58cccafd56439bcbd29fa9c6071ed90a" + integrity sha512-krMpbrQDvSwcp0FIUFjZgmlZUc65kvno+ASecp2G13DJUoAeYHTUW7AKng53xJP/rMm9ubc3q9XA6e6B5Bf+mA== dependencies: prosemirror-commands "^1.0.7" prosemirror-dropcursor "^1.1.1" @@ -10409,8 +10409,8 @@ tiptap@^1.14.0, tiptap@^1.15.0: prosemirror-keymap "^1.0.1" prosemirror-model "^1.7.0" prosemirror-state "^1.2.1" - prosemirror-view "^1.8.8" - tiptap-commands "^1.7.0" + prosemirror-view "^1.8.9" + tiptap-commands "^1.7.1" tiptap-utils "^1.3.0" tmp@^0.0.33: