docker-redmine icon indicating copy to clipboard operation
docker-redmine copied to clipboard

Gemfile: Too many levels of symbolic links

Open hchungi opened this issue 5 years ago • 16 comments

I have tried to install redmine with external PostgreSQL, but it doesn't work for me with the logs below. Seems the problem is:

redmine | bundler: failed to load command: rake (/usr/bin/rake) redmine | Bundler::Dsl::DSLError:

Can someone tell me how to make it work?

Logs

redmine | Initializing logdir... redmine | Initializing datadir... redmine | Symlinking dotfiles... redmine | Installing configuration templates... redmine | Configuring redmine... redmine | Configuring redmine::database redmine | Configuring redmine::unicorn... redmine | Configuring redmine::secret_token... redmine | Configuring redmine::max_concurrent_ajax_uploads... redmine | Configuring redmine::sudo_mode... redmine | Configuring redmine::autologin_cookie... redmine | Configuring redmine::backups... redmine | Configuring nginx... redmine | Configuring nginx::redmine... redmine | New redmine version. Clearing cache redmine | Migrating database. Please be patient, this could take a while... redmine | bundler: failed to load command: rake (/usr/bin/rake) redmine | Bundler::Dsl::DSLError: redmine | [!] There was an error parsing Gemfile: Too many levels of symbolic links - /home/redmine/redmine/vendor/bundle/ruby/2.4.0/specifications. Bundler cannot continue. redmine | redmine | # from /home/redmine/redmine/Gemfile:45 redmine | # ------------------------------------------- redmine | # require 'erb' redmine | > require 'yaml' redmine | # database_file = File.join(File.dirname(FILE), "config/database.yml") redmine | # ------------------------------------------- redmine | redmine | /usr/lib/ruby/2.4.0/rubygems/specification.rb:752:in []' redmine | /usr/lib/ruby/2.4.0/rubygems/specification.rb:752:in gemspec_stubs_in' redmine | /usr/lib/ruby/2.4.0/rubygems/specification.rb:777:in block in map_stubs' redmine | /usr/lib/ruby/2.4.0/rubygems/specification.rb:774:in each' redmine | /usr/lib/ruby/2.4.0/rubygems/specification.rb:774:in flat_map' redmine | /usr/lib/ruby/2.4.0/rubygems/specification.rb:774:in map_stubs' redmine | /usr/lib/ruby/2.4.0/rubygems/specification.rb:766:in installed_stubs' redmine | /usr/lib/ruby/2.4.0/rubygems/specification.rb:853:in stubs_for' redmine | /usr/lib/ruby/2.4.0/rubygems/dependency.rb:279:in matching_specs' redmine | /usr/lib/ruby/2.4.0/rubygems/dependency.rb:300:in to_specs' redmine | /usr/lib/ruby/2.4.0/rubygems/dependency.rb:320:in to_spec' redmine | /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_gem.rb:65:in gem' redmine | /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:47:in require' redmine | /usr/lib/ruby/2.4.0/yaml.rb:6:in <top (required)>' redmine | /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require' redmine | /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require' redmine | /home/redmine/redmine/Gemfile:45:in eval_gemfile' redmine | /var/lib/gems/2.4.0/gems/bundler-2.1.3/lib/bundler/dsl.rb:47:in instance_eval' redmine | /var/lib/gems/2.4.0/gems/bundler-2.1.3/lib/bundler/dsl.rb:47:in eval_gemfile' redmine | /var/lib/gems/2.4.0/gems/bundler-2.1.3/lib/bundler/dsl.rb:12:in evaluate' redmine | /var/lib/gems/2.4.0/gems/bundler-2.1.3/lib/bundler/definition.rb:34:in build' redmine | /var/lib/gems/2.4.0/gems/bundler-2.1.3/lib/bundler.rb:195:in definition' redmine | /var/lib/gems/2.4.0/gems/bundler-2.1.3/lib/bundler.rb:143:in setup' redmine | /var/lib/gems/2.4.0/gems/bundler-2.1.3/lib/bundler/setup.rb:20:in block in <top (required)>' redmine | /var/lib/gems/2.4.0/gems/bundler-2.1.3/lib/bundler/ui/shell.rb:136:in with_level' redmine | /var/lib/gems/2.4.0/gems/bundler-2.1.3/lib/bundler/ui/shell.rb:88:in silence' redmine | /var/lib/gems/2.4.0/gems/bundler-2.1.3/lib/bundler/setup.rb:20:in `<top (required)>'

Here is my docker-compose file:

redmine: container_name: redmine image: sameersbn/redmine:4.1.0 environment: - DB_ADAPTER=postgresql - DB_ENCODING=utf8 - DB_HOST=172.16.8.10 - DB_PORT=5432 - DB_NAME=redmine - DB_USER=redmine - DB_PASS=redmine - TZ=Asia/Shanghai - REDMINE_PORT=10083 - REDMINE_HTTPS=false - REDMINE_SECRET_TOKEN=000000000 restart: always ports: - "10083:10083" volumes: - type: bind source: /opt/dockers/redmine/data target: /home/redmine/data

hchungi avatar Feb 13 '20 03:02 hchungi

Could you upload your compose file as a file? I've just spent 10 minutes trying to fix all the syntax errors from copy pasting it.

jcormier avatar Feb 13 '20 15:02 jcormier

redmine | bundler: failed to load command: rake (/usr/bin/rake) redmine | Bundler::Dsl::DSLError: redmine | [!] There was an error parsing Gemfile: Too many levels of symbolic links - /home/redmine/redmine/vendor/bundle/ruby/2.4.0/specifications. Bundler cannot continue.

I'm also not sure why having an external postgres would cause you issues running rake. I'm wondering if something got corrupted in the container. Make sure to run docker-compose down to delete the container.

jcormier avatar Feb 13 '20 18:02 jcormier

Could you upload your compose file as a file? I've just spent 10 minutes trying to fix all the syntax errors from copy pasting it.

Here is my docker-compose file: https://we.tl/t-vgGUTEbbOT

I use docker-compose ps -a to see containers, seems docker doesn't create a container when it happened.

hchungi avatar Feb 14 '20 09:02 hchungi

Running your example, I made some changes but redmine can't connect to the database. It doesn't look like the mysql container creates a default database for redmine...

mysql       | 2020-02-17T16:03:36.969790Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
mysql       | 2020-02-17T16:03:36.981413Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.19'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
mysql       | 2020-02-17T16:03:37.101279Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060

redmine     | Configuring redmine::database...........................................................
redmine     | Could not connect to database server. Aborting...

The redmine container can contact the server but it doesn't have a redmine database.

 $ docker-compose exec redmine mysqlshow -h mysql -p
WARNING: Some services (redis) use the 'deploy' key, which will be ignored. Compose does not support 'deploy' configuration - use `docker stack deploy` to deploy to a swarm.
Enter password: 
+--------------------+
|     Databases      |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+

Changes to docker-compose

 $ diff -u docker-compose.yml.orig docker-compose.yml
--- docker-compose.yml.orig	2020-02-17 10:57:19.204089312 -0500
+++ docker-compose.yml	2020-02-17 11:06:17.818574084 -0500
@@ -33,10 +33,10 @@
             - "3306:3306"
         volumes:
             - type: bind
-              source: /opt/usc/mysql/data
+              source: /srv/docker/redmine/mysql
               target: /var/lib/mysql
             - type: bind
-              source: /opt/usc/mysql/logs
+              source: /srv/docker/redmine/mysql-logs
               target: /var/log/mysql
     redmine:
         container_name: redmine
@@ -44,8 +44,8 @@
         environment:
             - DB_ADAPTER=postgresql
             - DB_ENCODING=utf8
-            - DB_HOST=172.16.8.55
-            - DB_PORT=5432
+            - DB_HOST=mysql
+            - DB_PORT=3306
             - DB_NAME=redmine
             - DB_USER=redmine
             - DB_PASS=password
@@ -58,5 +58,5 @@
             - "10083:10083"
         volumes:
             - type: bind
-              source: /opt/usc/redmine/data
+              source: /srv/docker/redmine/redmine/
               target: /home/redmine/data

I tried configuring the mysql container to create the database and user but i can't seem to connect using the redmine user.

     mysql:
         container_name: mysql
         image: mysql:8
         environment:
             - MYSQL_ROOT_PASSWORD=password
+            - MYSQL_DATABASE=redmine
+            - MYSQL_USER=redmine
+            - MYSQL_PASS=password
             - TZ=Asia/Shanghai
 $ docker-compose exec redmine mysqlshow -h mysql -p
Enter password: 
+--------------------+
|     Databases      |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| redmine            |
| sys                |
+--------------------+
$ docker-compose exec redmine mysqladmin -h mysql -u redmine -ppassword status
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'mysql' failed
error: 'Access denied for user 'redmine'@'172.19.0.2' (using password: YES)'

Since you aren't using our standard mysql container and I'm struggling to get yours working, can you provide details on how to get it set up so I spend my time looking at your problem and not fighting with mysql?

jcormier avatar Feb 17 '20 16:02 jcormier

Another problem is that you set your example db to postgres

-            - DB_ADAPTER=postgresql
+            - DB_ADAPTER=mysql2

jcormier avatar Feb 17 '20 16:02 jcormier

I was able to reproduce your problem after switching back to the normal mysql container. I then deleted the redmine data directory and tried to up the docker. And I got stuck in a Gemfile Too many symlinks loop.

And looking in the data tmp directory, there is indeed a symlink loop.

 $ sudo rm -rf /srv/docker/redmine/redmine/*
 $ ls /srv/docker/redmine/redmine/
 $ docker-compose up
...
 $  $ ls -la /srv/docker/redmine/redmine/tmp/
total 8
drwxr-xr-x 1 cladmin jcormier 82 Feb 17 11:46 .
drwxr-xr-x 1 cladmin jcormier 72 Feb 17 11:46 ..
lrwxrwxrwx 1 cladmin jcormier 29 Feb 17 11:46 bundle -> /home/redmine/data/tmp/bundle
lrwxrwxrwx 1 cladmin jcormier 35 Feb 17 11:46 Gemfile.lock -> /home/redmine/data/tmp/Gemfile.lock
drwxr-xr-x 1 cladmin jcormier  0 Feb 17 11:46 plugin_assets
drwxr-xr-x 1 cladmin jcormier  0 Feb 17 11:46 thumbnails

Note this bug can be avoided by properly bring the container down after deleting the redmine directory. Although just deleting the tmp directory would have worked too.

 $ sudo rm -rf /srv/docker/redmine/redmine/*
 $ /usr/local/bin/docker-compose down
WARNING: Found orphan containers (rabbit, redis) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Removing issue412_redmine_run_b997a1070866 ... done
Removing redmine                           ... done
Removing mysql                             ... done
Removing network issue412_default
 $ /usr/local/bin/docker-compose up
...
redmine_1     | 2020-02-17 22:22:19,036 INFO success: unicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
redmine_1     | 2020-02-17 22:22:19,036 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
redmine_1     | 2020-02-17 22:22:19,036 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

My current version of your compose file. docker-compose.zip

Although this can be reproduced using the example docker files.

 $ sudo rm -rf /srv/docker/redmine/redmine/*
 $ docker-compose up
...
redmine_1     | 2020-02-17 22:22:19,036 INFO success: unicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
redmine_1     | 2020-02-17 22:22:19,036 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
redmine_1     | 2020-02-17 22:22:19,036 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
^CGracefully stopping... (press Ctrl+C again to force)
Stopping docker-redmine_redmine_1    ... done
Stopping docker-redmine_postgresql_1 ... done

 $ sudo rm -rf /srv/docker/redmine/redmine/*
 $ docker-compose up
...
redmine_1     | [!] There was an error parsing `Gemfile`: Too many levels of symbolic links - /home/redmine/redmine/vendor/bundle/ruby/2.4.0/specifications. Bundler cannot continue.

Note that it is not expected for the data directory to be deleted and the container to not be deleted at the same time. In general, this project was set up with the expectation that the container would be destroyed or brought "down" whenever it is stopped. Although as long as the data directory is left alone, you don't have to destroy the container.

jcormier avatar Feb 17 '20 16:02 jcormier

At this point, I consider this to be a low priority bug.

To recover from this scenario, it should be sufficient to delete the tmp directory in the redmine data directory and bring down and up the docker.

jcormier avatar Feb 17 '20 18:02 jcormier

Thanks for spending your time to figure this out. Actually, there is a mysql container in the docker-compose file. But I do have a postgre db on another machine (172.16.8.55), which is different then redmine used.

Here is my infrastructure:

  • Machine A (172.16.8.56) - Redmine, MySql and other containers.
  • Machine B (172.16.8.55) - PostgreSQL

hchungi avatar Feb 19 '20 03:02 hchungi

I see. I hope the above fix works for you.

On Tue, Feb 18, 2020 at 10:38 PM hchungi [email protected] wrote:

Thanks for spending your time to figure this out. Actually, there is a mysql container in the docker-compose file. But I do have a postgre db on another machine (172.16.8.55), which is different then redmine used.

Here is my infrastructure:

  • Machine A (172.16.8.56) - Redmine, MySql and other containers.
  • Machine B (172.16.8.55) - PostgreSQL

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/sameersbn/docker-redmine/issues/412?email_source=notifications&email_token=ABK2RGIQ7WPJ6B5QA3WS4G3RDSSUPA5CNFSM4KUJJK6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMGHN4I#issuecomment-588019441, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABK2RGJFAV23W2MX7CGDDXTRDSSUPANCNFSM4KUJJK6A .

-- Jonathan Cormier Software Engineer

Voice: 315.425.4045 x222

http://www.CriticalLink.com http://www.criticallink.com/ 6712 Brooklawn Parkway, Syracuse, NY 13211

https://www.linkedin.com/company/critical-link-llc https://twitter.com/Critical_Link

jcormier avatar Feb 19 '20 14:02 jcormier

Should I close this issue or leave it?

I see. I hope the above fix works for you. On Tue, Feb 18, 2020 at 10:38 PM hchungi @.***> wrote: Thanks for spending your time to figure this out. Actually, there is a mysql container in the docker-compose file. But I do have a postgre db on another machine (172.16.8.55), which is different then redmine used. Here is my infrastructure: - Machine A (172.16.8.56) - Redmine, MySql and other containers. - Machine B (172.16.8.55) - PostgreSQL

hchungi avatar Feb 22 '20 07:02 hchungi

No, I think the bug does exist. I just don't have the time to track it down and fix it. And we have a workaround for now.

jcormier avatar Feb 24 '20 14:02 jcormier

Have the same issue on windows 10.

After installation, it was OK, but after a reboot became broken. Any ideas about how to fix it without purging the database?

drholera avatar Apr 11 '20 20:04 drholera

To recover from this scenario, it should be sufficient to delete the tmp directory in the redmine data directory and bring down and up the docker.

If you are consistently getting into this state after reboots. Then we need to investigate further as this is not normal behavior.

I've not used this container on Windows but for my Linux service script, I call docker-compose down on shutdown and docker-compose up on startup.

jcormier avatar Apr 13 '20 15:04 jcormier

Same problem, tmp directory removal doesn't help because bundle -> /home/redmine/data/tmp/bundle symlink re-creates every start of container. Any ideas?

gmsalex avatar Aug 09 '20 18:08 gmsalex

You need to destroy the container. WIth docker-compose this is done with "docker-compose down"

On Sun, Aug 9, 2020 at 2:08 PM gmsalex [email protected] wrote:

Same problem, tmp directory removal doesn't help because bundle -> /home/redmine/data/tmp/bundle symlink re-creates every start of container. Any ideas?

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/sameersbn/docker-redmine/issues/412#issuecomment-671083433, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABK2RGMDL2OMFOPLQDI77CDR73QYDANCNFSM4KUJJK6A .

-- Jonathan Cormier Software Engineer

Voice: 315.425.4045 x222

http://www.CriticalLink.com http://www.criticallink.com/ 6712 Brooklawn Parkway, Syracuse, NY 13211

https://www.linkedin.com/company/critical-link-llc https://twitter.com/Critical_Link

jcormier avatar Aug 10 '20 20:08 jcormier

If problem still persist, this solved for me docker system prune && docker system prune --volumes

Avskum avatar Sep 02 '20 11:09 Avskum