Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB Migration release notes for 2023-10 #166

Merged
merged 28 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7634c4a
MongoDB Migration release notes for 2023-10
Sep 28, 2023
9356a40
lint
Sep 28, 2023
7ea12a4
bypass linter for these template lines
Sep 28, 2023
afe0ca9
ignore
Sep 28, 2023
30dbbef
Update release-notes/2023-10/MongoDB_Migration/Chart.yaml
g-m-o-n-e-y Sep 29, 2023
131010d
Update release-notes/2023-10/MongoDB_Migration/Chart.yaml
g-m-o-n-e-y Sep 29, 2023
862c854
Update release-notes/2023-10/MongoDB_Migration/Chart.yaml
g-m-o-n-e-y Sep 29, 2023
c58769e
Update release-notes/2023-10/MongoDB_Migration/Chart.yaml
g-m-o-n-e-y Sep 29, 2023
6c509ba
Update release-notes/2023-10/MongoDB_Migration/README.md
g-m-o-n-e-y Sep 29, 2023
ce73b3d
Update release-notes/2023-10/MongoDB_Migration/README.md
g-m-o-n-e-y Sep 29, 2023
4025af5
Update release-notes/2023-10/MongoDB_Migration/README.md
g-m-o-n-e-y Sep 29, 2023
c0273e7
Update release-notes/2023-10/MongoDB_Migration/README.md
g-m-o-n-e-y Sep 29, 2023
438902d
Update release-notes/2023-10/MongoDB_Migration/README.md
g-m-o-n-e-y Sep 29, 2023
7c9c1b8
Update release-notes/2023-10/MongoDB_Migration/Chart.yaml
g-m-o-n-e-y Sep 29, 2023
ec03468
Update release-notes/2023-10/MongoDB_Migration/Chart.yaml
g-m-o-n-e-y Sep 29, 2023
0132915
Update release-notes/2023-10/MongoDB_Migration/Chart.yaml
g-m-o-n-e-y Sep 29, 2023
ec07f8b
Update release-notes/2023-10/MongoDB_Migration/Chart.yaml
g-m-o-n-e-y Sep 29, 2023
379044e
Update release-notes/2023-10/MongoDB_Migration/Chart.yaml
g-m-o-n-e-y Sep 29, 2023
187af6c
Update release-notes/2023-10/MongoDB_Migration/Chart.yaml
g-m-o-n-e-y Sep 29, 2023
3b924aa
Update release-notes/2023-10/MongoDB_Migration/Chart.yaml
g-m-o-n-e-y Sep 29, 2023
60b6ed2
Apply suggestions from code review
g-m-o-n-e-y Sep 29, 2023
b8973b8
Apply suggestions from code review
g-m-o-n-e-y Sep 29, 2023
a71d47a
lint
Sep 29, 2023
55a378b
move things around
Sep 29, 2023
d942029
job->Job
Sep 29, 2023
13814ef
`_` to `-`
Sep 29, 2023
83e7676
customers don't need these comments in Chart.yaml
Sep 29, 2023
5cf73e0
review edits
Sep 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .yamllint
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
yaml-files:
- '*.yaml'
- '*.yml'
- '*.yml'

ignore:
- /release-notes/2023-10/MongoDB_Migration/templates/*.yaml
6 changes: 6 additions & 0 deletions release-notes/2023-10/MongoDB_Migration/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: ni_systemlink_enterprise_migrate_mongodb
description: Creates Jobs in the cluster to migrate data from individual service MongoDB instances to a central instance. See README.md for more details.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved
type: application
version: 0.1.0
appVersion: '1.16.0'
44 changes: 44 additions & 0 deletions release-notes/2023-10/MongoDB_Migration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Existing MongoDB Data Migration to a Single Instance

## Do you need to worry about what is in this folder?

SystemLink Enterprise installations prior to 2023-10 deployed a MongoDB instance per service. Version 2023-10 uses a global MongoDB connection string that allows customers to consolidate over 20 different MongoDB instances down to one. This content is for users who need to migrate existing SystemLink Enterprise MongoDB data to a single MongoDB instance. You do not need to perform the following if you are deploying a new installation of SystemLink Enterprise.

## Prerequisites

Before you begin, you must provision your MongoDB instance with databases and users. Refer to [Configuring Systemlink Enterprise](https://www.ni.com/docs/en-US/bundle/systemlink-enterprise/page/config-systemlink-enterprise.html) for a list of databases and password fields to update if using separate credentials per database. NOTE: Ensure that you backup the current database passwords for the migration.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved

## Enable a Single Instance

Refer to [Configuring Systemlink Enterprise](https://www.ni.com/docs/en-US/bundle/systemlink-enterprise/page/config-systemlink-enterprise.html) for instructions on editing the Helm values that determine this functionality.

## Migration Plan

### MongoDB Atlas

If you are using a [MongoDB Atlas](https://www.ni.com/r/mongodbatalas) cluster use the MongoDB Atlas migration tools to move data between the service databases and MongoDB Atlas.

### Self-hosted MongoDB

Run the following command from inside the cluster to migrate the documents to the new MongoDB instance.

```sh
mongodump --config=/etc/mongodump_config.yaml --archive | mongorestore --archive --config=/etc/mongorestore_config.yaml
```

g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved
Where

- `mongo*_config.yaml` is where the connection string and password are configured.
- `--archive` allows you to pipe (`|`) the output directly into the `mongorestore` command

#### Helm Chart

This folder includes a Helm Chart to install into your existing Kubernetes cluster to execute the plan described above for self-hosted MongoDB. Your Kubernetes cluster must be able to pull the `bitnami/mongodb:5.0.19-debian-11-r3` Docker image.

1. Fill out the `values.yaml` file with MongoDB password secrets stored in `systemlink-secrets.yaml`. Refer to all `<ATTENTION>` comments.
2. Change active directory on command line to the folder containing this file.
3. Run `helm install ni-systemlink-enterprise-migrate-mongodb .`

You can observe the progress of each command Job through the Pod logs.

Before continuing, run `kubectl get jobs` and observe the `COMPLETIONS` column to ensure all Jobs have completed. `1/1` indicates the Job completed successfully.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- range $name, $data := .Values.migrating_from.services }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mongodump-{{ $name }}-config-yaml
data:
mongodump_config.yaml: |-
password: {{ $data.dump.password }}
uri: mongodb://{{ $data.username }}@{{ $data.dump.db0 }}:27017,{{ $data.dump.db1 }}:27017,{{ $data.dump.db2 }}:27017/{{ $data.database }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mongorestore-{{ $name }}-config-yaml
data:
mongorestore_config.yaml: |-
password: {{ $.Values.migrating_to.admin_password }}
uri: {{ trimSuffix "/" $.Values.migrating_to.connection_string_including_admin_username}}/{{ $data.database }}?authSource=admin
{{- end }}
54 changes: 54 additions & 0 deletions release-notes/2023-10/MongoDB_Migration/templates/job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{{- range $service := keys .Values.migrating_from.services }}
---
apiVersion: batch/v1
kind: Job
metadata:
name: mongodb-migration-{{ $service }}
spec:
backoffLimit: 1
template:
spec:
automountServiceAccountToken: false
containers:
- name: mongodb-migration-{{ $service }}
image: bitnami/mongodb:5.0.19-debian-11-r3
command: ['bin/bash']
args:
[
'-c',
'mongodump --config=/etc/mongodump_config.yaml --archive | mongorestore --archive --config=/etc/mongorestore_config.yaml',
]
volumeMounts:
- name: mongodump-config-yaml
mountPath: /etc/mongodump_config.yaml
subPath: mongodump_config.yaml
- name: mongorestore-config-yaml
mountPath: /etc/mongorestore_config.yaml
subPath: mongorestore_config.yaml
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
resources:
requests:
cpu: 2
memory: 8Gi
limits:
memory: 8Gi
volumes:
- name: mongodump-config-yaml
configMap:
name: mongodump-{{ $service }}-config-yaml
- name: mongorestore-config-yaml
configMap:
name: mongorestore-{{ $service }}-config-yaml
restartPolicy: Never
securityContext:
runAsNonRoot: true
runAsUser: 10001
runAsGroup: 20001
seccompProfile:
type: RuntimeDefault
{{- end }}
165 changes: 165 additions & 0 deletions release-notes/2023-10/MongoDB_Migration/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
migrating_to:
admin_password: '' # <ATTENTION>
connection_string_including_admin_username: 'mongodb://...' # <ATTENTION>
migrating_from:
services:
assetservice:
database: niapm
username: niapm
dump:
password: '' # <ATTENTION> Replace with value from assetservice.secrets.mongodb.servicePassword
db0: 'assetmanagementservice-mongodb-0.assetmanagementservice-mongodb-headless'
db1: 'assetmanagementservice-mongodb-1.assetmanagementservice-mongodb-headless'
db2: 'assetmanagementservice-mongodb-2.assetmanagementservice-mongodb-headless'
fileingestionservices:
database: files
username: files
dump:
password: '' # <ATTENTION> Replace with value from fileingestion.secrets.mongodb.servicePassword
db0: 'fileingestion-fileingestion-mongodb-0.fileingestion-fileingestion-mongodb-headless'
db1: 'fileingestion-fileingestion-mongodb-1.fileingestion-fileingestion-mongodb-headless'
db2: 'fileingestion-fileingestion-mongodb-2.fileingestion-fileingestion-mongodb-headless'
license:
database: nilicense
username: nilicense
dump:
password: '' # <ATTENTION> Replace with value from license.secrets.mongodb.servicePassword
db0: 'license-license-mongodb-0.license-license-mongodb-headless'
db1: 'license-license-mongodb-1.license-license-mongodb-headless'
db2: 'license-license-mongodb-2.license-license-mongodb-headless'
nbexecservice:
database: ninbexec
username: ninbexec
dump:
password: '' # <ATTENTION> Replace with value from nbexecservice.secrets.mongodb.servicePassword
db0: 'nbexecservice-mongodb-0.nbexecservice-mongodb-headless'
db1: 'nbexecservice-mongodb-1.nbexecservice-mongodb-headless'
db2: 'nbexecservice-mongodb-2.nbexecservice-mongodb-headless'
nicomments:
database: comments
username: nicomments
dump:
password: '' # <ATTENTION> Replace with value from comments.secrets.mongodb.servicePassword
db0: 'comments-comments-mongodb-0.comments-comments-mongodb-headless'
db1: 'comments-comments-mongodb-1.comments-comments-mongodb-headless'
db2: 'comments-comments-mongodb-2.comments-comments-mongodb-headless'
nidataframe:
database: nidataframe
username: nidataframe
dump:
password: '' # <ATTENTION> Replace with value from dataframeservice.secrets.mongodb.servicePassword
db0: 'dataframeservice-mongodb-0.dataframeservice-mongodb-headless'
db1: 'dataframeservice-mongodb-1.dataframeservice-mongodb-headless'
db2: 'dataframeservice-mongodb-2.dataframeservice-mongodb-headless'
notification:
database: ninotification
username: ninotification
dump:
password: '' # <ATTENTION> Replace with value from notification.secrets.mongodb.servicePassword
db0: 'notification-notification-mongodb-0.notification-notification-mongodb-headless'
db1: 'notification-notification-mongodb-1.notification-notification-mongodb-headless'
db2: 'notification-notification-mongodb-2.notification-notification-mongodb-headless'
repositoryservice:
database: nirepo
username: nirepo
dump:
password: '' # <ATTENTION> Replace with value from repository.secrets.mongodb.servicePassword
db0: 'repository-repository-mongodb-0.repository-repository-mongodb-headless'
db1: 'repository-repository-mongodb-1.repository-repository-mongodb-headless'
db2: 'repository-repository-mongodb-2.repository-repository-mongodb-headless'
routines:
database: niroutines
username: niroutines
dump:
password: '' # <ATTENTION> Replace with value from routineservice.secrets.mongodb.servicePassword
db0: 'routineservice-routines-mongodb-0.routineservice-routines-mongodb-headless'
db1: 'routineservice-routines-mongodb-1.routineservice-routines-mongodb-headless'
db2: 'routineservice-routines-mongodb-2.routineservice-routines-mongodb-headless'
routinescheduletrigger:
database: niroutinescheduletrigger
username: niroutinescheduletrigger
dump:
password: '' # <ATTENTION> Replace with value from routinescheduletrigger.secrets.mongodb.servicePassword
db0: 'routinescheduletrigger-routineschedule-mongodb-0.routinescheduletrigger-routineschedule-mongodb-headless'
db1: 'routinescheduletrigger-routineschedule-mongodb-1.routinescheduletrigger-routineschedule-mongodb-headless'
db2: 'routinescheduletrigger-routineschedule-mongodb-2.routinescheduletrigger-routineschedule-mongodb-headless'
saltmaster-minions:
database: minions
username: minions
dump:
password: '' # <ATTENTION> Replace with value from saltmaster.secrets.mongodb.minionsPassword
db0: 'saltmaster-saltmaster-mongodb-0.saltmaster-saltmaster-mongodb-headless'
db1: 'saltmaster-saltmaster-mongodb-1.saltmaster-saltmaster-mongodb-headless'
db2: 'saltmaster-saltmaster-mongodb-2.saltmaster-saltmaster-mongodb-headless'
saltmaster-pillars:
database: pillars
username: pillars
dump:
password: '' # <ATTENTION> Replace with value from saltmaster.secrets.mongodb.pillarsPassword
db0: 'saltmaster-saltmaster-mongodb-0.saltmaster-saltmaster-mongodb-headless'
db1: 'saltmaster-saltmaster-mongodb-1.saltmaster-saltmaster-mongodb-headless'
db2: 'saltmaster-saltmaster-mongodb-2.saltmaster-saltmaster-mongodb-headless'
sysmgmtevent:
database: nisysmgmtevent
username: nisysmgmtevent
dump:
password: '' # <ATTENTION> Replace with value from sysmgmtevent.secrets.mongodb.servicePassword
db0: 'sysmgmtevent-sysmgmtevent-mongodb-0.sysmgmtevent-sysmgmtevent-mongodb-headless'
db1: 'sysmgmtevent-sysmgmtevent-mongodb-1.sysmgmtevent-sysmgmtevent-mongodb-headless'
db2: 'sysmgmtevent-sysmgmtevent-mongodb-2.sysmgmtevent-sysmgmtevent-mongodb-headless'
systemsmanagementservice:
database: nisystemsmanagement
username: nisystems
dump:
password: '' # <ATTENTION> Replace with value from systems.secrets.mongodb.servicePassword
db0: 'systemsmanagementservice-systems-mongodb-0.systemsmanagementservice-systems-mongodb-headless'
db1: 'systemsmanagementservice-systems-mongodb-1.systemsmanagementservice-systems-mongodb-headless'
db2: 'systemsmanagementservice-systems-mongodb-2.systemsmanagementservice-systems-mongodb-headless'
taghistorian:
database: taghistorian
username: taghistorian
dump:
password: '' # <ATTENTION> Replace with value from taghistorian.secrets.mongodb.servicePassword
db0: 'taghistorian-taghistorian-mongodb-0.taghistorian-taghistorian-mongodb-headless'
db1: 'taghistorian-taghistorian-mongodb-1.taghistorian-taghistorian-mongodb-headless'
db2: 'taghistorian-taghistorian-mongodb-2.taghistorian-taghistorian-mongodb-headless'
tags:
database: tags
username: tags
dump:
password: '' # <ATTENTION> Replace with value from tags.secrets.mongodb.servicePassword
db0: 'tags-tags-mongodb-0.tags-tags-mongodb-headless'
db1: 'tags-tags-mongodb-1.tags-tags-mongodb-headless'
db2: 'tags-tags-mongodb-2.tags-tags-mongodb-headless'
userdata:
database: niuserdata
username: niuserdata
dump:
password: '' # <ATTENTION> Replace with value from userdata.secrets.mongodb.servicePassword
db0: 'userdata-userdata-mongodb-0.userdata-userdata-mongodb-headless'
db1: 'userdata-userdata-mongodb-1.userdata-userdata-mongodb-headless'
db2: 'userdata-userdata-mongodb-2.userdata-userdata-mongodb-headless'
userservices-users:
database: users
username: userservice
dump:
password: '' # <ATTENTION> Replace with value from userservices.secrets.mongodb.userServicePassword
db0: 'userservices-userservices-mongodb-0.userservices-userservices-mongodb-headless'
db1: 'userservices-userservices-mongodb-1.userservices-userservices-mongodb-headless'
db2: 'userservices-userservices-mongodb-2.userservices-userservices-mongodb-headless'
userservices-keyservices:
database: keyservices
username: keyservice
dump:
password: '' # <ATTENTION> Replace with value from userservices.secrets.mongodb.keyServicePassword
db0: 'userservices-userservices-mongodb-0.userservices-userservices-mongodb-headless'
db1: 'userservices-userservices-mongodb-1.userservices-userservices-mongodb-headless'
db2: 'userservices-userservices-mongodb-2.userservices-userservices-mongodb-headless'
webappservices:
database: webapps
username: webapps
dump:
password: '' # <ATTENTION> Replace with value from webappservices.secrets.mongodb.servicePassword
db0: 'webappservices-mongodb-0.webappservices-mongodb-headless'
db1: 'webappservices-mongodb-1.webappservices-mongodb-headless'
db2: 'webappservices-mongodb-2.webappservices-mongodb-headless'
Loading