Giter Club home page Giter Club logo

wordpress-k8s-operator's People

Contributors

amandahla avatar arturo-seijas avatar barryprice avatar faebd7 avatar github-actions[bot] avatar gtrkiller avatar jdkandersson avatar juditnovak avatar merkata avatar mthaddon avatar nrobinaubertin avatar renovate[bot] avatar thanhphan1147 avatar weiiwang01 avatar yanksyoon avatar yhaliaw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wordpress-k8s-operator's Issues

If the reconciliation loop fails the charm can be in `blocked idle` status without giving the operator a way to resolve that

Bug Description

As the title of the bug says if the reconciliation loop fails the charm can be in blocked idle status without giving the operator a way to resolve that.

If we're putting a charm into blocked status we should be giving the operator a way to resolve that. This could be running an action, changing configuration or something else.

To Reproduce

It's hard to give exact instructions, as this depends on a race condition within the reconcile loop. We've experienced this with wp theme list --format=json command intermittently returning a 255 error code.

Environment

N/A

Relevant log output

N/A

Additional context

No response

Cannot relate with MySQL K8s via MySQL Router K8s: Invalid port 6446

Bug Description

It is not possible to relate wordpress-k8s with mysql-k8s via mysql-router-k8s,
the wordress-k8s charm blocks with message: "Invalid port 6446".

> juju status
Model       Controller  Cloud/Region        Version  SLA          Timestamp
wordpress2  microk8s    microk8s/localhost  3.1.6    unsupported  02:12:20+02:00

App               Version                  Status   Scale  Charm             Channel     Rev  Address         Exposed  Message
mysql-k8s         8.0.34-0ubuntu0.22.04.1  active       1  mysql-k8s         8.0/stable   99  10.152.183.172  no       
mysql-router-k8s  8.0.34-0ubuntu0.22.04.1  active       1  mysql-router-k8s  8.0/edge     68  10.152.183.238  no       
wordpress-k8s     5.9.3                    waiting      1  wordpress-k8s     stable       50  10.152.183.191  no       installing agent

Unit                 Workload  Agent  Address     Ports  Message
mysql-k8s/0*         active    idle   10.1.12.1          Primary
mysql-router-k8s/0*  active    idle   10.1.12.62         
wordpress-k8s/0*     blocked   idle   10.1.12.58         Invalid port 6446

To Reproduce

juju deploy mysql-k8s --trust
juju deploy mysql-router-k8s --channel 8.0/edge --trust
juju relate mysql-router-k8s mysql-k8s

juju deploy wordpress-k8s
juju relate mysql-router-k8s wordpress-k8s

Environment

juju             3.1.6          24626  3.1/stable          canonical✓  -
microk8s         v1.27.6        5959   1.27-strict/stable  canonical✓  -

Relevant log output

unit-wordpress-k8s-0: 02:11:52 DEBUG unit.wordpress-k8s/0.juju-log database:9: ops 2.6.0 up and running.
unit-wordpress-k8s-0: 02:11:52 DEBUG unit.wordpress-k8s/0.juju-log database:9: Invalid Prometheus alert rules folder at /var/lib/juju/agents/unit-wordpress-k8s-0/charm/src/prom
etheus_alert_rules: directory does not exist
unit-wordpress-k8s-0: 02:11:52 WARNING unit.wordpress-k8s/0.juju-log database:9: 2 containers are present in metadata.yaml and refresh_event was not specified. Defaulting to up
date_status. Metrics IP may not be set in a timely fashion.
unit-wordpress-k8s-0: 02:11:52 DEBUG unit.wordpress-k8s/0.juju-log database:9: Emitting Juju event database_relation_changed.
unit-wordpress-k8s-0: 02:11:52 INFO unit.wordpress-k8s/0.juju-log database:9: database created at 2023-10-18 00:11:52.895262
unit-wordpress-k8s-0: 02:11:52 DEBUG unit.wordpress-k8s/0.juju-log database:9: Emitting custom event <DatabaseCreatedEvent via WordpressCharm/DatabaseRequires[database]/on/data
base_created[98]>.
unit-wordpress-k8s-0: 02:11:52 INFO unit.wordpress-k8s/0.juju-log database:9: Start reconciliation process, triggered by <DatabaseCreatedEvent via WordpressCharm/DatabaseRequir
es[database]/on/database_created[98]>
unit-wordpress-k8s-0: 02:11:52 INFO unit.wordpress-k8s/0.juju-log database:9: Start core reconciliation process
unit-wordpress-k8s-0: 02:11:52 INFO unit.wordpress-k8s/0.juju-log database:9: Reconciliation process terminated early, reason: Invalid port 6446

Additional context

It is constantly reproducible.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/auto_update_libs.yaml
.github/workflows/comment.yaml
.github/workflows/integration_test.yaml
.github/workflows/integration_test_juju3.yaml
.github/workflows/promote_charm.yaml
.github/workflows/publish_charm.yaml
.github/workflows/test.yaml
pip_requirements
requirements.txt
  • ops ==2.8.0
  • requests ==2.31.0
  • pydantic >=1,<2

  • Check this box to trigger a request for Renovate to run again on this repository

Remove outdated plugins

Bug Description

The following plugins are outdated/deprecated/removed due to violation of guidelines and are no longer available.

fruitful-shortcodes
hello
social-media-buttons-toolbar
wordpress-seo

To Reproduce

https://wordpress.org/plugins/fruitful-shortcodes/ - removed due to violation of guidelines
https://wordpress.org/plugins/hello/ - not found
https://wordpress.org/plugins/social-media-buttons-toolbar/ - removed due to violation of guidelines
https://wordpress.org/plugins/wordpress-seo/ - unsupported version

Environment

N/A

Relevant log output

N/A

Additional context

No response

reconciliation loops runs three times on charm upgrade

Bug Description

The reconciliation loop runs three times on charm upgrade. See https://pastebin.canonical.com/p/3CJxW9mB4m/ for an example (sorry, Canonical internal only).

To Reproduce

  1. Deploy wordpress according to the docs
  2. Trigger a charm upgrade
  3. Observe the following two entries in the logs:
Start reconciliation process, triggered by <ConfigChangedEvent via WordpressCharm/on/config_changed[6]>
Start reconciliation process, triggered by <PebbleReadyEvent via WordpressCharm/on/apache_prometheus_exporter_pebble_ready[16]>
Start reconciliation process, triggered by <PebbleReadyEvent via WordpressCharm/on/wordpress_pebble_ready[21]>

Environment

Juju 2.9.44 on OpenStack, but should be reproducible on any environment

Relevant log output

See above

Additional context

N/A

"wp core is-installed query" hanging

Bug Description

After relating the wordpress-k8s charm to an existing mysql-k8s + mysql-router-k8s pair, it keeps hainging with the following error repeting in juju debug-log

ops.pebble.ChangeError: cannot perform the following tasks:
- exec command "wp" (timed out after 1m0s: context deadline exceeded)
----- Logs from task 0 -----
2023-11-21T20:39:36Z ERROR timed out after 1m0s: context deadline exceeded
-----

To Reproduce

juju deploy wordpress-k8s --channel latest/edge

juju deploy mysql-router-k8s --trust --channel 8.0/edge
juju deploy mysql-k8s --trust --channel 8.0/edge

juju relate mysql-router-k8s mysql-k8s
juju relate mysql-router-k8s wordpress-k8s

Environment

juju 3.1/stable (i.e. 3.1.6)

Relevant log output

unit-wordpress-k8s-0: 21:18:42 ERROR unit.wordpress-k8s/0.juju-log database:7: Uncaught exception while in charm code:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/./src/charm.py", line 1477, in <module>
    main(WordpressCharm)
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/venv/ops/main.py", line 436, in main
    _emit_charm_event(charm, dispatcher.event_name)
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/venv/ops/main.py", line 144, in _emit_charm_event
    event_to_emit.emit(*args, **kwargs)
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/venv/ops/framework.py", line 340, in emit
    framework._emit(event)
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/venv/ops/framework.py", line 842, in _emit
    self._reemit(event_path)
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/venv/ops/framework.py", line 931, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/lib/charms/data_platform_libs/v0/data_interfaces.py", line 1958, in _on_relation_changed_event
    getattr(self.on, "database_created").emit(
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/venv/ops/framework.py", line 340, in emit
    framework._emit(event)
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/venv/ops/framework.py", line 842, in _emit
    self._reemit(event_path)
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/venv/ops/framework.py", line 931, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/./src/charm.py", line 1445, in _reconciliation
    self._core_reconciliation()
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/./src/charm.py", line 811, in _core_reconciliation
    self._start_server()
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/./src/charm.py", line 725, in _start_server
    if not self._wp_is_installed():
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/./src/charm.py", line 573, in _wp_is_installed
    return self._run_wp_cli(["wp", "core", "is-installed"]).return_code == 0
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/./src/charm.py", line 526, in _run_wp_cli
    result = self._run_cli(
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/./src/charm.py", line 486, in _run_cli
    stdout, stderr = process.wait_output()
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/venv/ops/pebble.py", line 1369, in wait_output
    exit_code: int = self._wait()
  File "/var/lib/juju/agents/unit-wordpress-k8s-0/charm/venv/ops/pebble.py", line 1330, in _wait
    raise ChangeError(change.err, change)
ops.pebble.ChangeError: cannot perform the following tasks:
- exec command "wp" (timed out after 1m0s: context deadline exceeded)
----- Logs from task 0 -----

Additional context

wordpress-k8s is stuck in blocked: Waiting for db relation/config" state

Model  Controller          Cloud/Region        Version  SLA          Timestamp
wp4    microk8s-localhost  microk8s/localhost  3.1.6    unsupported  22:04:15+01:00

App               Version                  Status   Scale  Charm             Channel      Rev  Address         Exposed  Message
mysql-k8s         8.0.34-0ubuntu0.22.04.1  active       1  mysql-k8s         8.0/edge     110  10.152.183.228  no       
mysql-router-k8s  8.0.34-0ubuntu0.22.04.1  active       1  mysql-router-k8s  8.0/edge      77  10.152.183.210  no       
wordpress-k8s     6.4.1                    waiting      1  wordpress-k8s     latest/edge   66  10.152.183.70   no       installing agent

Unit                 Workload  Agent      Address       Ports  Message
mysql-k8s/0*         active    idle       10.1.244.113         Primary
mysql-router-k8s/0*  active    idle       10.1.244.74          
wordpress-k8s/0*     blocked   executing  10.1.244.108         Waiting for db relation/config

Integration provider                 Requirer                             Interface           Type     Message
mysql-k8s:database                   mysql-router-k8s:backend-database    mysql_client        regular  
mysql-k8s:database-peers             mysql-k8s:database-peers             mysql_peers         peer     
mysql-k8s:restart                    mysql-k8s:restart                    rolling_op          peer     
mysql-k8s:upgrade                    mysql-k8s:upgrade                    upgrade             peer     
mysql-router-k8s:database            wordpress-k8s:database               mysql_client        regular  
mysql-router-k8s:mysql-router-peers  mysql-router-k8s:mysql-router-peers  mysql_router_peers  peer     
mysql-router-k8s:upgrade-version-a   mysql-router-k8s:upgrade-version-a   upgrade             peer     
wordpress-k8s:wordpress-replica      wordpress-k8s:wordpress-replica      wordpress-replica   peer    

Charm fails if it's relations are not ready yet

Bug Description

If deployed together with mysql-k8s and related immediately, the charm goes into install failed, due to MySQL not yet being ready to accept the connection. We need to stand off until we're able to successfully connect from the charm before we try to go ahead with the installation.

To Reproduce

  1. juju deploy wordpress-k8s --channel edge && juju deploy mysql-k8s --channel edge && juju relate wordpress-k8s mysql-k8s:database && juju relate wordpress-k8s mysql-k8s:mysql
  2. juju status --watch 1s

Environment

juju 3.1+

Relevant log output

unit-wordpress-0: 19:26:41 WARNING unit.wordpress/0.install Traceback (most recent call last):
unit-wordpress-0: 19:26:41 WARNING unit.wordpress/0.install   File "./src/charm.py", line 45, in <module>
unit-wordpress-0: 19:26:41 WARNING unit.wordpress/0.install     import types_
unit-wordpress-0: 19:26:41 WARNING unit.wordpress/0.install   File "/var/lib/juju/agents/unit-wordpress-0/charm/src/types_.py", line 37, in <module>
unit-wordpress-0: 19:26:41 WARNING unit.wordpress/0.install     class DatabaseConfig(NamedTuple):
unit-wordpress-0: 19:26:41 WARNING unit.wordpress/0.install   File "/var/lib/juju/agents/unit-wordpress-0/charm/src/types_.py", line 47, in DatabaseConfig
unit-wordpress-0: 19:26:41 WARNING unit.wordpress/0.install     hostname: str | None
unit-wordpress-0: 19:26:41 WARNING unit.wordpress/0.install TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
unit-wordpress-0: 19:26:41 ERROR juju.worker.uniter.operation hook "install" (via hook dispatching script: dispatch) failed: exit status 1
unit-wordpress-0: 19:26:41 INFO juju.worker.uniter awaiting error resolution for "install" hook
unit-wordpress-0: 19:26:42 INFO juju.worker.uniter awaiting error resolution for "install" hook
unit-wordpress-0: 19:26:42 INFO juju.worker.uniter awaiting error resolution for "install" hook
unit-wordpress-0: 19:26:46 INFO juju.worker.uniter awaiting error resolution for "install" hook
unit-mysql-0: 19:26:46 INFO unit.mysql/0.juju-log Configuring instance
unit-wordpress-0: 19:26:46 WARNING unit.wordpress/0.install Traceback (most recent call last):
unit-wordpress-0: 19:26:46 WARNING unit.wordpress/0.install   File "./src/charm.py", line 45, in <module>
unit-wordpress-0: 19:26:46 WARNING unit.wordpress/0.install     import types_
unit-wordpress-0: 19:26:46 WARNING unit.wordpress/0.install   File "/var/lib/juju/agents/unit-wordpress-0/charm/src/types_.py", line 37, in <module>
unit-wordpress-0: 19:26:46 WARNING unit.wordpress/0.install     class DatabaseConfig(NamedTuple):
unit-wordpress-0: 19:26:46 WARNING unit.wordpress/0.install   File "/var/lib/juju/agents/unit-wordpress-0/charm/src/types_.py", line 47, in DatabaseConfig
unit-wordpress-0: 19:26:46 WARNING unit.wordpress/0.install     hostname: str | None
unit-wordpress-0: 19:26:46 WARNING unit.wordpress/0.install TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
unit-wordpress-0: 19:26:47 ERROR juju.worker.uniter.operation hook "install" (via hook dispatching script: dispatch) failed: exit status 1

Additional context

Deployed using the terraform provider, so everything is done as one operation. Reproduction steps are concatenated to represent that.

Cannot re-relate with mysql-k8s (8.0/stable)

Bug Description

Hi,

I am experiencing an issues on initial relation between mysql-k8s (revision 99, from 8.0/stable):

Issue 1: Initial bootstrap stuck IF relation requested immediately:

juju deploy mysql-k8s --trust
juju deploy wordpress-k8s
juju relate mysql-k8s wordpress-k8s

Actual results:

Unit               Workload  Agent  Address     Ports  Message
mysql-k8s/0*       active    idle   10.1.84.97         Primary
mysql-test-app/0*  waiting   idle   10.1.84.84

Error log is empty and I see properly populated databag by mysql-k8s:

  - relation-id: 3
    endpoint: database
    related-endpoint: database
    application-data:
      data: '{"database": "wordpress-k8s"}'
      database: wordpress-k8s
      endpoints: mysql-k8s-primary.test7.svc.cluster.local:3306
      password: Cwck7x8MuBpZPPWZh1fB6icW
      read-only-endpoints: mysql-k8s-replicas.test7.svc.cluster.local:3306
      username: relation-3
      version: 8.0.34-0ubuntu0.22.04.1

NOTE: the is no such issue1 IF relation between MySQL and Wordpress established after the full MySQL deployment:

juju deploy mysql-k8s --trust
juju wait-for application mysql-k8s
juju deploy wordpress-k8s
juju relate mysql-k8s wordpress-k8s

Any ideas what can be missing here?

Issue 2: It is not possible to remove relation if it stuck on issue1 described above:

juju remove-relation mysql-k8s wordpress-k8s

juju debug-log --tail
ubuntu@taurus-dev:~$ unit-mysql-k8s-0: 14:28:52 DEBUG unit.mysql-k8s/0.juju-log database:3: ops 2.6.0 up and running.
unit-mysql-k8s-0: 14:28:52 DEBUG unit.mysql-k8s/0.juju-log database:3: Emitting Juju event database_relation_departed.
unit-mysql-k8s-0: 14:28:52 DEBUG unit.mysql-k8s/0.juju-log database:3: Retrieved secret root-password for app
unit-mysql-k8s-0: 14:28:52 DEBUG unit.mysql-k8s/0.juju-log database:3: Retrieved secret server-config-password for app
unit-mysql-k8s-0: 14:28:52 DEBUG unit.mysql-k8s/0.juju-log database:3: Retrieved secret cluster-admin-password for app
unit-mysql-k8s-0: 14:28:52 DEBUG unit.mysql-k8s/0.juju-log database:3: Retrieved secret monitoring-password for app
unit-mysql-k8s-0: 14:28:52 DEBUG unit.mysql-k8s/0.juju-log database:3: Retrieved secret backups-password for app
unit-mysql-k8s-0: 14:28:53 INFO juju.worker.uniter.operation ran "database-relation-departed" hook (via hook dispatching script: dispatch)
unit-mysql-k8s-0: 14:28:53 DEBUG unit.mysql-k8s/0.juju-log database:3: ops 2.6.0 up and running.
unit-mysql-k8s-0: 14:28:53 DEBUG unit.mysql-k8s/0.juju-log database:3: Emitting Juju event database_relation_broken.
unit-mysql-k8s-0: 14:28:53 INFO unit.mysql-k8s/0.juju-log database:3: Kubernetes service mysql-k8s-primary deleted
unit-mysql-k8s-0: 14:28:53 INFO unit.mysql-k8s/0.juju-log database:3: Kubernetes service mysql-k8s-replicas deleted
unit-mysql-k8s-0: 14:28:53 DEBUG unit.mysql-k8s/0.juju-log database:3: Retrieved secret root-password for app
unit-mysql-k8s-0: 14:28:53 DEBUG unit.mysql-k8s/0.juju-log database:3: Retrieved secret server-config-password for app
unit-mysql-k8s-0: 14:28:53 DEBUG unit.mysql-k8s/0.juju-log database:3: Retrieved secret cluster-admin-password for app
unit-mysql-k8s-0: 14:28:53 DEBUG unit.mysql-k8s/0.juju-log database:3: Retrieved secret monitoring-password for app
unit-mysql-k8s-0: 14:28:53 DEBUG unit.mysql-k8s/0.juju-log database:3: Retrieved secret backups-password for app
unit-mysql-k8s-0: 14:28:53 INFO unit.mysql-k8s/0.juju-log database:3: Removed user(s) for relation 3
unit-mysql-k8s-0: 14:28:54 INFO juju.worker.uniter.operation ran "database-relation-broken" hook (via hook dispatching script: dispatch)

And relation stuck here in dying state:

> juju relate mysql-k8s wordpress-k8s
ERROR cannot add relation "wordpress-k8s:database mysql-k8s:database"
relation wordpress-k8s:database mysql-k8s:database is dying, but not yet removed (already exists): 

Use 'juju status --relations' to view the current relations.

Maybe it worth to update data-platform-libs? Good ideas are welcome!

To Reproduce

Issue 1:
juju deploy mysql-k8s --trust
juju deploy wordpress-k8s
juju relate mysql-k8s wordpress-k8s

Issue 2:
juju remove-relation mysql-k8s wordpress-k8s
juju relate mysql-k8s wordpress-k8s

Environment

juju 3.1.6-f6a66aa 24582 3.1/edge canonical✓ -
microk8s v1.28.0 5802 1.28-strict/stable canonical✓ -

ubuntu@taurus-dev:~$ juju status --relations
Model  Controller  Cloud/Region        Version  SLA          Timestamp
test8  k8s6        microk8s/localhost  3.1.6    unsupported  14:32:35+02:00

App            Version                  Status   Scale  Charm          Channel     Rev  Address         Exposed  Message
mysql-k8s      8.0.34-0ubuntu0.22.04.1  active       1  mysql-k8s      8.0/stable   99  10.152.183.132  no       
wordpress-k8s  5.9.3                    waiting      1  wordpress-k8s  stable       42  10.152.183.111  no       installing agent

Unit              Workload     Agent  Address      Ports  Message
mysql-k8s/0*      active       idle   10.1.84.123         Primary
wordpress-k8s/0*  maintenance  idle   10.1.84.108         Starting apache-prometheus-exporter container

Integration provider             Requirer                         Interface          Type     Message
mysql-k8s:database               wordpress-k8s:database           mysql_client       regular  
mysql-k8s:database-peers         mysql-k8s:database-peers         mysql_peers        peer     
mysql-k8s:upgrade                mysql-k8s:upgrade                upgrade            peer     
wordpress-k8s:wordpress-replica  wordpress-k8s:wordpress-replica  wordpress-replica  peer     
ubuntu@taurus-dev:~$ 

Relevant log output

None

Additional context

No response

Grafana dashboard enhancement

Enhancement Proposal

Out of the listed (apache metrics)[https://github.com//pull/43#issuecomment-1427567340], it would be nice to have a Grafana dashboard that the SREs may need or rank the metrics in the order of importance.

No more relational databag usage

Bug Description

Currently the wordpress(-k8s) charm is reading information from the databag.
This results in the charm hanging in the _test_database_connectivity() function at reconciliation, when the service would start up.

https://github.com/canonical/wordpress-k8s-operator/blob/main/src/charm.py#L612-L613

This and similar references direct references to the databag must be changed to use the fetch_relation_data() (or the new, more convenient fetch_relation_field() interface function call.

Please feel free to reach out if more info or help may be needed.

To Reproduce

juju deploy wordpress-k8s --channel latest/edge

juju deploy mysql-router-k8s --trust --channel 8.0/edge
juju deploy mysql-k8s --trust --channel 8.0/edge

juju relate mysql-router-k8s mysql-k8s
juju relate mysql-router-k8s wordpress-k8s

Environment

Juju 3.1

Relevant log output

Typically the "last words" wordpress may say before hanging:

unit-wordpress-k8s-0: 23:29:56 INFO unit.wordpress-k8s/0.juju-log database:7: Ensure WordPress (apache) server is down
unit-wordpress-k8s-0: 23:30:05 INFO unit.wordpress-k8s/0.juju-log database:7: Update wp-config.php content in container
unit-wordpress-k8s-0: 23:30:17 INFO unit.wordpress-k8s/0.juju-log database:7: Ensure WordPress server is up

Additional context

No response

get-initial-password action wrong password

Bug Description

get-initial-password action currently does not work as intended if one or more WordPress instances join the relation and/or a new WordPress instance replaces an existing old one(remove & deploy).

It seems to be due to relation-data among WordPress peers not getting cleared by Juju.

It may be worthwhile to store the data elsewhere(new juju secrets perhaps?).

To Reproduce

  1. Deploy and relate necessary charms
juju deploy charmed-osm-mariadb-k8s mariadb
juju deploy wordpress-k8s --channel=edge
juju relate wordpress-k8s mariadb
  1. Run get-initial-password action
    juju run-action wordpress-k8s/0 get-initial-password

  2. Navigate to wordpress (http://UNIT_ADDRESS/wp-login.php) and login with password
    Should succeed.

  3. Deploy another instance of wordpress
    juju deploy wordpress-k8s --channel=edge wordpress-k8s-2

  4. Run get-initial-password action
    juju run-actino wordpress-k8s-2/0 get-initial-password

  5. Navigate to second wordpress unit and login with second password
    Fails.

6.a. Navigate to second wordpress unit and login with first password
Succeeds.

Environment

Wordpress-k8s channel edge

Relevant log output

N/A

Additional context

No response

wordpress container restarts

Bug Description

We get frequent alerts due to the wordpress container restarting. This was addressed by #135 and an upgrade to r46 of the charm, but either this didn't solve the problem or a new one has arisen.

To Reproduce

Deploy the charm.

Environment

prod-is-external-kubernetes@is-bastion-ps5

Relevant log output

prod-is-external-kubernetes@is-bastion-ps5:~$ kubectl logs -n prod-admin-insights-ubuntu-k8s wordpress-k8s-0 wordpress -p | tail -n 20
2023-09-27T01:21:43.634Z [wordpress] 10.86.80.0 - - [27/Sep/2023:01:21:42 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T01:21:43.916Z [wordpress] 10.86.11.0 - - [27/Sep/2023:01:21:42 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T01:21:44.054Z [wordpress] 10.86.64.1 - - [27/Sep/2023:01:21:42 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T01:21:44.915Z [wordpress] 10.86.93.0 - - [27/Sep/2023:01:21:43 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T01:21:45.652Z [wordpress] 10.86.64.1 - - [27/Sep/2023:01:21:43 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T01:21:45.828Z [wordpress] 10.86.11.0 - - [27/Sep/2023:01:21:43 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T01:21:45.953Z [wordpress] 10.86.11.0 - - [27/Sep/2023:01:21:44 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T01:21:46.165Z [wordpress] 10.86.11.0 - - [27/Sep/2023:01:21:44 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T01:21:47.107Z [wordpress] 127.0.0.1 - - [27/Sep/2023:01:21:47 +0000] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f (internal dummy connection)"
2023-09-27T01:21:47.297Z [wordpress] 10.86.73.0 - - [27/Sep/2023:01:21:45 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T01:21:50.450Z [wordpress] 127.0.0.1 - - [27/Sep/2023:01:21:50 +0000] "GET /index.php HTTP/1.1" 301 217 "-" "Go-http-client/1.1"
2023-09-27T01:21:51.625Z [wordpress] localhost - - [27/Sep/2023:01:21:51 +0000] "GET /server-status/?auto HTTP/1.1" 200 753 "-" "Go-http-client/1.1"
2023-09-27T01:21:53.037Z [pebble] Check "wordpress-ready" failure 3 (threshold 3): Get "http://localhost/": context deadline exceeded
2023-09-27T01:21:53.037Z [pebble] Check "wordpress-ready" failure threshold 3 hit, triggering action
2023-09-27T01:21:55.757Z [wordpress] [Wed Sep 27 01:21:55.757389 2023] [php7:notice] [pid 333] [client 10.86.73.0:34576] WordPress database error Deadlock found when trying to get lock; try restarting transaction for query INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_timeout_global_styles_resource-centre', '1695777770', 'no') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`) made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/resource-centre/index.php'), get_header, locate_template, load_template, require_once('/themes/resource-centre/header.php'), wp_head, do_action('wp_head'), WP_Hook->do_action, WP_Hook->apply_filters, wp_enqueue_scripts, do_action('wp_enqueue_scripts'), WP_Hook->do_action, WP_Hook->apply_filters, wp_enqueue_global_styles, wp_get_global_stylesheet, set_transient, add_option
2023-09-27T01:21:55.757Z [wordpress] [Wed Sep 27 01:21:55.757649 2023] [php7:notice] [pid 339] [client 10.86.80.0:56874] WordPress database error Deadlock found when trying to get lock; try restarting transaction for query INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_timeout_global_styles_resource-centre', '1695777771', 'no') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`) made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/resource-centre/index.php'), get_header, locate_template, load_template, require_once('/themes/resource-centre/header.php'), wp_head, do_action('wp_head'), WP_Hook->do_action, WP_Hook->apply_filters, wp_enqueue_scripts, do_action('wp_enqueue_scripts'), WP_Hook->do_action, WP_Hook->apply_filters, wp_enqueue_global_styles, wp_get_global_stylesheet, set_transient, add_option
2023-09-27T01:21:55.762Z [wordpress] [Wed Sep 27 01:21:55.761759 2023] [php7:notice] [pid 340] [client 10.86.80.0:56882] WordPress database error Deadlock found when trying to get lock; try restarting transaction for query INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_timeout_global_styles_resource-centre', '1695777771', 'no') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`) made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/resource-centre/index.php'), get_header, locate_template, load_template, require_once('/themes/resource-centre/header.php'), wp_head, do_action('wp_head'), WP_Hook->do_action, WP_Hook->apply_filters, wp_enqueue_scripts, do_action('wp_enqueue_scripts'), WP_Hook->do_action, WP_Hook->apply_filters, wp_enqueue_global_styles, wp_get_global_stylesheet, set_transient, add_option
2023-09-27T01:21:57.395Z [pebble] Exiting on terminated signal.
2023-09-27T01:21:57.399Z [pebble] Stopping all running services.
2023-09-27T01:21:57.525Z [pebble] Service "wordpress" stopped
prod-is-external-kubernetes@is-bastion-ps5:~$ kubectl logs -n prod-admin-insights-ubuntu-k8s wordpress-k8s-1 wordpress -p | tail -n 20
2023-09-27T00:56:09.429Z [wordpress] 10.86.93.0 - - [27/Sep/2023:00:56:03 +0000] "GET / HTTP/1.1" 200 15465 "-" "haproxy/httpchk"
2023-09-27T00:56:09.561Z [wordpress] 10.86.93.0 - - [27/Sep/2023:00:55:49 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T00:56:09.597Z [wordpress] localhost - - [27/Sep/2023:00:56:09 +0000] "GET /server-status/?auto HTTP/1.1" 200 765 "-" "Go-http-client/1.1"
2023-09-27T00:56:09.636Z [wordpress] 10.86.64.0 - - [27/Sep/2023:00:56:03 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T00:56:09.638Z [wordpress] 10.86.73.0 - - [27/Sep/2023:00:56:03 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T00:56:09.749Z [wordpress] 10.86.11.1 - - [27/Sep/2023:00:56:04 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T00:56:09.954Z [wordpress] 10.86.80.0 - - [27/Sep/2023:00:56:04 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T00:56:10.081Z [wordpress] 127.0.0.1 - - [27/Sep/2023:00:56:10 +0000] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f (internal dummy connection)"
2023-09-27T00:56:10.175Z [wordpress] 10.86.64.0 - - [27/Sep/2023:00:56:05 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T00:56:11.090Z [wordpress] 127.0.0.1 - - [27/Sep/2023:00:56:11 +0000] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f (internal dummy connection)"
2023-09-27T00:56:11.327Z [wordpress] 10.86.64.0 - - [27/Sep/2023:00:56:07 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T00:56:11.499Z [wordpress] 127.0.0.1 - - [27/Sep/2023:00:56:10 +0000] "GET /index.php HTTP/1.1" 301 217 "-" "Go-http-client/1.1"
2023-09-27T00:56:11.573Z [wordpress] 10.86.73.0 - - [27/Sep/2023:00:56:06 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T00:56:12.160Z [wordpress] 10.86.11.1 - - [27/Sep/2023:00:56:07 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T00:56:12.507Z [wordpress] 10.86.93.0 - - [27/Sep/2023:00:56:07 +0000] "GET / HTTP/1.1" 200 23722 "-" "haproxy/httpchk"
2023-09-27T00:56:13.214Z [pebble] Check "wordpress-ready" failure 3 (threshold 3): Get "http://localhost/": context deadline exceeded
2023-09-27T00:56:13.214Z [pebble] Check "wordpress-ready" failure threshold 3 hit, triggering action
2023-09-27T00:56:13.513Z [pebble] Exiting on terminated signal.
2023-09-27T00:56:13.518Z [pebble] Stopping all running services.
2023-09-27T00:56:13.678Z [pebble] Service "wordpress" stopped
prod-is-external-kubernetes@is-bastion-ps5:~$

Additional context

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.