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 4 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
24 changes: 24 additions & 0 deletions release-notes/2023-10/MongoDB_Migration/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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

# A chart can be either an 'application' or a 'library' chart.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved
#
# Application charts are a collection of templates that can be packaged into versioned archives
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved
# to be deployed.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved
# a dependency of application charts to inject those utilities and functions into the rendering
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved
type: application

# This is the chart version. This version number should be incremented each time you make changes
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved
# to the chart and its templates, including the app version.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved
# Versions are expected to follow Semantic Versioning (https://semver.org/)
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved
# incremented each time you make changes to the application. Versions are not expected to
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved
# follow Semantic Versioning. They should reflect the version the application is using.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved
# It is recommended to use it with quotes.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved
appVersion: '1.16.0'
49 changes: 49 additions & 0 deletions release-notes/2023-10/MongoDB_Migration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Existing MongoDB Data Migration to a Single Instance

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

The content in this folder can help you if you have recognized a need to migrate existing SystemLink Enterprise MongoDB data to a single MongoDB instance. You should not need this content if deploying a new installation of SystemLink Enterprise.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved

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

Prior to version 2023-10 installations of SystemLink Enterprise deployed a MongoDB instance per service. In version 2023-10 the services were refactored to use a global MongoDB connection string allowing customers to go from running over twenty (20) different MongoDB instances down to one.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved

Controlling this functionality is done through global Helm values. Configure `global.mongodb.install` to `false` to enable this feature. You will also need to configure `global.secrets.mongodb.connection_string`. Refer to [Configuring Systemlink Enterprise](https://www.ni.com/docs/en-US/bundle/systemlink-enterprise/page/config-systemlink-enterprise.html) for more information.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved

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

Your MongoDB instance will need to be provisioned 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. It also lists password fields to update (if using separate credentials per database). NOTE: You will need the current database passwords for the migration. Be sure to backup these values somewhere safe.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved

## Migration Plan

### MongoDB Atlas

If you are using a [MongoDB Atlas](https://www.ni.com/r/mongodbatalas) cluster use MongoDB's Atlas migration tools to move data between the service databases and MongoDB Atlas.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved

### Self-hosted MongoDB

From inside the cluster we need to run a `mongodump` piped into a `mongorestore` so that we can migrate the documents to the new MongoDB instance.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved

The command we want to run is:
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved

```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
- The `mongo*_config.yaml` files are where the connection string and password is configured.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved
- `--archive` is used so that we can pipe (`|`) the output directly into the `mongorestore` command
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved

#### Helm Chart

Included in this folder is a Helm Chart to install into your existing Kubernetes cluster to perform the above plan. It utilizes a `bitnami/mongodb:5.0.19-debian-11-r3` Docker image which your Kubernetes cluster will need to be able to pull.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved

You will need to fill out the `values.yaml` file with MongoDB password secrets typically stored in `systemlink-secrets.yaml`. Refer to all `<ATTENTION>` comments.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved

After configuring `values.yaml` install via helm command
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved

1. Change active directory on command line to the folder containing this file.
2. Run `helm install ni_systemlink_enterprise_migrate_mongodb .`

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

Before continuing ensure all Jobs have completed by running `kubectl get jobs` and observe the `COMPLETIONS` column. `1/1` indicates the Job completed successfully.
g-m-o-n-e-y marked this conversation as resolved.
Show resolved Hide resolved
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