Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URI::InvalidURIError on first run #13

Open
varac opened this issue Nov 20, 2018 · 2 comments
Open

URI::InvalidURIError on first run #13

varac opened this issue Nov 20, 2018 · 2 comments

Comments

@varac
Copy link

varac commented Nov 20, 2018

I built a docker image from current master branch using docker build -t 3ofcoins/docker-chef-server .

But I can't run it propoerly, it breaks like this:

$ echo $PUBLIC_URL                          
https://chef.example.com

$ docker run --rm 3ofcoins/docker-chef-server
[2018-11-20T20:40:33+00:00] INIT: Starting /init.rb
[2018-11-20T20:40:33+00:00] INIT: Preparing configuration ...
mkdir -p /var/opt/opscode/log /var/opt/opscode/etc /.chef/env
cp /.chef/chef-server.rb /var/opt/opscode/etc
[2018-11-20T20:40:33+00:00] INIT: Started 8: /opt/opscode/embedded/bin/runsvdir-start
/opt/opscode/embedded/bin/runsvdir-start: line 24: ulimit: pending signals: cannot modify limit: Operation not permitted
/opt/opscode/embedded/bin/runsvdir-start: line 37: /proc/sys/fs/file-max: Read-only file system
[2018-11-20T20:40:33+00:00] INIT: Not bootstrapped, reconfiguring
[2018-11-20T20:40:33+00:00] INIT: Started 17: /usr/bin/chef-server-ctl reconfigure
Starting Chef Client, version 14.3.37
resolving cookbooks for run list: ["private-chef::default"]
Synchronizing Cookbooks:
  - private-chef (0.1.1)
  - enterprise (0.14.1)
  - openssl (8.5.5)
  - runit (4.1.1)
  - packagecloud (1.0.0)
  - yum-epel (3.3.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Recipe: private-chef::default
  * directory[/etc/opscode] action create (up to date)
  * directory[/etc/opscode/logrotate.d] action create
    - create new directory /etc/opscode/logrotate.d
    - change mode from '' to '0755'
    - change owner from '' to 'root'
    - change group from '' to 'root'
/var/opt/opscode/local-mode-cache/cookbooks/private-chef/recipes/oc-chef-pedant.rb:41: warning: constant OpenSSL::SSL::SSLContext::METHODS is deprecated
  
  ================================================================================
  Recipe Compile Error in /var/opt/opscode/local-mode-cache/cookbooks/private-chef/recipes/default.rb
  ================================================================================
  
  URI::InvalidURIError
  --------------------
  bad URI(is not URI?): :443
  
  Cookbook Trace:
  ---------------
    /var/opt/opscode/local-mode-cache/cookbooks/private-chef/libraries/helper.rb:128:in `nginx_ssl_url'
    /var/opt/opscode/local-mode-cache/cookbooks/private-chef/recipes/oc-chef-pedant.rb:59:in `block in from_file'
    /var/opt/opscode/local-mode-cache/cookbooks/private-chef/recipes/oc-chef-pedant.rb:53:in `from_file'
    /var/opt/opscode/local-mode-cache/cookbooks/private-chef/recipes/default.rb:185:in `from_file'
  
  Relevant File Content:
  ----------------------
  /var/opt/opscode/local-mode-cache/cookbooks/private-chef/libraries/helper.rb:
  
  121:    def bookshelf_s3_url
  122:      # Using URI#to_s to strip ":443" for https and ":80" for http
  123:      URI("#{node['private_chef']['nginx']['x_forwarded_proto']}://#{vip_for_uri('bookshelf')}:#{node['private_chef']['bookshelf']['vip_port']}").to_s
  124:    end
  125:  
  126:    def nginx_ssl_url
  127:      # Using URI#to_s to strip ":443" for https and ":80" for http
  128>>     URI("#{node['private_chef']['nginx']['url']}:#{node['private_chef']['nginx']['ssl_port']}").to_s
  129:    end
  130:  
  131:    def db_connection_uri
  132:      db_protocol = "postgres"
  133:      db_user     = node['private_chef']['opscode-erchef']['sql_user']
  134:      db_password = PrivateChef.credentials.get('opscode_erchef', 'sql_password')
  135:      db_vip      = vip_for_uri('postgresql')
  136:      db_name     = "opscode_chef"
  137:  
  
  System Info:
  ------------
  chef_version=14.3.37
  platform=ubuntu
  platform_version=16.04
  ruby=ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
  program_name=/opt/opscode/embedded/bin/chef-client
  executable=/opt/opscode/embedded/bin/chef-client
  
  
  Running handlers:
  Running handlers complete
  Chef Client failed. 1 resources updated in 05 seconds
[2018-11-20T20:40:43+00:00] FATAL: Stacktrace dumped to /var/opt/opscode/local-mode-cache/chef-stacktrace.out
[2018-11-20T20:40:43+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2018-11-20T20:40:43+00:00] FATAL: URI::InvalidURIError: bad URI(is not URI?): :443
[2018-11-20T20:40:43+00:00] INIT: Reconfiguration finished: pid 17 exit 1

@mpasternacki
Copy link
Member

Pass the environment variable to the container: docker run -e PUBLIC_URL=https://chef.example.com

@mpasternacki
Copy link
Member

Reopening, this case could use better handling on the side of init script or the supplied chef-server.rb file; the error you get is not very descriptive, and it's casused by the image's plumbing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants