Beta/tests-passed sample containers do not start

Before embarking on this journey with me, please note that while this error has already been mentioned in this forum twice (one and two), the solution of ‘rebuilding data container’ didn’t work. I’m working with completely empty data, and deleting all containers/volumes/storage folders between attempts.

Please also note that I’m basing my tests on the sample files provided. It’s not a plugin, I tried removing all plugins.


I’m having issues starting empty containers for the latest tests-passed and beta branches. Stable works as expected. The error happens with with standalone or web-only (after starting data, ofc).

In order to exclude configuration errors, I did the following steps:

  • Copied the samples/standalone.yml file into containers/
  • Changed only the following things in the file:
    • Changed SMTP address to some dummy value
    • Changed discourse address to some dummy value
    • Changed the location of the shared data
    • Removed 443, and changed port 80 mapping. Here’s the result standalone.yml
    • Ran ./laucher rebuild standalone. Here are the full logs rebuilding_standalone.txt

And I get the following error:

RubyZip 3.0 is coming!
**********************

The public API of some Rubyzip classes has been modernized to use named
parameters for optional arguments. Please check your usage of the
following classes:
  * `Zip::File`
  * `Zip::Entry`
  * `Zip::InputStream`
  * `Zip::OutputStream`

Please ensure that your Gemfiles and .gemspecs are suitably restrictive
to avoid an unexpected breakage when 3.0 is released (e.g. ~> 2.3.0).
See https://github.com/rubyzip/rubyzip for details. The Changelog also
lists other enhancements and bugfixes that have been implemented since
version 2.3.0.

I, [2022-07-24T01:58:05.415957 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake plugin:pull_compatible_all'
bundler: failed to load command: rake (/var/www/discourse/vendor/bundle/ruby/2.7.0/bin/rake)
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/runtime.rb:308:in `check_for_activated_spec!': You have already activated uri 0.10.0, but your Gemfile requires uri 0.11.0. Since uri is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports uri as a default gem. (Gem::LoadError)
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/runtime.rb:25:in `block in setup'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/spec_set.rb:140:in `each'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/spec_set.rb:140:in `each'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/runtime.rb:24:in `map'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/runtime.rb:24:in `setup'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler.rb:162:in `setup'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/setup.rb:20:in `block in <top (required)>'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/ui/shell.rb:136:in `with_level'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/ui/shell.rb:88:in `silence'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/setup.rb:20:in `<top (required)>'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli/exec.rb:56:in `require_relative'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli/exec.rb:56:in `kernel_load'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli/exec.rb:23:in `run'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli.rb:483:in `exec'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli.rb:31:in `dispatch'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli.rb:25:in `start'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/exe/bundle:48:in `block in <top (required)>'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/exe/bundle:36:in `<top (required)>'
	from /usr/local/bin/bundle:23:in `load'
	from /usr/local/bin/bundle:23:in `<main>'
I, [2022-07-24T01:58:05.702191 #1]  INFO -- : 
I, [2022-07-24T01:58:05.702665 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
bundler: failed to load command: rake (/var/www/discourse/vendor/bundle/ruby/2.7.0/bin/rake)
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/runtime.rb:308:in `check_for_activated_spec!': You have already activated uri 0.10.0, but your Gemfile requires uri 0.11.0. Since uri is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports uri as a default gem. (Gem::LoadError)
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/runtime.rb:25:in `block in setup'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/spec_set.rb:140:in `each'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/spec_set.rb:140:in `each'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/runtime.rb:24:in `map'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/runtime.rb:24:in `setup'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler.rb:162:in `setup'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/setup.rb:20:in `block in <top (required)>'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/ui/shell.rb:136:in `with_level'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/ui/shell.rb:88:in `silence'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/setup.rb:20:in `<top (required)>'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli/exec.rb:56:in `require_relative'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli/exec.rb:56:in `kernel_load'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli/exec.rb:23:in `run'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli.rb:483:in `exec'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli.rb:31:in `dispatch'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli.rb:25:in `start'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/exe/bundle:48:in `block in <top (required)>'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/exe/bundle:36:in `<top (required)>'
	from /usr/local/bin/bundle:23:in `load'
	from /usr/local/bin/bundle:23:in `<main>'
I, [2022-07-24T01:58:05.953429 #1]  INFO -- : 

I also tried the two containers approach, with data and web_only. Web only has the same issue.

Between each attempt I stop and remove all containers, and also remove all data folders.

Stable branch works fine. I don’t think this is expected.


To give context, I’m now in a pretty bad situation.

I need to urgently migrate my discourse installation from the current server to a new server, as the current server will be shut down in a few days.

The current server is in 2.9.0.beta7. I can start a new server in 2.8.6, but I cannot apply a backup from the current server into the new server, as it’s a downgrade. And I’m incapable of starting a new empty server on 2.9.0.beta7, as it just gives the above error.

My data folder in the current server is big enough I don’t have space in disk enough to compact it and copy it somewhere; even if I did, I assume there would be consequences on using data from a more recent beta into an older version. I also tried to ‘downgrade’ the current server, just in case, but I know it’s unsupported and it didn’t work anyway.

Why are you forced to downgrade? Why can’t you ensure the target host is latest?

2 Likes

I don’t want to downgrade. But I cannot start a new server on 2.9.0.beta7 based on the error message I put in this post. I can only start a new server on 2.8.6. I tried several different configurations based on the sample files and my own files, and neither beta or tests-passed will start. Not sure if that information isn’t clear on the first message, or the containers file, or the log files.

In all fairness, all I need to make sure I can move my data from one server to another. It doesn’t matter exactly the version, but I need a new server up and running, and transfer the old data to the new server.

The old server is on 2.9.0.beta7 at this point in time. So I either need a new server to be able to start on latest (which isn’t working), or I need a way to transfer a data to a new 2.8.6, which is the only version I could start it.

1 Like

Sorry, understand now. So need to focus on that error?

Ideally, yes. Getting the new server with the latest version would be the simplest and easiest for me.

But if that’s not feasible for any reason, if there’s any other workaround I could use, I’d also be keen. I’m not in a position to be purist about versions.

Also, if it helps, this is the docker info on the server:

# docker info
Client:
 Context:    default
 Debug Mode: false

Server:
 Containers: 2
  Running: 0
  Paused: 0
  Stopped: 2
 Images: 5
 Server Version: 20.10.12
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: nvidia runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
 Default Runtime: runc
 Init Binary: docker-init
 containerd version:
 runc version:
 init version:
 Security Options:
  apparmor
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.0-41-generic
 Operating System: Ubuntu 22.04 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 5.797GiB
 Name: maji
 ID: OIRP:TYAE:HIPS:SIF3:NZRF:22QI:GO5A:64A4:OP2O:ALVA:PPLN:4TOH
 Docker Root Dir: /data/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

I’m running the launcher as root. Now, I’ve been running all sorts of docker containers in machines with the same configuration, and I haven’t had any issues.

Now, I’m not sure if the problem could be potentially file permissions, the error doesn’t lead me to think that at all.

/opt/discourse# ls -la
total 140
drwxr-xr-x 14 root root  4096 Jul 24 01:26 .
drwxr-xr-x  7 root root  4096 Jul 15 07:23 ..
drwxr-xr-x  8 root root  4096 Jul 24 02:30 .git
drwxr-xr-x  3 root root  4096 Jul 15 07:23 .github
-rw-r--r--  1 root root   309 Jul 15 07:23 .gitignore
-rw-r--r--  1 root root  1099 Jul 15 07:23 LICENSE
-rw-r--r--  1 root root  8285 Jul 15 07:23 README.md
drwxr-xr-x  2 root root  4096 Jul 15 07:23 bin
drwxr-xr-x  2 root root  4096 Jul 24 02:34 cids
drwxr-xr-x  2 root root  4096 Jul 24 02:30 containers
-rwxr-xr-x  1 root root 11956 Jul 15 07:23 discourse-doctor
-rwxr-xr-x  1 root root 27053 Jul 15 07:23 discourse-setup
drwxr-xr-x  8 root root  4096 Jul 15 07:23 image
-rwxr-xr-x  1 root root 22547 Jul 15 07:23 launcher
drwxr-xr-x  2 root root  4096 Jul 24 01:39 samples
drwxr-xr-x  2 root root  4096 Jul 15 07:23 scripts
drwxr-xr-x  2 root root  4096 Jul 15 07:23 shared
drwxr-xr-x  3 root root  4096 Jul 15 07:23 templates
drwxr-xr-x  2 root root  4096 Jul 15 07:23 tests
/opt/discourse# ls -la containers/
total 16
drwxr-xr-x  2 root root 4096 Jul 24 02:30 .
drwxr-xr-x 14 root root 4096 Jul 24 01:26 ..
-rw-r--r--  1 root root    0 Jul 15 07:23 .gitkeep
-rw-r--r--  1 root root 1258 Jul 24 02:08 data.yml
-rw-r--r--  1 root root 3542 Jul 24 02:30 web.yml
/opt/discourse# cd /data/discourse/
/data/discourse# ls -la
total 16
drwxr-xr-x 4 root root 4096 Jul 24 02:06 .
drwxr-xr-x 5 root root 4096 Jul 23 11:58 ..
drwxr-xr-x 6 root root 4096 Jul 24 02:09 data
drwxr-xr-x 7 root root 4096 Jul 24 02:34 web

Try to copy the following lines below the lines that say bundle install (around line 160)

  - exec:
      cd: $home
      cmd:
        - su discourse -c 'gem update uri'

I tried adding that the run block, below exec: echo "Beginning of custom commands", and I guess that was too late.

So I added it to hooks: -> after_code:

I got this:

I, [2022-07-24T12:13:24.641982 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'gem update uri'
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/local/lib/ruby/gems/2.7.0 directory.
I, [2022-07-24T12:13:29.392041 #1]  INFO -- : Updating installed gems
Updating uri

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'gem update uri' failed with return #<Process::Status: pid 132 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "cmd"=>["su discourse -c 'gem update uri'"]}

I went ahead and removed the su discourse in case it would help. That seems to have progressed well, and I bumped into other error:

I, [2022-07-24T12:21:17.497935 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake themes:update assets:precompile'
sh: 1: yarn: not found
I, [2022-07-24T12:21:19.397390 #1]  INFO -- :


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake themes:update assets:precompile' failed with return #<Process::Status: pid 5373 exit 127>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'

I thought that then I should install yarn manually? I deleted all plugins, including docker_manager, just in case. It still asked for yarn, so I thought I might as well install it:

I, [2022-07-24T12:37:42.295754 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake plugin:pull_compatible_all'
WARNING: Plugins were activated before running `rake plugin:pull_compatible_all`
  You should prefix this command with LOAD_PLUGINS=0
I, [2022-07-24T12:37:44.807237 #1]  INFO -- :
I, [2022-07-24T12:37:44.807548 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
I, [2022-07-24T12:37:48.578845 #1]  INFO -- :
I, [2022-07-24T12:37:48.579098 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake themes:update assets:precompile'
error Command "ember" not found.
I, [2022-07-24T12:37:50.795001 #1]  INFO -- : yarn run v1.22.19
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.



FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake themes:update assets:precompile' failed with return #<Process::Status: pid 5409 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"assets_precompile", "cmd"=>["su discourse -c 'bundle exec rake themes:update assets:precompile'"]}

So it started complaining about ember. Even if I tried to install it manually.

Here’s how my after_code looks like right now:

hooks:
  after_code:
    - exec:
        cd: $home
        cmd:
          - gem update uri
          - npm install -g yarn
          - npm install -g ember
        #- exec:
        # cd: $home/plugins
        #cmd:
            #- git clone https://github.com/discourse/docker_manager.git

I’m not sure that’s the right path

The good news is that this command is apparently executing now.

I noticed the LOAD_PLUGINS lacking before but didn’t mention it. Did you remove that? It’s in there in the original template. If you modified the template it wouldn’t hurt to see if there were more things you changed. Or maybe you’re on an old version. Did you git pull before you did rebuild app?

3 Likes

I didn’t touch that. I cannot find it on the web_only.yml nor on the standalone.yml sample files. I didn’t add it, but that’s just a warning I suppose?

The error I was having is related to ember, not the plugins.


To be honest, I did git pull a gazillion times, but it was pretty stable and no new commits were pulled.

As I was getting the exact link to the commit, I’ve realised that my automation was checking out master branch, and I guess that doesn’t even give a warning nor anything. As far as I checked out main, that worked. It seems like it was changed last year.

1 Like

I know that, but the lack of the LOAD_PLUGINS=0 was a sign for me that you were running against an old version of the repository.

1 Like

It would have been nice to have had a log line at the beginning of the launcher referencing the fact I was running the legacy branch. It would have saved a lot of effort.

I don’t know if the expectations on the launcher is that it would automatically change the git branch, but that didn’t happen for me for sure.