kdambekalns
(Karsten Dambekalns)
August 10, 2023, 2:17pm
1
Do I understand it correctly that doing a manual rebuild app
does the update and thus works around the need to access that upgrade page – but the error still needs to be fixed? Fine, then I’ll just ignore that for now…
Because I did a manual rebuild, and the upgrade page still shows that error… but /logs
gives me this:
NoMethodError (undefined method `sub!' for nil:NilClass)
app/controllers/application_controller.rb:420:in `block in with_resolved_locale'
app/controllers/application_controller.rb:420:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:74:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:389:in `call'
lib/middleware/gtm_script_nonce_injector.rb:10:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/request_tracker.rb:228:in `call'
plugins/docker_manager/lib/docker_manager/git_repo.rb:85:in `url'
plugins/docker_manager/app/controllers/docker_manager/admin_controller.rb:30:in `block in repos'
plugins/docker_manager/app/controllers/docker_manager/admin_controller.rb:16:in `map!'
plugins/docker_manager/app/controllers/docker_manager/admin_controller.rb:16:in `repos'
actionpack (7.0.5.1) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (7.0.5.1) lib/abstract_controller/base.rb:215:in `process_action'
actionpack (7.0.5.1) lib/action_controller/metal/rendering.rb:165:in `process_action'
actionpack (7.0.5.1) lib/abstract_controller/callbacks.rb:234:in `block in process_action'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:118:in `block in run_callbacks'
app/controllers/application_controller.rb:420:in `block in with_resolved_locale'
i18n (1.14.1) lib/i18n.rb:322:in `with_locale'
app/controllers/application_controller.rb:420:in `with_resolved_locale'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:127:in `block in run_callbacks'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:138:in `run_callbacks'
actionpack (7.0.5.1) lib/abstract_controller/callbacks.rb:233:in `process_action'
actionpack (7.0.5.1) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (7.0.5.1) lib/action_controller/metal/instrumentation.rb:67:in `block in process_action'
activesupport (7.0.5.1) lib/active_support/notifications.rb:206:in `block in instrument'
activesupport (7.0.5.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (7.0.5.1) lib/active_support/notifications.rb:206:in `instrument'
actionpack (7.0.5.1) lib/action_controller/metal/instrumentation.rb:66:in `process_action'
actionpack (7.0.5.1) lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
activerecord (7.0.5.1) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (7.0.5.1) lib/abstract_controller/base.rb:151:in `process'
actionview (7.0.5.1) lib/action_view/rendering.rb:39:in `process'
rack-mini-profiler (3.1.0) lib/mini_profiler/profiling_methods.rb:85:in `block in profile_method'
actionpack (7.0.5.1) lib/action_controller/metal.rb:188:in `dispatch'
actionpack (7.0.5.1) lib/action_controller/metal.rb:251:in `dispatch'
actionpack (7.0.5.1) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (7.0.5.1) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (7.0.5.1) lib/action_dispatch/routing/mapper.rb:18:in `block in <class:Constraints>'
actionpack (7.0.5.1) lib/action_dispatch/routing/mapper.rb:48:in `serve'
actionpack (7.0.5.1) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (7.0.5.1) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (7.0.5.1) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.0.5.1) lib/action_dispatch/routing/route_set.rb:852:in `call'
railties (7.0.5.1) lib/rails/engine.rb:530:in `call'
railties (7.0.5.1) lib/rails/railtie.rb:226:in `public_send'
railties (7.0.5.1) lib/rails/railtie.rb:226:in `method_missing'
actionpack (7.0.5.1) lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
actionpack (7.0.5.1) lib/action_dispatch/routing/mapper.rb:48:in `serve'
actionpack (7.0.5.1) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (7.0.5.1) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (7.0.5.1) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.0.5.1) lib/action_dispatch/routing/route_set.rb:852:in `call'
lib/middleware/omniauth_bypass_middleware.rb:74:in `call'
rack (2.2.8) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.8) lib/rack/conditional_get.rb:27:in `call'
rack (2.2.8) lib/rack/head.rb:12:in `call'
actionpack (7.0.5.1) lib/action_dispatch/http/permissions_policy.rb:38:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:389:in `call'
lib/middleware/gtm_script_nonce_injector.rb:10:in `call'
rack (2.2.8) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.8) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (7.0.5.1) lib/action_dispatch/middleware/cookies.rb:704:in `call'
actionpack (7.0.5.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (7.0.5.1) lib/active_support/callbacks.rb:99:in `run_callbacks'
actionpack (7.0.5.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (7.0.5.1) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call'
actionpack (7.0.5.1) lib/action_dispatch/middleware/show_exceptions.rb:26:in `call'
logster (2.12.2) lib/logster/middleware/reporter.rb:43:in `call'
railties (7.0.5.1) lib/rails/rack/logger.rb:40:in `call_app'
railties (7.0.5.1) lib/rails/rack/logger.rb:27:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
actionpack (7.0.5.1) lib/action_dispatch/middleware/remote_ip.rb:93:in `call'
actionpack (7.0.5.1) lib/action_dispatch/middleware/request_id.rb:26:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
rack (2.2.8) lib/rack/method_override.rb:24:in `call'
actionpack (7.0.5.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
rack (2.2.8) lib/rack/sendfile.rb:110:in `call'
actionpack (7.0.5.1) lib/action_dispatch/middleware/host_authorization.rb:131:in `call'
rack-mini-profiler (3.1.0) lib/mini_profiler.rb:260:in `call'
message_bus (4.3.7) lib/message_bus/rack/middleware.rb:60:in `call'
lib/middleware/request_tracker.rb:228:in `call'
railties (7.0.5.1) lib/rails/engine.rb:530:in `call'
railties (7.0.5.1) lib/rails/railtie.rb:226:in `public_send'
railties (7.0.5.1) lib/rails/railtie.rb:226:in `method_missing'
rack (2.2.8) lib/rack/urlmap.rb:74:in `block in call'
rack (2.2.8) lib/rack/urlmap.rb:58:in `each'
rack (2.2.8) lib/rack/urlmap.rb:58:in `call'
unicorn (6.1.0) lib/unicorn/http_server.rb:634:in `process_client'
unicorn (6.1.0) lib/unicorn/http_server.rb:739:in `worker_loop'
unicorn (6.1.0) lib/unicorn/http_server.rb:547:in `spawn_missing_workers'
unicorn (6.1.0) lib/unicorn/http_server.rb:143:in `start'
unicorn (6.1.0) bin/unicorn:128:in `<top (required)>'
vendor/bundle/ruby/3.2.0/bin/unicorn:25:in `load'
vendor/bundle/ruby/3.2.0/bin/unicorn:25:in `<main>'
1 Like
david
(David Taylor)
August 10, 2023, 2:43pm
2
A manual rebuild should completely fix things, and the /upgrade
page should become available again.
Are you running a standard install ? Can you let us know what plugin’s you have installed?
1 Like
kdambekalns
(Karsten Dambekalns)
August 10, 2023, 3:26pm
3
Standard install , but I admit the site is running since 2018 IIRC, so… but at least it’s docker-based and feels like a standard setup. As I said, so far everything worked as expected.
Plugins:
I rebuilt again, fixed the permissions and ran a few git config --global --add safe.directory …
commands, but the /upgrade
page is still showing an error and the log says:
NoMethodError (undefined method `sub!' for nil:NilClass)
app/controllers/application_controller.rb:420:in `block in with_resolved_locale'
app/controllers/application_controller.rb:420:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:74:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:389:in `call'
lib/middleware/gtm_script_nonce_injector.rb:10:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/request_tracker.rb:228:in `call'
1 Like
david
(David Taylor)
August 10, 2023, 4:26pm
4
Please could you try running these commands
./launcher enter app
cd /var/www/discourse/plugins
su discourse
for d in *; do echo "$d: $(git -C $d config --get remote.origin.url)"; done
Every plugin should have a remote URL shown in the list. I suspect, based on the error, that one of them doesn’t
Expected output is something like
chat: https://github.com/discourse/discourse.git
discourse-automation: https://github.com/discourse/discourse-automation
discourse-chat-integration: https://github.com/discourse/discourse-chat-integration.git
...
1 Like
kdambekalns
(Karsten Dambekalns)
August 10, 2023, 7:55pm
5
Hu, none of the plugins has a remote URL:
discourse@ocean-app:/var/www/discourse/plugins$ for d in *; do echo "$d: $(git -C $d config --get remote.origin.url)"; done
chat:
discourse-chat-integration:
discourse-details:
discourse-lazy-videos:
discourse-local-dates:
discourse-narrative-bot:
discourse-presence:
discourse-solved:
docker_manager:
plugins:
poll:
styleguide:
Interesting… actually, none of the directories even has a .git
folder.
kdambekalns
(Karsten Dambekalns)
August 10, 2023, 8:11pm
6
Digging further, the way we installed the plugins lacked the part sudo -E -u discourse
on the git clone …
calls in containers/app.yml
. Then again, the existing docker_manager
line did never have this.
pfaffman
(Jay Pfaffman)
August 10, 2023, 10:23pm
7
I don’t think that’s the problem.
I think I suggested that they change the examples when they started suggesting to do that, but it didn’t get any attention.
I still don’t do that, but think I might start, as it might keep git from complaining.
david
(David Taylor)
August 11, 2023, 7:34am
8
Huh! That is very strange, and would definitely explain the error. It looks like even Discourse core’s .git
is missing (since chat
/poll
/etc. don’t have a URL).
Can you share the snippet of app.yml
where the plugins are installed?
This is also a little weird:
Karsten Dambekalns:
plugins:
It suggests you have a plugins directory inside your plugins directory
2 Likes
Ed_S
(Ed S)
August 11, 2023, 7:39am
9
Sometimes when people find that there is no .git subdirectory, it’s because someone made a simple copy from one place to another, and the copy missed out the dotfiles. This would never happen with a standard installation, but could happen where there is a bit of history of people doing things which they believe they understand. (Which I mean in a nice way, but it can cause mistakes.)
2 Likes
kdambekalns
(Karsten Dambekalns)
August 16, 2023, 9:36am
10
This is how the plugins are installed from app.yml
hooks:
after_code:
- exec:
cd: $home/plugins
cmd:
- git clone https://github.com/discourse/docker_manager.git
- git clone https://github.com/discourse/discourse-solved.git
- git clone https://github.com/discourse/discourse-chat-integration.git
There was an extra mkdir plugins
as the first command, that’s why the (empty) plugins
folder existed. I removed that leftover from the past years…
The folder for the packages installed as per the app.yml
above all have a .git
foler inside.
Coming back to listing the remote URLs… as discourse
user:
discourse@ocean-app:/var/www/discourse/plugins$ for d in *; do echo "$d: $(git -C $d config --get remote.origin.url)"; done
chat:
discourse-chat-integration: https://github.com/discourse/discourse-chat-integration.git
discourse-details:
discourse-lazy-videos:
discourse-local-dates:
discourse-narrative-bot:
discourse-presence:
discourse-solved: https://github.com/discourse/discourse-solved.git
docker_manager: https://github.com/discourse/docker_manager.git
poll:
styleguide:
As root
user:
root@ocean-app:/var/www/discourse/plugins# for d in *; do echo "$d: $(git -C $d config --get remote.origin.url)"; done
chat: https://github.com/discourse/discourse.git
discourse-chat-integration:
discourse-details: https://github.com/discourse/discourse.git
discourse-lazy-videos: https://github.com/discourse/discourse.git
discourse-local-dates: https://github.com/discourse/discourse.git
discourse-narrative-bot: https://github.com/discourse/discourse.git
discourse-presence: https://github.com/discourse/discourse.git
discourse-solved:
docker_manager: https://github.com/discourse/docker_manager.git
poll: https://github.com/discourse/discourse.git
styleguide: https://github.com/discourse/discourse.git
My guess: permissions are totally borked. Is this looking correct (inside the container)?
root@ocean-app:/var/www/discourse# ls -la
total 508
drwxr-xr-x 1 root root 4096 Aug 10 15:38 .
drwxr-xr-x 1 root root 4096 Jul 11 00:33 ..
drwxr-xr-x 1 root root 4096 Jul 11 00:34 app
drwxr-xr-x 1 root root 4096 Aug 10 14:36 bin
-rw-r--r-- 1 root root 316 Aug 10 14:36 Brewfile
drwxr-xr-x 1 root root 4096 Jul 11 00:34 .bundle
drwxr-xr-x 1 root root 4096 Aug 10 14:47 config
-rw-r--r-- 1 root root 304 Aug 10 14:36 config.ru
-rw-r--r-- 1 root root 1303 Aug 10 14:36 CONTRIBUTING.md
-rw-r--r-- 1 root root 2347 Aug 10 14:36 COPYRIGHT.md
lrwxrwxrwx 1 root root 10 Aug 10 14:36 d -> bin/docker
drwxr-xr-x 1 root root 4096 Aug 10 14:36 db
drwxr-xr-x 1 root root 4096 Aug 10 14:36 .devcontainer
-rw-r--r-- 1 root root 1315 Aug 10 14:36 discourse.sublime-project
drwxr-xr-x 1 root root 4096 Aug 10 14:36 docs
drwxr-xr-x 1 root root 4096 Aug 10 14:36 documentation
-rw-r--r-- 1 root root 305 Aug 10 14:36 .editorconfig
-rw-r--r-- 1 root root 334 Aug 10 14:36 .eslintignore
-rw-r--r-- 1 root root 1061 Aug 10 14:36 .eslintrc
-rw-r--r-- 1 root root 7146 Aug 10 14:36 Gemfile
-rw-r--r-- 1 root root 15678 Aug 10 14:36 Gemfile.lock
drwxr-xr-x 1 root root 4096 Aug 10 14:36 .git
-rw-r--r-- 1 root root 852 Aug 10 14:36 .gitattributes
-rw-r--r-- 1 root root 2205 Aug 10 14:36 .git-blame-ignore-revs
-rw-r--r-- 1 root root 272 Aug 10 15:38 .gitconfig
drwxr-xr-x 1 root root 4096 Aug 10 14:36 .github
-rw-r--r-- 1 root root 1282 Aug 10 14:36 .gitignore
drwxr-xr-x 1 root root 4096 Aug 10 14:36 images
-rw-r--r-- 1 root root 279 Aug 10 14:36 jsconfig.base.json
-rw-r--r-- 1 root root 432 Aug 10 14:36 .jsdoc
-rw-r--r-- 1 root root 1937 Aug 10 14:36 lefthook.yml
drwxr-xr-x 1 root root 12288 Aug 10 14:36 lib
-rw-r--r-- 1 root root 1470 Aug 10 14:36 .licensed.yml
-rw-r--r-- 1 root root 375 Aug 10 14:36 .licensee.json
-rw-r--r-- 1 root root 18092 Aug 10 14:36 LICENSE.txt
drwxr-xr-x 1 root root 4096 Aug 10 14:36 log
drwxr-xr-x 1 root root 20480 Aug 10 14:37 node_modules
-rw-r--r-- 1 root root 21 Aug 10 14:36 .npmrc
-rw-r--r-- 1 root root 3114 Aug 10 14:36 package.json
drwxr-xr-x 1 discourse discourse 4096 Aug 16 08:44 plugins
-rw-r--r-- 1 root root 728 Aug 10 14:36 .prettierignore
-rw-r--r-- 1 root root 283 Aug 10 14:36 .prettierrc
drwxr-xr-x 1 root root 4096 Aug 14 00:42 public
-rwxr-xr-x 1 root root 305 Aug 10 14:36 Rakefile
-rw-r--r-- 1 root root 6753 Aug 10 14:36 README.md
-rw-r--r-- 1 root root 25 Aug 10 14:36 .rspec
-rw-r--r-- 1 root root 246 Aug 10 14:36 .rspec_parallel
-rw-r--r-- 1 root root 290 Aug 10 14:36 .rubocop.yml
-rw-r--r-- 1 root root 10 Aug 10 14:36 .ruby-gemset.sample
-rw-r--r-- 1 root root 6 Aug 10 14:36 .ruby-version.sample
drwxr-xr-x 1 root root 4096 Aug 10 14:36 script
drwxr-xr-x 1 root root 4096 Aug 10 14:36 spec
-rw-r--r-- 1 root root 66 Aug 10 14:36 .streerc
-rw-r--r-- 1 root root 1054 Aug 10 14:36 .template-lintrc.js
drwxr-xr-x 1 root root 4096 Aug 10 14:36 test
drwxr-xrwx 1 discourse discourse 4096 Aug 10 15:16 tmp
-rw-r--r-- 1 root root 2575 Aug 10 14:36 translator.yml
drwxr-xr-x 1 root root 4096 Jul 11 00:34 vendor
drwxr-xr-x 1 root root 4096 Aug 10 14:36 .vscode-sample
-rw-r--r-- 1 root root 204458 Aug 10 14:36 yarn.lock
What is the expected ownership/permissions setup?