launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29158
[Merge] ~cjwatson/launchpad:charm-appserver-fixes into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:charm-appserver-fixes into launchpad:master.
Commit message:
Fix various problems with the appserver charm
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/429652
On redeploying the `launchpad-appserver` charm, I found a collection of problems that prevented the result from working.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:charm-appserver-fixes into launchpad:master.
diff --git a/charm/launchpad-appserver/reactive/launchpad-appserver.py b/charm/launchpad-appserver/reactive/launchpad-appserver.py
index c5fac0e..f34d40d 100644
--- a/charm/launchpad-appserver/reactive/launchpad-appserver.py
+++ b/charm/launchpad-appserver/reactive/launchpad-appserver.py
@@ -27,7 +27,9 @@ def enable_service(service):
{
"/etc/rsyslog.d/22-launchpad.conf": ["rsyslog"],
"/lib/systemd/system/launchpad.service": ["launchpad"],
- config_file_path("gunicorn.conf.py"): ["launchpad"],
+ config_file_path("launchpad-appserver/gunicorn.conf.py"): [
+ "launchpad"
+ ],
},
restart_functions={
"rsyslog": reload_or_restart,
@@ -40,7 +42,9 @@ def configure_gunicorn(config):
if config["wsgi_workers"] == 0:
config["wsgi_workers"] = cpu_count() * 2 + 1
templating.render(
- "gunicorn.conf.py.j2", config_file_path("gunicorn.conf.j2"), config
+ "gunicorn.conf.py.j2",
+ config_file_path("launchpad-appserver/gunicorn.conf.py"),
+ config,
)
templating.render(
"launchpad.service.j2", "/lib/systemd/system/launchpad.service", config
diff --git a/charm/layer/launchpad-base/reactive/launchpad-base.py b/charm/layer/launchpad-base/reactive/launchpad-base.py
index e5e90ea..8dd3b69 100644
--- a/charm/layer/launchpad-base/reactive/launchpad-base.py
+++ b/charm/layer/launchpad-base/reactive/launchpad-base.py
@@ -9,7 +9,7 @@ from charms.launchpad.base import (
ensure_lp_directories,
get_service_config,
)
-from charms.reactive import remove_state, set_state, when, when_not
+from charms.reactive import hook, remove_state, set_state, when, when_not
from ols import base
@@ -49,6 +49,15 @@ def configure():
set_state("launchpad.base.configured")
+@hook("upgrade-charm")
+def upgrade_charm():
+ # The ols layer takes care of removing the ols.service.installed,
+ # ols.configured, and service.configured states. Remove
+ # launchpad.base.configured as well so that we have an opportunity to
+ # rewrite base configuration files.
+ remove_state("launchpad.base.configured")
+
+
@when("config.changed.build_label")
def build_label_changed():
remove_state("ols.service.installed")
diff --git a/charm/layer/launchpad-base/templates/launchpad-base-lazr.conf b/charm/layer/launchpad-base/templates/launchpad-base-lazr.conf
index f0b4aeb..e66d6ec 100644
--- a/charm/layer/launchpad-base/templates/launchpad-base-lazr.conf
+++ b/charm/layer/launchpad-base/templates/launchpad-base-lazr.conf
@@ -16,9 +16,7 @@ pid_dir: {{ var_dir }}
[database]
db_statement_timeout: 15000
rw_main_primary: {{ db_primary }}
-{%- if db_standby %}
-rw_main_standby: {{ db_standby }}
-{%- endif %}
+rw_main_standby: {{ db_standby or db_primary }}
soft_request_timeout: 8000
[error_reports]