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

[bitnami/mastodon] problems deploying chart mastodon-init never finished when initJob.createAdmin is true #14485

Closed
showxu opened this issue Jan 21, 2023 · 13 comments
Assignees
Labels
mastodon tech-issues The user has a technical issue about an application triage Triage is needed

Comments

@showxu
Copy link

showxu commented Jan 21, 2023

Name and Version

mastodon-1.0.0 4.0.2

What steps will reproduce the bug?

  1. mastodon-1.0.0 4.0.2 deployed on both TKG and docker-desktop

  2. values.yaml

    initJob.createAdmin: true
    adminUser: "user"
    adminEmail: "[email protected]"
    adminPassword: "abc1234567890"
    
  3. $ kubectl logs mastodon-init-5l8sb, console output:

    ERROR ==> Error creating admin user
    

Are you using any custom parameters or values?

NO

What is the expected behavior?

state of mastodon-web-xxxx shows Completed instead of NetReady

What do you see instead?

ERROR ==> Error creating admin user

Additional information

I have to turn off the initJob.createAdmin: false, and create admin manually with tootctl.

@showxu showxu added the tech-issues The user has a technical issue about an application label Jan 21, 2023
@github-actions github-actions bot added the triage Triage is needed label Jan 21, 2023
@carrodher
Copy link
Member

Please note in the values.yaml file the initJob.createAdmin: true format is not valid, you need to expand it as follows

initJob:
  createAdmin: true

@showxu
Copy link
Author

showxu commented Jan 21, 2023

Please note in the values.yaml file the initJob.createAdmin: true format is not valid, you need to expand it as follows

initJob:
  createAdmin: true

Yes, yaml format is valid which is copied from charts/mastodon/value.yaml.

Only the following config works.

initJob:
  createAdmin: false

@github-actions github-actions bot added in-progress and removed triage Triage is needed labels Jan 21, 2023
@bitnami-bot bitnami-bot assigned migruiz4 and unassigned carrodher Jan 21, 2023
@migruiz4
Copy link
Member

Hi @showxu,

Thank you for reporting this issue.

Could you please share the values MASTODON_ADMIN_EMAIL and MASTODON_ADMIN_USERNAME: user in the Mastodon configmap?

$ k get cm <your-release-name>-mastodon-default -o yaml
apiVersion: v1
data:
  DB_HOST: test-postgresql
  DB_NAME: bitnami_mastodon
  DB_PORT: "5432"
  DB_USER: bn_mastodon
  ES_ENABLED: "true"
  ES_HOST: test-elasticsearch
  ES_PORT: "9200"
  MASTODON_ADMIN_EMAIL: [email protected]
  MASTODON_ADMIN_USERNAME: user
  ...

There was an issue with the Mastodon default values, that forced us to change the default email [email protected] (https://github.com/bitnami/containers/pull/19154/files).
By default, Mastodon will block the email domain example.com unless it is explicitly set in the environment variable MASTODON_EMAIL_DOMAIN_ALLOWLIST.
Setting this variable by default had other major drawbacks, so we had to remove it and change the default admin email.

Version 1.0.0 of the chart still uses [email protected] as default value, causing the error described in your PR, but shouldn't happen if a different value for adminEmail is provided. Thus why I'm asking for the running configuration.

@migruiz4
Copy link
Member

migruiz4 commented Jan 23, 2023

Additionally, I would like to mention that failed pods from previous deployment jobs won't be deleted automatically, so it is possible that the mastodon-init pod corresponds to a previously failed deployment using the default adminEmail value.

@showxu
Copy link
Author

showxu commented Jan 23, 2023

Additionally, I would like to mention that failed pods from previous deployment jobs won't be deleted automatically, so it is possible that the mastodon-init pod corresponds to a previously failed deployment using the default adminEmail value.

Since I always use helm delete mastodon deployment and use kubectl pvc delete before each helm install, this scene may never happened?

My failed deployment values.yaml as follows:

adminUser: "admin"
## @param adminEmail Mastodon admin email
##
adminEmail: "[email protected]"
## @param adminPassword Mastodon admin password
##
adminPassword: "abc1234567890"

It failed and I think this user name "admin" is preserved, so I changed to:

adminUser: "admin2"
## @param adminEmail Mastodon admin email
##
adminEmail: "[email protected]"
## @param adminPassword Mastodon admin password
##
adminPassword: "abc1234567890"

also failed, and then I use my real one:

adminUser: "showxu"
## @param adminEmail Mastodon admin email
##
adminEmail: "[email protected]"
## @param adminPassword Mastodon admin password
##
adminPassword: "abc1234567890"

and it fails again.

Both 'admin2' and 'showxu' can be created by tootctl.

@showxu
Copy link
Author

showxu commented Jan 23, 2023

Hi @showxu,

Thank you for reporting this issue.

Could you please share the values MASTODON_ADMIN_EMAIL and MASTODON_ADMIN_USERNAME: user in the Mastodon configmap?

$ k get cm <your-release-name>-mastodon-default -o yaml
apiVersion: v1
data:
  DB_HOST: test-postgresql
  DB_NAME: bitnami_mastodon
  DB_PORT: "5432"
  DB_USER: bn_mastodon
  ES_ENABLED: "true"
  ES_HOST: test-elasticsearch
  ES_PORT: "9200"
  MASTODON_ADMIN_EMAIL: [email protected]
  MASTODON_ADMIN_USERNAME: user
  ...

There was an issue with the Mastodon default values, that forced us to change the default email [email protected] (https://github.com/bitnami/containers/pull/19154/files). By default, Mastodon will block the email domain example.com unless it is explicitly set in the environment variable MASTODON_EMAIL_DOMAIN_ALLOWLIST. Setting this variable by default had other major drawbacks, so we had to remove it and change the default admin email.

Version 1.0.0 of the chart still uses [email protected] as default value, causing the error described in your PR, but shouldn't happen if a different value for adminEmail is provided. Thus why I'm asking for the running configuration.

By the way, I didn't use the configmap, I use the values.yaml directly which was copied form this repo like:

helm install mastodon -f './application/mastodon/values.yaml'  bitnami/mastodon

@migruiz4
Copy link
Member

Since I always use helm delete mastodon deployment and use kubectl pvc delete before each helm install, this scene may never happened?

That is what I meant, Pods from failed jobs are not removed after helm delete or kubectl delete pvc, so if you haven't listed the pods after uninstalling the chart, it is very likely that is the case.

@showxu
Copy link
Author

showxu commented Jan 23, 2023

Hi @showxu,

Thank you for reporting this issue.

Could you please share the values MASTODON_ADMIN_EMAIL and MASTODON_ADMIN_USERNAME: user in the Mastodon configmap?

$ k get cm <your-release-name>-mastodon-default -o yaml
apiVersion: v1
data:
  DB_HOST: test-postgresql
  DB_NAME: bitnami_mastodon
  DB_PORT: "5432"
  DB_USER: bn_mastodon
  ES_ENABLED: "true"
  ES_HOST: test-elasticsearch
  ES_PORT: "9200"
  MASTODON_ADMIN_EMAIL: [email protected]
  MASTODON_ADMIN_USERNAME: user
  ...

There was an issue with the Mastodon default values, that forced us to change the default email [email protected] (https://github.com/bitnami/containers/pull/19154/files). By default, Mastodon will block the email domain example.com unless it is explicitly set in the environment variable MASTODON_EMAIL_DOMAIN_ALLOWLIST. Setting this variable by default had other major drawbacks, so we had to remove it and change the default admin email.

Version 1.0.0 of the chart still uses [email protected] as default value, causing the error described in your PR, but shouldn't happen if a different value for adminEmail is provided. Thus why I'm asking for the running configuration.

For the k get cm <your-release-name>-mastodon-default -o yaml result, I will try to reproduce the bug and give result to you later today.

@showxu
Copy link
Author

showxu commented Jan 23, 2023

Since I always use helm delete mastodon deployment and use kubectl pvc delete before each helm install, this scene may never happened?

That is what I meant, Pods from failed jobs are not removed after helm delete or kubectl delete pvc, so if you haven't listed the pods after uninstalling the chart, it is very likely that is the case.

To my case, I always used kubectl get pods -A before the installation, it seems all mastodon pods are removed.

@migruiz4
Copy link
Member

I was able to reproduce the adminUser: admin issue, but it appears that Mastodon restricts some usernames:

mastodon/mastodon#3566

The list of reserved usernames in the latest version (4.0.2) is:
reserved_usernames:

  • admin
  • support
  • help
  • root
  • webmaster
  • administrator
  • mod
  • moderator

Ref: https://github.com/mastodon/mastodon/blob/03b0f3ac83edfc46d304bfca1539ca6000e36fc3/config/settings.yml#L56-L64

@showxu
Copy link
Author

showxu commented Jan 23, 2023

After several deployment to docker-desktop, everything is ok and I think I can't reproduce this issue with adminUser: admin2, maybe my memory serves me wrong 😅

@xueshanf
Copy link

xueshanf commented Oct 3, 2023

It seems that only the first deployment you can set createAdmin: true (which is the default), after that, all updates or re-installation will fail unless you set it to be false. I think the admin info probably is in database, which usually we don't delete. Maybe the create process should check if the admin user is already in the db and not try to create even it's set to be true?

@github-actions github-actions bot added triage Triage is needed and removed solved labels Oct 3, 2023
@github-actions github-actions bot added the solved label Oct 3, 2023
xueshanf added a commit to xueshanf/containers that referenced this issue Oct 4, 2023
See bitnami/charts#14485.

If the admin user/email  is already exist, the current code exists with error instead of skipping account creation,  because the testing expects "been taken" string from tootctl command, however tootctl in  the 4.2.0 release that I tested, return different string:

```
res=$(tootctl accounts create "$MASTODON_ADMIN_USERNAME" --email "$MASTODON_ADMIN_EMAIL" "--confirmed" "--role" "Owner")
$ echo $res
Failure/Error: email taken Failure/Error: account.username taken
```

Simply change the testing string to "taken" fix this issue.


Signed-off-by: Xueshan Feng <[email protected]>
@github-actions github-actions bot removed the solved label Oct 4, 2023
@javsalgar
Copy link
Contributor

Thank you so much for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mastodon tech-issues The user has a technical issue about an application triage Triage is needed
Projects
None yet
Development

No branches or pull requests

5 participants