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

[DPE-2561] POC - Start with provided config option: config-server, shard #246

Merged
merged 17 commits into from
Sep 20, 2023

Conversation

MiaAltieri
Copy link
Contributor

@MiaAltieri MiaAltieri commented Sep 15, 2023

Overview

This PR enables the user to pass the following config options: replication(default), shard, and config-server. This PR supports this options by starting the charm as a shard or a config-server. If the config option config-server is provided, then the charm starts an internal mongos service that runs on 0.0.0.0 and is configured to the provided config server.

Testing

As a POC there are not tests included in this PR. Testing was performed by hand with:

# deploy
charmcraft pack
juju deploy ./*charm --config role="shard" shard-one
juju deploy ./*charm --config role="config-server" config-server

# watch deployment and verify all hooks pass without error and charm is in active and idle state
watch -n1 --color juju status --color

# verify running correctly
juju ssh shard-one/0
systemctl status snap.charmed-mongodb.mongod.service
exit
juju ssh config-server/0
systemctl status snap.charmed-mongodb.mongod.service
systemctl status snap.charmed-mongodb.mongos.service
exit

Accommodating for PBM changes in new snap revision

New snap revison packages a new version of the PBM tool which updated how errors were handled when querying PBM status, commit 4bf9d5f9608976cf84d813f521826ea25eb9e04b reflects these necessary changes

Follow Up PR

Follow up PR is to be made immediately after merging of this feature is completed and is a requirement of finishing DPE-2561. For this PR this will be starting mongos with a --auth and the same --keyFile used to start themongod service

Future PR

Future PR is to be started after the follow up PR has been made. Once mongos is started with auth DPE-2562 will be started. This includes creating a basic shared library between config-server and shard components. In this PR we will:

  • implement keyfile sharing across shard and config server components
  • implement adding shards to cluster

(Shard removal is saved for later.)

POC

As a POC this PR doesn't include handling edge cases, intelligent status reporting, unit tests, or integration tests. These will be handled later on down the line. Specifically:

  1. block config change events for changing role of charm
  2. report status of internal mongos in update_status
  3. unit tests and integration tests

@MiaAltieri MiaAltieri changed the title [DPE-2561] POC - Start with provided config option: config-server, shard WIP - [DPE-2561] POC - Start with provided config option: config-server, shard Sep 15, 2023
@MiaAltieri MiaAltieri marked this pull request as draft September 15, 2023 14:21
@MiaAltieri MiaAltieri changed the title WIP - [DPE-2561] POC - Start with provided config option: config-server, shard DO NOT MERGE [DPE-2561] POC - Start with provided config option: config-server, shard Sep 15, 2023
@MiaAltieri MiaAltieri marked this pull request as ready for review September 15, 2023 15:35
Copy link
Contributor Author

@MiaAltieri MiaAltieri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WAITING TO MERGE - requires that charmed-mongodb 5/edge has been pushed to stable.

lib/charms/mongodb/v0/helpers.py Outdated Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
src/config.py Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
src/config.py Outdated Show resolved Hide resolved
delgod
delgod previously approved these changes Sep 19, 2023
lib/charms/mongodb/v0/helpers.py Outdated Show resolved Hide resolved
@MiaAltieri MiaAltieri changed the base branch from main to 6/edge September 19, 2023 14:52
@MiaAltieri MiaAltieri changed the title DO NOT MERGE [DPE-2561] POC - Start with provided config option: config-server, shard [DPE-2561] POC - Start with provided config option: config-server, shard Sep 19, 2023
@MiaAltieri MiaAltieri changed the base branch from mongodb-6 to 6/edge September 20, 2023 06:53
@MiaAltieri MiaAltieri merged commit 6dd464e into 6/edge Sep 20, 2023
7 checks passed
@MiaAltieri MiaAltieri deleted the start-shard-config-mongos branch September 20, 2023 06:57
dmitry-ratushnyy pushed a commit that referenced this pull request Oct 12, 2023
…ard (#246)

This PR enables the user to pass the following config options:
`replication`(default), `shard`, and `config-server`. This PR supports
this options by starting the charm as a `shard` or a `config-server`. If
the config option `config-server` is provided, then the charm starts an
internal `mongos` service that runs on 0.0.0.0 and is configured to the
provided config server.

As a POC there are not tests included in this PR. Testing was performed
by hand with:
```
charmcraft pack
juju deploy ./*charm --config role="shard" shard-one
juju deploy ./*charm --config role="config-server" config-server

watch -n1 --color juju status --color

juju ssh shard-one/0
systemctl status snap.charmed-mongodb.mongod.service
exit
juju ssh config-server/0
systemctl status snap.charmed-mongodb.mongod.service
systemctl status snap.charmed-mongodb.mongos.service
exit
```

New snap revison packages a new version of the PBM tool which updated
how errors were handled when querying PBM status, commit
[4bf9d5f](4bf9d5f)
reflects these necessary changes

Follow up PR is to be made immediately after merging of this feature is
completed and is a requirement of finishing
[DPE-2561](https://warthogs.atlassian.net/browse/DPE-2561). For this PR
this will be starting `mongos` with a `--auth` and the same `--keyFile`
used to start the`mongod` service

Future PR is to be started after the follow up PR has been made. Once
`mongos` is started with auth
[DPE-2562](https://warthogs.atlassian.net/browse/DPE-2562) will be
started. This includes creating a basic shared library between
`config-server` and `shard` components. In this PR we will:
- implement keyfile sharing across shard and config server components
- implement adding shards to cluster

(Shard removal is saved for later.)

As a POC this PR doesn't include handling edge cases, intelligent status
reporting, unit tests, or integration tests. These will be handled later
on down the line. Specifically:
1. block config change events for changing role of charm
2. report status of internal `mongos` in `update_status`
3. unit tests and integration tests

[DPE-2561]:
https://warthogs.atlassian.net/browse/DPE-2561?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Co-authored-by: Pedro Guimaraes <[email protected]>
dmitry-ratushnyy pushed a commit that referenced this pull request Oct 12, 2023
…ard (#246)

This PR enables the user to pass the following config options:
`replication`(default), `shard`, and `config-server`. This PR supports
this options by starting the charm as a `shard` or a `config-server`. If
the config option `config-server` is provided, then the charm starts an
internal `mongos` service that runs on 0.0.0.0 and is configured to the
provided config server.

As a POC there are not tests included in this PR. Testing was performed
by hand with:
```
charmcraft pack
juju deploy ./*charm --config role="shard" shard-one
juju deploy ./*charm --config role="config-server" config-server

watch -n1 --color juju status --color

juju ssh shard-one/0
systemctl status snap.charmed-mongodb.mongod.service
exit
juju ssh config-server/0
systemctl status snap.charmed-mongodb.mongod.service
systemctl status snap.charmed-mongodb.mongos.service
exit
```

New snap revison packages a new version of the PBM tool which updated
how errors were handled when querying PBM status, commit
[4bf9d5f](4bf9d5f)
reflects these necessary changes

Follow up PR is to be made immediately after merging of this feature is
completed and is a requirement of finishing
[DPE-2561](https://warthogs.atlassian.net/browse/DPE-2561). For this PR
this will be starting `mongos` with a `--auth` and the same `--keyFile`
used to start the`mongod` service

Future PR is to be started after the follow up PR has been made. Once
`mongos` is started with auth
[DPE-2562](https://warthogs.atlassian.net/browse/DPE-2562) will be
started. This includes creating a basic shared library between
`config-server` and `shard` components. In this PR we will:
- implement keyfile sharing across shard and config server components
- implement adding shards to cluster

(Shard removal is saved for later.)

As a POC this PR doesn't include handling edge cases, intelligent status
reporting, unit tests, or integration tests. These will be handled later
on down the line. Specifically:
1. block config change events for changing role of charm
2. report status of internal `mongos` in `update_status`
3. unit tests and integration tests

[DPE-2561]:
https://warthogs.atlassian.net/browse/DPE-2561?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Co-authored-by: Pedro Guimaraes <[email protected]>
dmitry-ratushnyy pushed a commit that referenced this pull request Oct 13, 2023
…ard (#246)

This PR enables the user to pass the following config options:
`replication`(default), `shard`, and `config-server`. This PR supports
this options by starting the charm as a `shard` or a `config-server`. If
the config option `config-server` is provided, then the charm starts an
internal `mongos` service that runs on 0.0.0.0 and is configured to the
provided config server.

As a POC there are not tests included in this PR. Testing was performed
by hand with:
```
charmcraft pack
juju deploy ./*charm --config role="shard" shard-one
juju deploy ./*charm --config role="config-server" config-server

watch -n1 --color juju status --color

juju ssh shard-one/0
systemctl status snap.charmed-mongodb.mongod.service
exit
juju ssh config-server/0
systemctl status snap.charmed-mongodb.mongod.service
systemctl status snap.charmed-mongodb.mongos.service
exit
```

New snap revison packages a new version of the PBM tool which updated
how errors were handled when querying PBM status, commit
[4bf9d5f](4bf9d5f)
reflects these necessary changes

Follow up PR is to be made immediately after merging of this feature is
completed and is a requirement of finishing
[DPE-2561](https://warthogs.atlassian.net/browse/DPE-2561). For this PR
this will be starting `mongos` with a `--auth` and the same `--keyFile`
used to start the`mongod` service

Future PR is to be started after the follow up PR has been made. Once
`mongos` is started with auth
[DPE-2562](https://warthogs.atlassian.net/browse/DPE-2562) will be
started. This includes creating a basic shared library between
`config-server` and `shard` components. In this PR we will:
- implement keyfile sharing across shard and config server components
- implement adding shards to cluster

(Shard removal is saved for later.)

As a POC this PR doesn't include handling edge cases, intelligent status
reporting, unit tests, or integration tests. These will be handled later
on down the line. Specifically:
1. block config change events for changing role of charm
2. report status of internal `mongos` in `update_status`
3. unit tests and integration tests

[DPE-2561]:
https://warthogs.atlassian.net/browse/DPE-2561?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Co-authored-by: Pedro Guimaraes <[email protected]>
dmitry-ratushnyy pushed a commit that referenced this pull request Oct 17, 2023
…ard (#246)

This PR enables the user to pass the following config options:
`replication`(default), `shard`, and `config-server`. This PR supports
this options by starting the charm as a `shard` or a `config-server`. If
the config option `config-server` is provided, then the charm starts an
internal `mongos` service that runs on 0.0.0.0 and is configured to the
provided config server.

As a POC there are not tests included in this PR. Testing was performed
by hand with:
```
charmcraft pack
juju deploy ./*charm --config role="shard" shard-one
juju deploy ./*charm --config role="config-server" config-server

watch -n1 --color juju status --color

juju ssh shard-one/0
systemctl status snap.charmed-mongodb.mongod.service
exit
juju ssh config-server/0
systemctl status snap.charmed-mongodb.mongod.service
systemctl status snap.charmed-mongodb.mongos.service
exit
```

New snap revison packages a new version of the PBM tool which updated
how errors were handled when querying PBM status, commit
[4bf9d5f](4bf9d5f)
reflects these necessary changes

Follow up PR is to be made immediately after merging of this feature is
completed and is a requirement of finishing
[DPE-2561](https://warthogs.atlassian.net/browse/DPE-2561). For this PR
this will be starting `mongos` with a `--auth` and the same `--keyFile`
used to start the`mongod` service

Future PR is to be started after the follow up PR has been made. Once
`mongos` is started with auth
[DPE-2562](https://warthogs.atlassian.net/browse/DPE-2562) will be
started. This includes creating a basic shared library between
`config-server` and `shard` components. In this PR we will:
- implement keyfile sharing across shard and config server components
- implement adding shards to cluster

(Shard removal is saved for later.)

As a POC this PR doesn't include handling edge cases, intelligent status
reporting, unit tests, or integration tests. These will be handled later
on down the line. Specifically:
1. block config change events for changing role of charm
2. report status of internal `mongos` in `update_status`
3. unit tests and integration tests

[DPE-2561]:
https://warthogs.atlassian.net/browse/DPE-2561?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Co-authored-by: Pedro Guimaraes <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants